apparmor aa_change_onexec doesn't work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Lucid |
Won't Fix
|
Medium
|
John Johansen | ||
Maverick |
Fix Released
|
Undecided
|
Unassigned | ||
Natty |
Invalid
|
Undecided
|
Unassigned |
Bug Description
libapparmor provides an aa_change_onexec(3) function which writes into /proc/self/
The provided program and profile will demonstrate the problem.
Save the profile into /etc/apparmor.
Load the profile with: sudo apparmor_parser --replace /etc/apparmor.
Compile the program with: gcc -o aa-change aa-change.c -lapparmor
Run the program as follows:
$ ./aa-change profile test_onexec 'head -1 /etc/passwd ; cat /proc/self/
Currently running in domain 'test_onexec (enforce)'
sh: head: Permission denied
test_onexec (enforce)
$ ./aa-change exec test_onexec 'head -1 /etc/passwd ; cat /proc/self/
Will transition to 'test_onexec (enforce)' domain on exec()
root:x:
unconfined
'profile' uses aa_change_
'exec' uses aa_change_onexec(3) to change into the test_onexec profile at the next exec(2) call. 'head' runs (it should fail) and reads /etc/passwd (which should also fail). The 'cat' process is unconfined. Thus the aa_change_onexec(3) has failed. Output should be very similar to 'profile' case.
$ uname -a
Linux haig 2.6.32-26-generic #47-Ubuntu SMP Wed Nov 17 15:58:05 UTC 2010 x86_64 GNU/Linux
$ cat /proc/version_
Ubuntu 2.6.32-
$
dmesg will include lines like the following:
type=1505 audit(129289419
type=1503 audit(129289441
While watching dmesg output you can confirm that the 'exec' mode of the test program doesn't reject execution of /usr/bin/head, while the 'profile' mode of the test program does reject execution of /usr/bin/head.
Feel free to close WONTFIX if fixing this is beyond the scope of LTS. (I want to save others time in the future when this issue is discovered by someone else.)
Changed in linux (Ubuntu Maverick): | |
status: | New → Fix Released |
Changed in linux (Ubuntu Lucid): | |
assignee: | nobody → John Johansen (jjohansen) |
importance: | Undecided → Medium |
milestone: | none → lucid-updates |
status: | New → Triaged |
Changed in linux (Ubuntu Natty): | |
status: | New → Invalid |
Okay, I finally got a 10.10 virtual image installed and can confirm that this bug has been fixed in 10.10.