Thread (37 messages) 37 messages, 7 authors, 2016-07-21

Re: [PATCH v3 02/11] mm: Hardened usercopy

From: Kees Cook <hidden>
Date: 2016-07-19 22:56:03
Also in: linux-arm-kernel, linux-mm, linuxppc-dev, lkml, sparclinux

On Tue, Jul 19, 2016 at 12:12 PM, Kees Cook [off-list ref] wrote:
On Mon, Jul 18, 2016 at 6:52 PM, Laura Abbott [off-list ref] wrote:
quoted
On 07/15/2016 02:44 PM, Kees Cook wrote:
quoted
+static inline const char *check_heap_object(const void *ptr, unsigned
long n,
+                                           bool to_user)
+{
+       struct page *page, *endpage;
+       const void *end = ptr + n - 1;
+
+       if (!virt_addr_valid(ptr))
+               return NULL;
+

virt_addr_valid returns true on vmalloc addresses on arm64 which causes some
intermittent false positives (tab completion in a qemu buildroot environment
was showing it fairly reliably). I think this is an arm64 bug because
virt_addr_valid should return true if and only if virt_to_page returns the
corresponding page. We can work around this for now by explicitly
checking against is_vmalloc_addr.
Hrm, that's weird. Sounds like a bug too, but I'll add a check for
is_vmalloc_addr() to catch it for now.
BTW, if you were testing against -next, KASAN moved things around in
copy_*_user() in a way I wasn't expecting (__copy* and copy* now both
call __arch_copy* instead of copy* calling __copy*). I'll have this
fixed in the next version.

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help