From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756429AbcIUUGM (ORCPT ); Wed, 21 Sep 2016 16:06:12 -0400 Received: from foss.arm.com ([217.140.101.70]:54856 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753243AbcIUUGK (ORCPT ); Wed, 21 Sep 2016 16:06:10 -0400 Date: Wed, 21 Sep 2016 21:06:01 +0100 From: Mark Rutland To: Laura Abbott Cc: Catalin Marinas , Will Deacon , Ard Biesheuvel , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: Correctly bounds check virt_addr_valid Message-ID: <20160921200601.GA24734@remoulade> References: <1474478928-25022-1-git-send-email-labbott@redhat.com> <20160921175855.GG18176@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 21, 2016 at 12:34:46PM -0700, Laura Abbott wrote: > On 09/21/2016 10:58 AM, Mark Rutland wrote: > >Are there other potentially-broken users of virt_addr_valid? It's not > >clear to me what some drivers are doing with this, and therefore whether > >we need to cc stable. > > The number of users is pretty limited. Some of them use it as a debugging > check, others are using it more like hardened usercopy. The number of > users that would actually affect arm64 seems so small I don't think it's > worth trying to backport to stable. Ok. > Hardened usercopy was getting hit particularly hard because usercopy was > happening on all types of memory whereas the drivers tend to be more limited > in scope. Sure. > >Given the common sub-expression, perhaps it would be better to leave > >these as-is, but prefix them with '_', and after the #endif, have > >something like: > > > >#define _virt_addr_is_linear(kaddr) (((u64)(kaddr)) >= PAGE_OFFSET) > >#define virt_addr_valid(kaddr) (_virt_addr_is_linear(kaddr) && _virt_addr_valid(kaddr)) > > > > Good suggestion. FWIW, with that, feel free to add: Acked-by: Mark Rutland Thanks, Mark.