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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 A861AC43468 for ; Mon, 21 Sep 2020 15:37:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 728CB20B1F for ; Mon, 21 Sep 2020 15:37:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BYc74rVc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727742AbgIUPhY (ORCPT ); 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-Google-Smtp-Source: ABdhPJxOztNZkizJnsXhj3wk+nWXFKqGPJsuyIzMb4d7s9SxqbYZ2lfULvl21tc0mzpAWLEjISHQ1AcbURiGb5k8xgg= 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. 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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 53FFCC43465 for ; Mon, 21 Sep 2020 15:37:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DD3AC20B1F for ; Mon, 21 Sep 2020 15:37:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BYc74rVc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD3AC20B1F Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7778E6B00ED; Mon, 21 Sep 2020 11:37:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74CF56B00EE; Mon, 21 Sep 2020 11:37:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 662EC6B00EF; Mon, 21 Sep 2020 11:37:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id 505F16B00ED for ; Mon, 21 Sep 2020 11:37:24 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1123B8249980 for ; Mon, 21 Sep 2020 15:37:24 +0000 (UTC) X-FDA: 77287472808.13.drink72_4502aef27146 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id E41B718140B60 for ; Mon, 21 Sep 2020 15:37:23 +0000 (UTC) X-HE-Tag: drink72_4502aef27146 X-Filterd-Recvd-Size: 5970 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Sep 2020 15:37:23 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id b79so13206521wmb.4 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=n12C0PGSrQStykk9o8ibL/zHiOd9XvtGXJx8YGbEwr0Mbauxel5IEi8TotatA0GwKS BTVVW44jYHM4jw5TRNqBJxbY53feYlSEeuRO++0yHhhSn0fpqDA/p8uJeO6J79FAUbb3 Ok5AtKQPE6UD0Ec1ksR+sA7y1sxB9A1xZ6I/bJo8eMYqnKYmceqQnc/mgkpXGfQrLA/A BWTvW+itD1d8UZ7CNRWOqAhLEoGNr0UN40FbDqPfTTkZ6Y6TBJOrR+DDCxLrssYUFDPs W+zrSQtEopvU1lOuWXMYBucyL115gHA6yK74L5ehjiYanpj2avJH/84rPHN+ddKwcb1z 6tcA== X-Gm-Message-State: AOAM530hD2oU+zUmzAEFEWWEtZaCyM9l8P8iV2NdbFTxRDjRbBT1Cnd+ xBWKbfJMrkRXkVRrklhTQOrBnfo3LM7xeL2KH8UCpA== X-Google-Smtp-Source: ABdhPJxOztNZkizJnsXhj3wk+nWXFKqGPJsuyIzMb4d7s9SxqbYZ2lfULvl21tc0mzpAWLEjISHQ1AcbURiGb5k8xgg= 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" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. 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=-8.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 6D0DCC43465 for ; Mon, 21 Sep 2020 15:38:59 +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 E2A0E20888 for ; Mon, 21 Sep 2020 15:38:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xcQDh6pb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="BYc74rVc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2A0E20888 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rrhLkOT1r96kKf5SUumhq1iseYaWyRMlfd+VYgsw6l8=; b=xcQDh6pbeoi7Hl20ddH5Zagpu 82+4E+vQKJ7hGEmSzEYMcS+zFyiorbreyvzH8GDoedW62QQBytObjDYHVKR9aFFCIch99O+/g9bkC bR+bx0Vqm/HIw9mVfGN46N1O7ZA3fqbgBDAW2LOTy2c9Y92nhOVq55eJgkRgWwFy7vTWVD/zRpZ8e 3eoQfqsu2CXXs8bfeUtB4wxniO5fxGoH5gbEyfFp8d0MkkAlrxsuAeQppRK2px0OmbL0sNsuZq419 PGbrP4xWPQCUZ57HDICG2zh85euGxZtC36LfkSJYSv8yc9CBC2CbmPSH2wSREj8M1l8atk4LaLV8t GBZSp4ihQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKNsc-0000s7-3Y; Mon, 21 Sep 2020 15:37:26 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKNsZ-0000qp-AI for linux-arm-kernel@lists.infradead.org; Mon, 21 Sep 2020 15:37:24 +0000 Received: by mail-wm1-x342.google.com with SMTP id d4so12568113wmd.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=lUywAubJgeJXc8LLf7t/V8rHDzSU1bcwbUjD/9AdY0YlYTLgMG9qn3Qs8Q4dFln2Lb livLOTfIACrmAVhgGkE5hufptXuY8oYp0fgdHIBZa6D+oYukOD2dVKlo8ySZ5ymT8ytS eja5cT/vmUZ1h8xb8Y3WPiJmTCC3uEvDt7u1mucn44ZABNuOXRRwXogqcLP5oYLfruIe E/STVAaszDE9TfUpzlQJezqwFnVfc/FT66TniUVSd1uz9KLQk9GskrYX8a/E5/pV3Sg7 bP2sjkMa9VfVFnfavyNzt8ArQG1I1PM/dRzlK0TJklC5cRiYf0E8xJJ6n+6XB9+aEr9r HHCQ== X-Gm-Message-State: AOAM531E6bISLNrc2SkjhvYLGEI52tr1BlHOx3rN3gzkkOvdZClTkMHt zqzqZgefIrUcuHrH8MjRasikQ9dE2ygYlTsdNY0Ifw== X-Google-Smtp-Source: ABdhPJxOztNZkizJnsXhj3wk+nWXFKqGPJsuyIzMb4d7s9SxqbYZ2lfULvl21tc0mzpAWLEjISHQ1AcbURiGb5k8xgg= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_113723_384189_A99D78D8 X-CRM114-Status: GOOD ( 26.19 ) 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: Mark Rutland , Hillf Danton , "open list:DOCUMENTATION" , Peter Zijlstra , Catalin Marinas , Dave Hansen , Linux Memory Management List , Eric Dumazet , "H. Peter Anvin" , Christoph Lameter , sjpark@amazon.com, Jonathan Corbet , the arch/x86 maintainers , kasan-dev , Ingo Molnar , Vlastimil Babka , David Rientjes , Andrey Ryabinin , Marco Elver , Kees Cook , "Paul E. McKenney" , Jann Horn , Andrey Konovalov , Borislav Petkov , Andy Lutomirski , Jonathan.Cameron@huawei.com, Thomas Gleixner , Joonsoo Kim , Dmitriy Vyukov , Linux ARM , Greg Kroah-Hartman , LKML , Pekka Enberg , Andrew Morton 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 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel