~apparmor-dev/apparmor/master

« back to all changes in this revision

Viewing changes to tests/regression/apparmor/mmap.sh

  • Committer: Steve Beattie
  • Date: 2019-02-19 09:38:13 UTC
  • Revision ID: sbeattie@ubuntu.com-20190219093813-ud526ee6hwn8nljz
The AppArmor project has been converted to git and is now hosted on
gitlab.

To get the converted repository, please do
  git clone https://gitlab.com/apparmor/apparmor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/bash
2
 
#       Copyright (C) 2002-2005 Novell/SUSE
3
 
#
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
7
 
#       License.
8
 
 
9
 
#=NAME mmap
10
 
#=DESCRIPTION 
11
 
# This test verifies that mmap based access control is also subject to the 
12
 
# AppArmor profiles access specification.    The test needs some 
13
 
# attention/rethought,  It is unclear what it's purpose really is. Also why 
14
 
# does it fail when the profile is replaced with just read permission as 
15
 
# no mapped write is reattempted.   Also a test should be added which 
16
 
# causes the initial mmap write to fail (due to lack of write permission).  
17
 
#=END
18
 
 
19
 
pwd=`dirname $0`
20
 
pwd=`cd $pwd ; /bin/pwd`
21
 
 
22
 
bin=$pwd
23
 
 
24
 
. $bin/prologue.inc
25
 
 
26
 
file=$tmpdir/src
27
 
okperm=rw
28
 
badperm=r
29
 
 
30
 
# PASS TEST (pt 1)
31
 
 
32
 
genprofile $file:$okperm signal:receive:peer=unconfined
33
 
 
34
 
runtestbg "READ/WRITE pass1" pass $file
35
 
 
36
 
sleep 2
37
 
 
38
 
# PASS TEST (pt 2)
39
 
 
40
 
kill -USR1 $_pid
41
 
 
42
 
checktestbg
43
 
 
44
 
rm -f $file
45
 
 
46
 
 
47
 
 
48
 
# FAILURE TEST (pt 1)
49
 
 
50
 
genprofile $file:$okperm signal:receive:peer=unconfined
51
 
 
52
 
runtestbg "READ/WRITE pass2" pass $file
53
 
 
54
 
sleep 2
55
 
 
56
 
genprofile $file:$badperm signal:receive:peer=unconfined 
57
 
 
58
 
# FAILURE TEST (pt 2)
59
 
 
60
 
kill -USR1 $_pid
61
 
 
62
 
checktestbg