From: Kees Cook <keescook@chromium.org>
To: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Rik van Riel <riel@redhat.com>, Laura Abbott <labbott@redhat.com>,
VMware Graphics <linux-graphics-maintainer@vmware.com>,
Sinclair Yeh <syeh@vmware.com>, Vinson Lee <vlee@freedesktop.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Andy Lutomirski <luto@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] usercopy: remove page-spanning test for now
Date: Wed, 7 Sep 2016 10:06:09 -0700 [thread overview]
Message-ID: <20160907170609.GA763@www.outflux.net> (raw)
A custom allocator without __GFP_COMP that copies to userspace has been
found in vmw_execbuf_process[1], so this disables the page-span checker
by placing it behind a CONFIG for future work where such things can be
tracked down later.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1373326
Reported-by: Vinson Lee <vlee@freedesktop.org>
Fixes: f5509cc18daa ("mm: Hardened usercopy")
Signed-off-by: Kees Cook <keescook@chromium.org>
---
mm/usercopy.c | 8 ++++++++
security/Kconfig | 11 +++++++++++
2 files changed, 19 insertions(+)
diff --git a/mm/usercopy.c b/mm/usercopy.c
index a3cc3052f830..b3f0c3355dc8 100644
--- a/mm/usercopy.c
+++ b/mm/usercopy.c
@@ -172,6 +172,14 @@ static inline const char *check_heap_object(const void *ptr, unsigned long n,
return NULL;
}
+#ifndef CONFIG_HARDENED_USERCOPY_PAGESPAN
+ /*
+ * The page-spanning checks are hitting false positives, so
+ * do not check them for now.
+ */
+ return NULL;
+#endif
+
/* Allow kernel data region (if not marked as Reserved). */
if (ptr >= (const void *)_sdata && end <= (const void *)_edata)
return NULL;
diff --git a/security/Kconfig b/security/Kconfig
index da10d9b573a4..2dfc0ce4083e 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -147,6 +147,17 @@ config HARDENED_USERCOPY
or are part of the kernel text. This kills entire classes
of heap overflow exploits and similar kernel memory exposures.
+config HARDENED_USERCOPY_PAGESPAN
+ bool "Refuse to copy allocations that span multiple pages"
+ depends on HARDENED_USERCOPY
+ depends on !COMPILE_TEST
+ help
+ When a multi-page allocation is done without __GFP_COMP,
+ hardened usercopy will reject attempts to copy it. There are,
+ however, several cases of this in the kernel that have not all
+ been removed. This config is intended to be used only while
+ trying to find such users.
+
source security/selinux/Kconfig
source security/smack/Kconfig
source security/tomoyo/Kconfig
--
2.7.4
--
Kees Cook
Nexus Security
next reply other threads:[~2016-09-07 17:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 17:06 Kees Cook [this message]
2016-09-07 17:17 ` Linus Torvalds
2016-09-07 20:32 ` Vegard Nossum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160907170609.GA763@www.outflux.net \
--to=keescook@chromium.org \
--cc=hannes@cmpxchg.org \
--cc=labbott@redhat.com \
--cc=linux-graphics-maintainer@vmware.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=riel@redhat.com \
--cc=syeh@vmware.com \
--cc=thellstrom@vmware.com \
--cc=torvalds@linux-foundation.org \
--cc=vdavydov.dev@gmail.com \
--cc=vlee@freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®