Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3330533pxk; Mon, 21 Sep 2020 10:47:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmIp/IrGV4uc6xMB8QYPewDGabJDsCYDu7sZG1+gcqqXdW5ZHU+rffEDGVRgdYcPpGgtTi X-Received: by 2002:aa7:da16:: with SMTP id r22mr97815eds.132.1600710475985; Mon, 21 Sep 2020 10:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600710475; cv=none; d=google.com; s=arc-20160816; b=kyz2ZruJZlaLP5b+c00ha/V+yh+giiaCb3A+SizhIZrCz18+5LQtlvVx60O7wNOreC U2Xjrn1VMbqHoMbkTU3npjlEdmPy+DMutY6DH4J/JS1SDPC2P7M8wc/EvLo/NalbnnoQ Su4FEELIRWVxwUdkG0fM7Q58Hr/41+eiER1FTlC6o2eIVc9dsHfZTyVy2RBFFpu7fe5T 94uwPTpgQ0jApo9Nii+/Er9oT9g/BbfqFQ0vc4u3cTc1Hw6j6y5J4gCELEDSoPKsBUXq feSfSQ19zMYGudkG0eM0ZD/bWPLr7MLc2aOOIdZSYAn5hAzawLmwdVTT7UZbwlp5mYNA pR3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=k3ZAse6fBHZTtGXuZq3UGtFKC8B+GnwZPbMc364KEqo=; b=eGJOnO8A/PSlBP30zP99WqFSHEeJIo6eAsNcgHVgA7EnxLtxgUPaLzCN5dCPbOYrEw ByYJUbpz//jrFWQOiqN+91dWF68XGwaAG/xBBS7Sd2eIoerSK+458+U6UBo+3CJpGqPU dEp/EvuInMCNpcHTBo+KKSzesL/BcTK0LINzwukvpvQFDHJ3RjXAGL755pXD6ciLH/A6 cFD0qsqVFWTSX7I2DPAZVPznR5Bf6fBgmsmPFGoi7kn2gsiU0YtcCJBQi6AAyqRLHZ8Z E/jR6KXczJ3W+Lx1CpWh6JAKCrspTu+140iJ7wDundTu25hB+CuIcnae5Hc68fhhi8vr zmLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xdj8QUY3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si8629944ejf.80.2020.09.21.10.47.25; Mon, 21 Sep 2020 10:47:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xdj8QUY3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727525AbgIURoI (ORCPT + 99 others); Mon, 21 Sep 2020 13:44:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:53630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727245AbgIURoI (ORCPT ); Mon, 21 Sep 2020 13:44:08 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2313C2151B; Mon, 21 Sep 2020 17:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600710247; bh=Arof+t7RZMesEWYOG0q/K65qTQSUsR3YSbeXtjQZtLU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xdj8QUY35DLXeadsX8mhIaX+uEoxr9k8Ugskr/fkdQdqVBAICA5hNRdZdrCjpDgSM OuGT+vQnC241+3LLy4YbvGKg+kv54dVMqHgO+mo0MT3UyQII9JNlSW8Ub8b3g+D+QO DAvj1xOoVEu4RWszeCUqjt9jWgCvdI6cP124z5p8= Date: Mon, 21 Sep 2020 18:43:59 +0100 From: Will Deacon To: Alexander Potapenko Cc: Marco Elver , Andrew Morton , "H. Peter Anvin" , "Paul E. McKenney" , Andrey Konovalov , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , Catalin Marinas , Christoph Lameter , Dave Hansen , David Rientjes , Dmitriy Vyukov , Eric Dumazet , Greg Kroah-Hartman , Hillf Danton , Ingo Molnar , Jann Horn , Jonathan.Cameron@huawei.com, Jonathan Corbet , Joonsoo Kim , Kees Cook , Mark Rutland , Pekka Enberg , Peter Zijlstra , sjpark@amazon.com, Thomas Gleixner , Vlastimil Babka , the arch/x86 maintainers , "open list:DOCUMENTATION" , LKML , kasan-dev , Linux ARM , Linux Memory Management List Subject: Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64 Message-ID: <20200921174357.GB3141@willie-the-truck> References: <20200921132611.1700350-1-elver@google.com> <20200921132611.1700350-4-elver@google.com> <20200921143059.GO2139@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 05:37:10PM +0200, Alexander Potapenko wrote: > On Mon, Sep 21, 2020 at 4:58 PM Alexander Potapenko wrote: > > > > On Mon, Sep 21, 2020 at 4:31 PM Will Deacon wrote: > > > > > > On Mon, Sep 21, 2020 at 03:26:04PM +0200, Marco Elver wrote: > > > > Add architecture specific implementation details for KFENCE and enable > > > > KFENCE for the arm64 architecture. In particular, this implements the > > > > required interface in . Currently, the arm64 version does > > > > not yet use a statically allocated memory pool, at the cost of a pointer > > > > load for each is_kfence_address(). > > > > > > > > Reviewed-by: Dmitry Vyukov > > > > Co-developed-by: Alexander Potapenko > > > > Signed-off-by: Alexander Potapenko > > > > Signed-off-by: Marco Elver > > > > --- > > > > For ARM64, we would like to solicit feedback on what the best option is > > > > to obtain a constant address for __kfence_pool. One option is to declare > > > > a memory range in the memory layout to be dedicated to KFENCE (like is > > > > done for KASAN), however, it is unclear if this is the best available > > > > option. We would like to avoid touching the memory layout. > > > > > > Sorry for the delay on this. > > > > NP, thanks for looking! > > > > > Given that the pool is relatively small (i.e. when compared with our virtual > > > address space), dedicating an area of virtual space sounds like it makes > > > the most sense here. How early do you need it to be available? > > > > Yes, having a dedicated address sounds good. > > We're inserting kfence_init() into start_kernel() after timekeeping_init(). > > So way after mm_init(), if that matters. > > The question is though, how big should that dedicated area be? > Right now KFENCE_NUM_OBJECTS can be up to 16383 (which makes the pool > size 64MB), but this number actually comes from the limitation on > static objects, so we might want to increase that number on arm64. What happens on x86 and why would we do something different? Will