linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/usercopy: Drop extra is_vmalloc_or_module check
@ 2017-04-04 21:09 Laura Abbott
  2017-04-04 21:10 ` Kees Cook
  2017-04-05 13:17 ` Mark Rutland
  0 siblings, 2 replies; 3+ messages in thread
From: Laura Abbott @ 2017-04-04 21:09 UTC (permalink / raw)
  To: linux-arm-kernel

virt_addr_valid was previously 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 <labbott@redhat.com>
---
I've given this some testing on my machine and haven't seen any problems
(e.g. random crashes without the check) and the fix has been in for long
enough now. I'm in no rush to have this merged so I'm okay if this sits in
a tree somewhere to get more testing.
---
 mm/usercopy.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/mm/usercopy.c b/mm/usercopy.c
index d155e12563b1..4d23a0e0e232 100644
--- a/mm/usercopy.c
+++ b/mm/usercopy.c
@@ -206,17 +206,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;
 
-- 
2.12.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] mm/usercopy: Drop extra is_vmalloc_or_module check
  2017-04-04 21:09 [PATCH] mm/usercopy: Drop extra is_vmalloc_or_module check Laura Abbott
@ 2017-04-04 21:10 ` Kees Cook
  2017-04-05 13:17 ` Mark Rutland
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2017-04-04 21:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 4, 2017 at 2:09 PM, Laura Abbott <labbott@redhat.com> wrote:
> virt_addr_valid was previously 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 <labbott@redhat.com>
> ---
> I've given this some testing on my machine and haven't seen any problems
> (e.g. random crashes without the check) and the fix has been in for long
> enough now. I'm in no rush to have this merged so I'm okay if this sits in
> a tree somewhere to get more testing.

Awesome, thanks! I'll get it into my usercopy branch for -next.

-Kees

> ---
>  mm/usercopy.c | 11 -----------
>  1 file changed, 11 deletions(-)
>
> diff --git a/mm/usercopy.c b/mm/usercopy.c
> index d155e12563b1..4d23a0e0e232 100644
> --- a/mm/usercopy.c
> +++ b/mm/usercopy.c
> @@ -206,17 +206,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;
>
> --
> 2.12.1
>



-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] mm/usercopy: Drop extra is_vmalloc_or_module check
  2017-04-04 21:09 [PATCH] mm/usercopy: Drop extra is_vmalloc_or_module check Laura Abbott
  2017-04-04 21:10 ` Kees Cook
@ 2017-04-05 13:17 ` Mark Rutland
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2017-04-05 13:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 04, 2017 at 02:09:00PM -0700, Laura Abbott wrote:
> virt_addr_valid was previously 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 <labbott@redhat.com>
> ---
> I've given this some testing on my machine and haven't seen any problems
> (e.g. random crashes without the check) and the fix has been in for long
> enough now. I'm in no rush to have this merged so I'm okay if this sits in
> a tree somewhere to get more testing.

This looks good to me, given your fix for virt_add_valid() in mainline.
FWIW:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
>  mm/usercopy.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/mm/usercopy.c b/mm/usercopy.c
> index d155e12563b1..4d23a0e0e232 100644
> --- a/mm/usercopy.c
> +++ b/mm/usercopy.c
> @@ -206,17 +206,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;
>  
> -- 
> 2.12.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-05 13:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 21:09 [PATCH] mm/usercopy: Drop extra is_vmalloc_or_module check Laura Abbott
2017-04-04 21:10 ` Kees Cook
2017-04-05 13:17 ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).