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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6154BC636CD for ; Tue, 7 Feb 2023 07:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc: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=NHQRv3l+nHZyF8wI0pPtBbBzl9vkOTXJuxCZyTEMLx0=; b=hgue+YftcVdVDw n+GtTNU0AdNpmPZw7Bghny1rf9S6IVljibpsL/VKtISunFLg9EpkiCVm5dh/x01NjWQO0Guwh3iPd ShDG1d/nZQnRcvmOS3mpQbteNL9qVgCqT6D6CwhCQ80dFApfGYYOTWoLH8uME/o71R9UjisAGg9Ye ToGqGY9PndSvpyZeeQKlMdrI2bYUnflPhH12+cOtbTK1TZHaOnOuWNrOMz7W+iDB+fp5WWeg8ZYsw qtEoH3Jf9RyaoP/x+gqGwusxw49S7bQ39mo1IJZIoDcBY2fp1vsVa+vtKDZVucUW7JPc0EynLLP0L Bqn7fr/LBcSRopIgzm5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPIGa-00B7Oa-EQ; Tue, 07 Feb 2023 07:19:48 +0000 Received: from mail-yb1-xb2c.google.com ([2607:f8b0:4864:20::b2c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPIGW-00B7Nc-Sv for linux-arm-kernel@lists.infradead.org; Tue, 07 Feb 2023 07:19:46 +0000 Received: by mail-yb1-xb2c.google.com with SMTP id q4so12739726ybu.7 for ; Mon, 06 Feb 2023 23:19:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ueoMYWHNexs8Bn47VfEAvarp4ov+LToeZoe+JWZD4wU=; b=H4AOtz++XbJhmrfoLocoLUGvpZ+kEOS18Wvc1HvVvzeCdfg6sbR5968ZZLU1WDrnhh U3535QcYnyxXbIwaNa8AHa8QU9+NRAI7yfZGOTrwgJeYrpQDn1WTWaStHGENwhWYJHaB jrCf+bYUhTGy26aNQpmp7KMYwJ2qLStC4EKpeWxwUCT+qRwPw2GxejaEUvRnNXbTb940 3NRXk6BjB5T384tduZ5A7DhKdQtDSJT8UeWea3sSQVxJNsmpdA6TzjWkAmyXKdupsHhd h7n5XHUWb49GNnFylER6V122DlJvWj34Lc/GR9/ZC8Pf0DGsUE35DE9TIW19xwFpjnSK inIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ueoMYWHNexs8Bn47VfEAvarp4ov+LToeZoe+JWZD4wU=; b=6g5ouFhzgrW/eo0nk3Y1x0hSMbORWQgJEewX47lnkRKSmExYzPCHpNjTV9bbwwh2f5 TlJd2LJHWClWjcRYXhO/f+ZSMMWDdrbdulmDrghSWC9RF+H2FaUM7H0LWV292F2WuEV4 M42+xNrCMlcGwwYQoZoMrwv6RtmBQ6oVPkYfsbPej7jl1YPYlNEnWZ/Ex0njBrtGpqFS Hgl2o9L7lPKJ67C5PMtMizRTP+k/9CmwmXKF9XsVvIQykPiwkX/kjNrcL9wiX1Oilenj n6vajmJv0+xKosnUy53m3IATd7Fww+g+ADD0SUQJh5p3ofPX3VzUZIkr/kLhbjoadOhX xcBA== X-Gm-Message-State: AO0yUKUU90fnbq22c56CF9qNOzBhLHszA/qCxeeEdpLnWzyV6X9s+E7B oc5E4j7LBncpIZs5Vk10Fe/Sn2AVpQKdoPI7KWRVAA== X-Google-Smtp-Source: AK7set8nNNsgK2WqDHhR50/sZQYdk//2ogUIjNxOJn4n7uTPa9bCpioB6aSvfntehe1np3RbVQgWGBcB3hyuJeV/5R8= X-Received: by 2002:a05:6902:6:b0:82b:1e20:3ae6 with SMTP id l6-20020a056902000600b0082b1e203ae6mr65490ybh.364.1675754377443; Mon, 06 Feb 2023 23:19:37 -0800 (PST) MIME-Version: 1.0 References: <1675750519-1064-1-git-send-email-quic_zhenhuah@quicinc.com> In-Reply-To: <1675750519-1064-1-git-send-email-quic_zhenhuah@quicinc.com> From: Marco Elver Date: Tue, 7 Feb 2023 08:19:00 +0100 Message-ID: Subject: Re: [PATCH] mm: kfence: export kfence_enabled as global variables To: Zhenhua Huang Cc: catalin.marinas@arm.com, will@kernel.org, glider@google.com, akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, Mark Rutland X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230206_231944_988266_964131FF X-CRM114-Status: GOOD ( 17.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, 7 Feb 2023 at 07:15, Zhenhua Huang wrote: > > Export the variable to ease the judgement of whether kfence enabled > at runtime. It should be more precise than through kernel config > "CONFIG_KFENCE". > > For example We can disable kfence at runtime using bootargs > "kfence.sample_interval=0" but CONFIG_KFENCE enabled. > It was false positive. > > Signed-off-by: Zhenhua Huang > --- > arch/arm64/mm/pageattr.c | 3 ++- > include/linux/kfence.h | 2 ++ > mm/kfence/core.c | 2 +- > 3 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c > index 79dd201..208d780 100644 > --- a/arch/arm64/mm/pageattr.c > +++ b/arch/arm64/mm/pageattr.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -27,7 +28,7 @@ bool can_set_direct_map(void) > * protect/unprotect single pages. > */ > return (rodata_enabled && rodata_full) || debug_pagealloc_enabled() || > - IS_ENABLED(CONFIG_KFENCE); > + kfence_enabled; Unfortunately this won't work, because it's possible to enable KFENCE after the kernel has booted with e.g.: echo 100 > /sys/module/kfence/parameters/sample_interval What is the problem you have encountered? Is the page-granular direct map causing issues? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel