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 2C797C636CC for ; Tue, 7 Feb 2023 07:48:29 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mN99nyYIS5OqKz3l5SxRMqt3cpoGkj7noSPk85QtLjc=; b=O7OTseqmfhHUtc Sd9NBCwnm9a5QtdcQE+2xLqpXOIYLFNUxo0OmTqrx7wfiZ/X+9MzhS4Of9woy/Y0koXlDX4oivkri P+Ohsmhu62mVNqQqnIibKRvS4UX+MMv9v2q6sFtPeMkTOsw4z/xwBn69ZvaH5ZXkhtWRUYGWKbI3b qTjtFDhkOwMyNeay/eYMKsIku4N+mgkczTbbZf7sdoTV7X9+tHL5xcGVWGcbWn/zyvNszle69U6el 9xXH50fXH0wP9Te8gHwQvKNmyw4GhZ20Lxm5yxHN3eUvBsavCSvWq7P+rz/Z0v/thsCfEXkz5jOuV 1+c6j7KSqfZRPntIXhBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPIhS-00BBZH-0N; Tue, 07 Feb 2023 07:47:34 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPIhO-00BBY1-Eg for linux-arm-kernel@lists.infradead.org; Tue, 07 Feb 2023 07:47:32 +0000 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3173YmES014496; Tue, 7 Feb 2023 07:47:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=EYUpD8whztRckyo1lnwhFA8kSmv/eApNF41am7OTSeQ=; b=DI2/guM5gqe9QSwiQt8pR0b11hdOe9E/zaPRaWp9fW0aM9IpAlrf6UJEoaHelpIdcqiP C2U0zArcvqGF2BoMr8C0voZ56sZt1nGonbGmNR9NjX9YKb/ywcIKKvPc3F8qLKsz/ic/ BmmDvj9sfF/078r96QE7PJHWWtsvV6XpIft2vjZIRLlG41j4SLNGzcvE+k6/x6d2jsYR Zm4PWv3NH+7oMcxdTYEFEGBt03JwOMNom0h4/5CJ906P9CnlAfJZTWpv4Ea4mllqaQR4 w3X7Crl6YUEsmdHcZxbGzad0KtybVADfvehip1SZWkiHDe1a70fwQzXNAQcJhhfK0ESn hQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3nkdun8mev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Feb 2023 07:47:17 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3177lGmG027950 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 Feb 2023 07:47:16 GMT Received: from [10.239.132.245] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 6 Feb 2023 23:47:14 -0800 Message-ID: Date: Tue, 7 Feb 2023 15:46:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] mm: kfence: export kfence_enabled as global variables To: Marco Elver CC: , , , , , , Mark Rutland References: <1675750519-1064-1-git-send-email-quic_zhenhuah@quicinc.com> Content-Language: en-US From: Zhenhua Huang In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: o3d2D_2aJR2bnWI81joV-PU2NrwfB2iY X-Proofpoint-ORIG-GUID: o3d2D_2aJR2bnWI81joV-PU2NrwfB2iY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-07_01,2023-02-06_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 clxscore=1011 malwarescore=0 spamscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302070070 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230206_234730_627168_CFE51CFF X-CRM114-Status: GOOD ( 20.34 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Thanks Marco! On 2023/2/7 15:19, Marco Elver wrote: > 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 Yeah, got it. Thanks for catching it. > > What is the problem you have encountered? Is the page-granular direct > map causing issues? We're working on a low memory target, page-granular mapping costed more (2M per 1GB) memory. Due to GKI constraints, it is not easy to disable CONFIG_KFENCE. So my intention was to move the judgement to runtime configurable w/ CONFIG_KFENCE on... Do you have any further suggestion/proposal on this? Many Thanks! Thanks, Zhenhua _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel