[linux] 05/07: aio: mark AIO pseudo-fs noexec (CVE-2016-10044)

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Tue Mar 14 14:16:59 UTC 2017


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch jessie-security
in repository linux.

commit 51c19d7be65a1ec9ec46d1845a1b5e40cac3fd0b
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Tue Mar 14 01:26:05 2017 +0000

    aio: mark AIO pseudo-fs noexec (CVE-2016-10044)
---
 debian/changelog                                   |  1 +
 .../bugfix/all/aio-mark-aio-pseudo-fs-noexec.patch | 58 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 60 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 9c16219..3cadcdd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ linux (3.16.39-1+deb8u3) UNRELEASED; urgency=medium
     (mitigates CVE-2015-8952)
   * mnt: Add a per mount namespace limit on the number of mounts (CVE-2016-6213)
   * vfs: Commit to never having executables on proc and sysfs
+  * aio: mark AIO pseudo-fs noexec (CVE-2016-10044)
 
  -- Ben Hutchings <ben at decadent.org.uk>  Mon, 13 Mar 2017 23:29:39 +0000
 
diff --git a/debian/patches/bugfix/all/aio-mark-aio-pseudo-fs-noexec.patch b/debian/patches/bugfix/all/aio-mark-aio-pseudo-fs-noexec.patch
new file mode 100644
index 0000000..50c0e33
--- /dev/null
+++ b/debian/patches/bugfix/all/aio-mark-aio-pseudo-fs-noexec.patch
@@ -0,0 +1,58 @@
+From: Jann Horn <jann at thejh.net>
+Date: Fri, 16 Sep 2016 00:31:22 +0200
+Subject: aio: mark AIO pseudo-fs noexec
+Origin: https://git.kernel.org/linus/22f6b4d34fcf039c63a94e7670e0da24f8575a5a
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2016-10044
+
+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 at thejh.net>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+[bwh: Backported to 3.16: we don't have super_block::s_iflags; use
+ file_system_type::fs_flags instead]
+---
+ fs/aio.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/fs/aio.c
++++ b/fs/aio.c
+@@ -226,6 +226,7 @@ static int __init aio_setup(void)
+ 		.name		= "aio",
+ 		.mount		= aio_mount,
+ 		.kill_sb	= kill_anon_super,
++		.fs_flags	= FS_NOEXEC,
+ 	};
+ 	aio_mnt = kern_mount(&aio_fs);
+ 	if (IS_ERR(aio_mnt))
diff --git a/debian/patches/series b/debian/patches/series
index 7fb6f16..3c99601 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -708,6 +708,7 @@ bugfix/all/timer-restrict-timer_stats-to-initial-pid-namespace.patch
 bugfix/all/mbcache-reschedule-before-restarting-iteration-in-mb_cache_entry_alloc.patch
 bugfix/all/mnt-add-a-per-mount-namespace-limit-on-the-number-of.patch
 bugfix/all/vfs-commit-to-never-having-exectuables-on-proc-and-s.patch
+bugfix/all/aio-mark-aio-pseudo-fs-noexec.patch
 
 # Fix ABI changes
 debian/of-fix-abi-changes.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list