Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3242352pxk; Mon, 21 Sep 2020 08:40:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3xSlV0k1aDnw7v0X/bNiSRFLocr7N0LnfTE8PvcBVUP5BXx30MwlJ/SQZ5G6go771zAgj X-Received: by 2002:aa7:c347:: with SMTP id j7mr240752edr.185.1600702855133; Mon, 21 Sep 2020 08:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600702855; cv=none; d=google.com; s=arc-20160816; b=Fo3MT+w9tb48jgUyKBZWiTgjKP/p4/twn3kjwxWt1LT4HQisxT56PE+/gP7NzFzspo xsQM3LeXshsxibGB7ihbwvMR1mrJmfOUP8eeBiZDcFzCxPTw4oHOAUq6rJWa4c/jKJim ue7WtJyK33LmgpEaqafLpvppkRvIoTt/LlYVREtNuZJZ7WEMvJbdpqdaZ3NPLK+0VPnO SwfJiwjwJo2VxTmYP6h6Y7XcfA2HqNNG3Ix48JEbrvVASB6HWjWKUu7ruQkyy6hvDzn5 P0ixjFypw8Vd2u3OHrLqu3+h581QN1/72lOPLxGJYyTirnL4jZTPp0L+IRfsk+6KMDpa K+hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kVxfXE34UyHx4a9aedDaVHUi6pKMiF4098HvY7EGT4c=; b=BvuxGtB8RTKQE4nBr15YT0JD4ktummsG9kaVtdQgeyJn8YPDaUoQUBcNzEH/6VvtRg W8vtjDsyUKftVBKy1tgpISKQDXfV5Pwn/Osr6qRueyMDLTZTSgwwq+pb2aj3gLDnRXfO 5Qqwq3rP4qQ88pnNfUQazsV+GH9vqyLr1ucA7TjuULe1YiKrUEYHiRK9Qs7Ezo05NHCs Ixy+PRh9yr7hrDxvaU2HTj4DZdzKfCIKBFHX/3fu9hktjj8HXf5IYhYkbaqoHm/W/AZB BmitTP3mFFDafkgM22JmHp20B0xtKiShXs/+zp8dX81N4a9KPdFX63r2zcU7VVF8A5+N WMYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BYc74rVc; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si10044846edv.314.2020.09.21.08.40.31; Mon, 21 Sep 2020 08:40: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=@google.com header.s=20161025 header.b=BYc74rVc; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727684AbgIUPhY (ORCPT + 99 others); Mon, 21 Sep 2020 11:37:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbgIUPhY (ORCPT ); Mon, 21 Sep 2020 11:37:24 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98C4BC0613CF for ; Mon, 21 Sep 2020 08:37:23 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id k18so13210667wmj.5 for ; Mon, 21 Sep 2020 08:37:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kVxfXE34UyHx4a9aedDaVHUi6pKMiF4098HvY7EGT4c=; b=BYc74rVcObsxY5RoY7FBMvjUz7I+HJaB7IhAMx9FrV1rganW2S1g6KUoFgpgpnqRys SMWPacFyEdfqMPAw5HLCbJQmqVoKTUYfmyOBS5OBxGnpGhFWTsvJUDm8nnbfIdQAnRtP aWeprctyWDcO0WTV0CPMaJuFaew74ic3MENre4wcGr/Tr9AA0Es0vAnGTQmPqQQH9S+o +AkdKBo++MoypREVKrTr/WFM2sS3+L4CeJ6HVm2xZY0709ol4d7QVZZEDV8tRX6B77wj ZTn0MrnZ2DI7QIXulRGzqTFj1m6iSSKzHv/qCHZXxt2ZHklgUOXHUQGCBfgHNiYtlCCe vWHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kVxfXE34UyHx4a9aedDaVHUi6pKMiF4098HvY7EGT4c=; b=Gz8l+vKeM3FQWkjApO5wrt/8zkuJwTRKxxOjCfEFfVvSnX5oDfz/WnpPHsIQhWtL2z U25kYnAzsfEwVvh+oQb5TFo47NBb0RyK0m29U+mcKIRvb0XRsVSB3F6QGOg1A7LIQOm0 eUv7qXXmjvH1ciJDLxwcClTJ+pImtGpfoW04HBz1c9TdsL5MSFzKi4Luoy/Xq7FqnHIB e4ol53lilBM/pKGJW6a2zfgXgmVns/HF6kPtwQh0AsiUru8A1NVD1TejmITW5Q+86DS3 zTF6waghumxJdK2nHYoF4AjbVrRoCL57zZA315fj0YheBB74e+dh/rxPwThTa9QfLjFW wilA== X-Gm-Message-State: AOAM531mlenreYRvBX/HxFemNkoMUA8UYo+/zuXSprptKVpzsl4KZzbi XWs+jTldU9w71luhaVmPUEjTxvKDVgQLjl1VnyqRNA== X-Received: by 2002:a7b:c4d3:: with SMTP id g19mr199189wmk.165.1600702641972; Mon, 21 Sep 2020 08:37:21 -0700 (PDT) MIME-Version: 1.0 References: <20200921132611.1700350-1-elver@google.com> <20200921132611.1700350-4-elver@google.com> <20200921143059.GO2139@willie-the-truck> In-Reply-To: From: Alexander Potapenko Date: Mon, 21 Sep 2020 17:37:10 +0200 Message-ID: Subject: Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64 To: Will Deacon 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.