mm: reorder can_do_mlock to fix audit denial
Subsystems (2)
PATCH 1/1 mm: reorder can_do_mlock to fix audit denial
A userspace call to mmap(MAP_LOCKED) may result in the successful locking of memory while also producing a confusing audit log denial. can_do_mlock checks capable and rlimit. If either of these return positive can_do_mlock returns true. The capable check leads to an LSM hook used by apparmour and selinux which produce the audit denial. Reordering so rlimit is checked first eliminates the denial on success, only recording a denial when the lock is unsuccessful as a result of the denial.
--- mm/mlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/mlock.c +2 -2
@@ -26,10 +26,10 @@int can_do_mlock (void ) { -if (capable (CAP_IPC_LOCK )) -return 1 ;if (rlimit (RLIMIT_MEMLOCK ) !=0 )return 1 ; +if (capable (CAP_IPC_LOCK )) +return 1 ;return 0 ; }EXPORT_SYMBOL (can_do_mlock);
Signature · 7 lines
2.2.0.rc0.207.ga3a616c -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Jeff Vander Stoep
A userspace call to
mmap(MAP_LOCKED)may result in the successful locking of memory while also producing a confusing audit log denial.can_do_mlockchecks capable and rlimit. If either of these return positivecan_do_mlockreturns true. The capable check leads to an LSM hook used by apparmour and selinux which produce the audit denial. Reordering so rlimit is checked first eliminates the denial on success, only recording a denial when the lock is unsuccessful as a result of the denial.
Quoted 25 lines
Signed-off-by Jeff Vander Stoep <[email protected]>--- mm/mlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)mm/mlock.c +2
-3@@ -26,10 +26,10 @@int can_do_mlock (void ) { -if (capable (CAP_IPC_LOCK )) -return 1 ;if (rlimit (RLIMIT_MEMLOCK ) !=0 )return 1 ; +if (capable (CAP_IPC_LOCK )) +return 1 ;return 0 ; }EXPORT_SYMBOL (can_do_mlock); --2.2.0.rc0.207.ga3a616c
Signature · 7 lines
Nick Kralevich | Android Security | [email protected] | 650.214.4037 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 8 lines · On Mon, 2 Mar 2015 09:20:32 -0800 Jeff Vander Stoep <[email protected]> wrote:
A userspace call to
mmap(MAP_LOCKED)may result in the successful locking of memory while also producing a confusing audit log denial.can_do_mlockchecks capable and rlimit. If either of these return positivecan_do_mlockreturns true. The capable check leads to an LSM hook used by apparmour and selinux which produce the audit denial. Reordering so rlimit is checked first eliminates the denial on success, only recording a denial when the lock is unsuccessful as a result of the denial.
I'm assuming that this is a minor issue - a bogus audit log, no other consequences. And based on this I queued the patch for 4.0 with no -stable backport.
All of this might have been wrong - the changelog wasn't very helpful in making such decisions (hint).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Yes, minor issue.
I appreciate the advice.
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Mon, 2 Mar 2015 09:20:32 -0800 Jeff Vander Stoep <[email protected]> wrote:
A userspace call to
mmap(MAP_LOCKED)may result in the successful locking of memory while also producing a confusing audit log denial.can_do_mlockchecks capable and rlimit. If either of these return positivecan_do_mlockreturns true. The capable check leads to an LSM hook used by apparmour and selinux which produce the audit denial. Reordering so rlimit is checked first eliminates the denial on success, only recording a denial when the lock is unsuccessful as a result of the denial.
Quoted 6 lines
I'm assuming that this is a minor issue - a bogus audit log, no other consequences. And based on this I queued the patch for 4.0 with no -stable backport.
All of this might have been wrong - the changelog wasn't very helpful in making such decisions (hint).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>