locks on unlinked files leak memory in apparmor
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apparmor (Ubuntu) |
Invalid
|
Medium
|
Kees Cook | ||
Hardy |
Invalid
|
Medium
|
Kees Cook | ||
Intrepid |
Invalid
|
Medium
|
Kees Cook | ||
Jaunty |
Invalid
|
Medium
|
Kees Cook | ||
linux (Ubuntu) |
Fix Released
|
Medium
|
Tim Gardner | ||
Hardy |
Fix Released
|
Medium
|
Andy Whitcroft | ||
Intrepid |
Fix Released
|
Undecided
|
Andy Whitcroft | ||
Jaunty |
Fix Released
|
Medium
|
Tim Gardner |
Bug Description
Apparmor is leaks memory when unlinked files are locked by confined processes.
TEST CASE
Confining the following program:
#include <stdio.h>
#include <unistd.h>
int main(void)
{
int i;
int fd = open("/
fork();
fork();
fork();
fork();
for (i = 0; i < 5000; i++) {
}
return 0;
}
with an apparmor policy similar to the following (place the policy in /etc/apparmor.d and then do 'sudo /etc/init.
#include <tunables/global>
/PATH/TO/
#include <abstractions/base>
#include <abstractions/
#include <abstractions/
capability kill,
capability net_bind_service,
capability setgid,
capability setuid,
# Major libs
/lib/ld-*.so mr,
/lib/libc-*.so mr,
/lib/
/lib/librt-*.so mr,
/tmp/* rwk,
}
(You'll need to change /PATH/TO/
While running slabtop in another terminal, run the program.
Without the fix, slabtop should see an increase use of kernel memory, typically the kamlloc-256 slab.
With the fix in place, there shouldn't be much change in slabtop's reported output.
/var/log/messages should get a number of audit events (this confirms that confinement is applied to the binary in question).
===
SRU Justification
Justification: apparmour will leak memory leading to OOM, hangs, or crashes
Impact: certain workloads will cause memory to be leaked for each operation, specifically any name check on removed files
Fix Description: free the memory earlier in the error path
Risks: very well contained and obvious change so this should be low risk. patch is upstream (apparmour)
TEST CASE: see above
description: | updated |
Changed in linux: | |
importance: | Undecided → Medium |
status: | New → Triaged |
importance: | Undecided → Medium |
status: | New → Triaged |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in linux: | |
assignee: | nobody → apw |
importance: | Medium → Undecided |
status: | Triaged → In Progress |
assignee: | nobody → apw |
status: | Triaged → In Progress |
description: | updated |
Changed in linux: | |
status: | In Progress → Fix Committed |
status: | In Progress → Fix Committed |
and, of course:
Linux srv47 2.6.24-19-server #1 SMP Wed Aug 20 18:43:06 UTC 2008 x86_64 GNU/Linux
hardy with all updates