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=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 166EFC4741F for ; Tue, 29 Sep 2020 13:56:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69DCC206B7 for ; Tue, 29 Sep 2020 13:56:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="psDp5PbR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69DCC206B7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NsdhPzqIm1mF7cXer+uLDX+w7mgw16AxpL1ocHweJ+s=; b=psDp5PbRJN/jkuv/B8BeJC5iE x2+zrQ/JkijOV+2joKOCHf1p8RzsiO69ovoBEBXAuqsuQPOhDF9q6JpRzVZ+29zQOzbLIQLwGxNXj vXCm1vcgumYJf1Cy6qTelGHRp8nRl5MYhnTNR/A+lD91gybrvehw+7FMmR0WXiCTwAGUsm8GAwOK1 UbRhGmNJT+yYs8fJEUMEibhMIka0aANsXDbHbi53COTmSa6x3G6K4aJhk24yAtaj6EI9+hIfm7YmT Voij9fCh7yCQ5Y044XS8ApprHbBsjov9ZcRzeabgx+2deiR5RFjDQfbW4YOhRyp3TstqcI+Hbpte+ aBsidfnrw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNG5p-0000Fz-M7; Tue, 29 Sep 2020 13:54:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNG57-0008QF-Hq for linux-arm-kernel@lists.infradead.org; Tue, 29 Sep 2020 13:54:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4BCA931B; Tue, 29 Sep 2020 06:54:11 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.51.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 055C73F6CF; Tue, 29 Sep 2020 06:54:03 -0700 (PDT) Date: Tue, 29 Sep 2020 14:53:55 +0100 From: Mark Rutland To: Marco Elver Subject: Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64 Message-ID: <20200929135355.GA53442@C02TD0UTHF1T.local> References: <20200921132611.1700350-1-elver@google.com> <20200921132611.1700350-4-elver@google.com> <20200921143059.GO2139@willie-the-truck> <20200921174357.GB3141@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200929_095413_714357_4AEB4FE6 X-CRM114-Status: GOOD ( 28.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hillf Danton , "open list:DOCUMENTATION" , Peter Zijlstra , Catalin Marinas , Dave Hansen , Linux Memory Management List , Eric Dumazet , Alexander Potapenko , "H. Peter Anvin" , Christoph Lameter , Will Deacon , SeongJae Park , Jonathan Corbet , the arch/x86 maintainers , kasan-dev , Ingo Molnar , Vlastimil Babka , David Rientjes , Andrey Ryabinin , Kees Cook , "Paul E. McKenney" , Jann Horn , Andrey Konovalov , Borislav Petkov , Andy Lutomirski , Jonathan Cameron , Thomas Gleixner , Andrew Morton , Dmitriy Vyukov , Linux ARM , Greg Kroah-Hartman , LKML , Pekka Enberg , Joonsoo Kim Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 22, 2020 at 11:56:26AM +0200, Marco Elver wrote: > On Mon, 21 Sep 2020 at 19:44, Will Deacon wrote: > [...] > > > > > > 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? > > On x86 we just do `char __kfence_pool[KFENCE_POOL_SIZE] ...;` to > statically allocate the pool. On arm64 this doesn't seem to work > because static memory doesn't have struct pages? Are you using virt_to_page() directly on that statically-allocated __kfence_pool? If so you'll need to use lm_alias() if so, as is done in mm/kasan/init.c. Anything statically allocated is part of the kernel image address range rather than the linear/direct map, and doesn't have a valid virt addr, but its linear map alias does. If you enable CONFIG_DEBUG_VIRTUAL you should get warnings if missing lm_alias() calls. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel