From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756698AbcIVJRn (ORCPT ); Thu, 22 Sep 2016 05:17:43 -0400 Received: from foss.arm.com ([217.140.101.70]:33716 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751829AbcIVJRl (ORCPT ); Thu, 22 Sep 2016 05:17:41 -0400 Date: Thu, 22 Sep 2016 10:17:43 +0100 From: Will Deacon To: Laura Abbott Cc: Catalin Marinas , Ard Biesheuvel , Mark Rutland , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2] arm64: Correctly bounds check virt_addr_valid Message-ID: <20160922091743.GB22670@arm.com> References: <1474496704-30541-1-git-send-email-labbott@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1474496704-30541-1-git-send-email-labbott@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 21, 2016 at 03:25:04PM -0700, Laura Abbott wrote: > > virt_addr_valid is supposed to return true if and only if virt_to_page > returns a valid page structure. The current macro does math on whatever > address is given and passes that to pfn_valid to verify. vmalloc and > module addresses can happen to generate a pfn that 'happens' to be > valid. Fix this by only performing the pfn_valid check on addresses that > have the potential to be valid. > > Acked-by: Mark Rutland > Signed-off-by: Laura Abbott > --- > v2: Properly parenthesize macro arguments. Re-factor to common macro. > > Also in case it wasn't clear, there's no need to try and squeeze this > into 4.8. Hardened usercopy should have all the checks, this is just for > full correctness. Thanks, I'll push this onto for-next/core later today. Will