2
# Copyright (C) 2002-2005 Novell/SUSE
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License as
6
# published by the Free Software Foundation, version 2 of the
11
# Confined processes are prohibited from executing certain system calls
12
# entirely, including swapon(2) swapoff (2). This test verifies that
13
# unconfined processes can call these syscalls but confined processes cannot.
16
# I made this a seperate test script because of the need to make a
17
# swapfile before the tests run.
20
pwd=`cd $pwd ; /bin/pwd`
30
swap_file=$tmpdir/swapfile
32
dd if=/dev/zero of=${swap_file} bs=1024 count=512 2> /dev/null
33
/sbin/mkswap -f ${swap_file} > /dev/null
35
# TEST 1. Make sure can enable and disable swap unconfined
37
runchecktest "SWAPON (unconfined)" pass on ${swap_file}
38
runchecktest "SWAPOFF (unconfined)" pass off ${swap_file}
40
# TEST A2. confine SWAPON
43
runchecktest "SWAPON (confined)" fail on ${swap_file}
45
# TEST A3. confine SWAPOFF
47
/sbin/swapon ${swap_file}
49
runchecktest "SWAPOFF (confined)" fail off ${swap_file}
51
# cleanup, turn off swap
53
/sbin/swapoff ${swap_file}