Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932156AbdDDVKG (ORCPT ); Tue, 4 Apr 2017 17:10:06 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:36054 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932112AbdDDVKF (ORCPT ); Tue, 4 Apr 2017 17:10:05 -0400 MIME-Version: 1.0 In-Reply-To: <1491340140-18238-1-git-send-email-labbott@redhat.com> References: <1491340140-18238-1-git-send-email-labbott@redhat.com> From: Kees Cook Date: Tue, 4 Apr 2017 14:10:03 -0700 X-Google-Sender-Auth: vlxSJlnHl9FFVCYIdG2op-LGNIQ Message-ID: Subject: Re: [PATCH] mm/usercopy: Drop extra is_vmalloc_or_module check To: Laura Abbott Cc: Linux-MM , LKML , "linux-arm-kernel@lists.infradead.org" , Mark Rutland Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1561 Lines: 51 On Tue, Apr 4, 2017 at 2:09 PM, 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 > --- > 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