From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7210BC4363D for ; Mon, 21 Sep 2020 17:44:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 349A52193E for ; Mon, 21 Sep 2020 17:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600710249; bh=Arof+t7RZMesEWYOG0q/K65qTQSUsR3YSbeXtjQZtLU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=F3nhUSrdCqLaWmPMAde0SMM1Z2B2n1mlvuaICgy8RfPumUIBKw54Bh+Cr0mdpCpjM pee7oRe/NHnwH/ICM71cQnd5i2PCb99kyZKR1+ezqLXUQX7/gpI/7mnagM5ntdSBoS 2yekJzntQdx3ghitW5KtXO8WvJHevFDkyFytOlAg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727983AbgIURoI (ORCPT ); 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