From 96dc4f9fb64690fc34410415fd1fc609cf803f61 Mon Sep 17 00:00:00 2001 From: Sahara Date: Thu, 16 Feb 2017 18:29:15 +0000 Subject: usercopy: Move enum for arch_within_stack_frames() This patch moves the arch_within_stack_frames() return value enum up in the header files so that per-architecture implementations can reuse the same return values. Signed-off-by: Sahara Signed-off-by: James Morse [kees: adjusted naming and commit log] Signed-off-by: Kees Cook --- mm/usercopy.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'mm') diff --git a/mm/usercopy.c b/mm/usercopy.c index d155e12563b1..1eba99baf1cf 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c @@ -19,15 +19,9 @@ #include #include #include +#include #include -enum { - BAD_STACK = -1, - NOT_STACK = 0, - GOOD_FRAME, - GOOD_STACK, -}; - /* * Checks if a given pointer and length is contained by the current * stack frame (if possible). -- cgit From 517e1fbeb65f5eade8d14f46ac365db6c75aea9b Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Tue, 4 Apr 2017 14:09:00 -0700 Subject: mm/usercopy: Drop extra is_vmalloc_or_module() check Previously virt_addr_valid() was insufficient to validate if virt_to_page() could be called on an address on arm64. This has since been fixed up so there is no need for the extra check. Drop it. Signed-off-by: Laura Abbott Acked-by: Mark Rutland Signed-off-by: Kees Cook --- mm/usercopy.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'mm') diff --git a/mm/usercopy.c b/mm/usercopy.c index 1eba99baf1cf..a9852b24715d 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c @@ -200,17 +200,6 @@ static inline const char *check_heap_object(const void *ptr, unsigned long n, { struct page *page; - /* - * Some architectures (arm64) return true for virt_addr_valid() on - * vmalloced addresses. Work around this by checking for vmalloc - * first. - * - * We also need to check for module addresses explicitly since we - * may copy static data from modules to userspace - */ - if (is_vmalloc_or_module_addr(ptr)) - return NULL; - if (!virt_addr_valid(ptr)) return NULL; -- cgit