diff options
| author | Jann Horn <jann@thejh.net> | 2016-11-07 14:34:44 -0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-02-10 14:08:16 -0800 |
| commit | 92ef02fbb0f1fc2a120b7a5327964bf7ba16fc05 (patch) | |
| tree | 0bd20fb6a0bd58d88ba8890d999610efb6bb88da /lib/mpi/mpi-pow.c | |
| parent | 487ff740cb8a0111016b0da2616aa8104cb0d440 (diff) | |
BACKPORT: aio: mark AIO pseudo-fs noexec
This ensures that do_mmap() won't implicitly make AIO memory mappings
executable if the READ_IMPLIES_EXEC personality flag is set. Such
behavior is problematic because the security_mmap_file LSM hook doesn't
catch this case, potentially permitting an attacker to bypass a W^X
policy enforced by SELinux.
I have tested the patch on my machine.
To test the behavior, compile and run this:
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/personality.h>
#include <linux/aio_abi.h>
#include <err.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/syscall.h>
int main(void) {
personality(READ_IMPLIES_EXEC);
aio_context_t ctx = 0;
if (syscall(__NR_io_setup, 1, &ctx))
err(1, "io_setup");
char cmd[1000];
sprintf(cmd, "cat /proc/%d/maps | grep -F '/[aio]'",
(int)getpid());
system(cmd);
return 0;
}
In the output, "rw-s" is good, "rwxs" is bad.
Signed-off-by: Jann Horn <jann@thejh.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 22f6b4d34fcf039c63a94e7670e0da24f8575a5a)
Bug: 31711619
Change-Id: Ib4ffd30b61f1d9ba629049f65a21afbf94e25cfd
Git-commit: 689ea150ab61cb193268d4b7f68de68acf207db4
Git-repo: https://android.googlesource.com/kernel/msm
Signed-off-by: Dennis Cagle<d-cagle@codeaurora.org>
Diffstat (limited to 'lib/mpi/mpi-pow.c')
0 files changed, 0 insertions, 0 deletions
