From patchwork Sun Aug 14 19:53:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imran Khan X-Patchwork-Id: 12942956 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DD2DC25B06 for ; Sun, 14 Aug 2022 19:54:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BDAC8D0001; Sun, 14 Aug 2022 15:54:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56E3D6B0074; Sun, 14 Aug 2022 15:54:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E62D8D0001; Sun, 14 Aug 2022 15:54:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2F8E46B0073 for ; Sun, 14 Aug 2022 15:54:26 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 02F1240402 for ; Sun, 14 Aug 2022 19:54:25 +0000 (UTC) X-FDA: 79799250132.01.4C9A696 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf12.hostedemail.com (Postfix) with ESMTP id 3C0B6401AC for ; Sun, 14 Aug 2022 19:54:25 +0000 (UTC) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27EF4oEA011333; Sun, 14 Aug 2022 19:54:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=xeya5/x+Z10Ozwztf8nL3qkoaLyRvyZcn39ef3RS3zw=; b=vSXjEE84sHhji68dYm4RbogX2DCUWOR6vMwty051DWKbYqB5fOMPh7idTkkxMJk2e3ag QxAYderYQ9oMcb+SzIE+x9PVX6p/hUCUvclf1lW392t47zAGcK9JNc/+nSXs+afKDyMl 991J6FHoTBIZYCtmXMvi/kkSa6sBGPG/nAiqdSbnAvO+O76ABbdVEoQAMG0F9tgFQcct S0pBqjcLSrwqplpuEcZYwVoTB/JSjTeYPKWV5YwZiCvic+wNaor9JZAy46YkrwjgFkqN NsAdwzVlIgia8B4V+X+w905n1MjvtpP0+abJElPRgmBu+1+4AndaPo41Ie/CxxS7ikZV Yg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3hx2j0hrru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Aug 2022 19:54:12 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27EHrjdM032436; Sun, 14 Aug 2022 19:54:11 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3hx2d7ddbw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Aug 2022 19:54:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HgbLCmBiYyztlbXLDxzD7+W35Itnr2BhyM0wXDLShGqxivxOoQ6EcBSFe0zRll2703WzECMsuHnReZJSdYkJXcm1h28hqh2rpVFgLd2iUEPlXFBeWDW7BxmosrOhD8ZShRhwbYADXwEaT03kTEfj854OU3XhAPuyXz9C0j6xOl28c5yETcn8V0qOROaIV1XWdAHgS+OQkuTsO/yGokKb7fFbcQTO9/E8k2BoPxkY8vhYT6F45u2FvYSkqfJ81hHRjud4WCMjdBOtozCR2tna+FHiajvDuhDeWZZpbmeRqDTwgRsttIgZWhUWH9KceWZtnOVZA5kOuUFsJxCoqaTu4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xeya5/x+Z10Ozwztf8nL3qkoaLyRvyZcn39ef3RS3zw=; b=Oc4oBPjoJUQtZ4jPOtWZ/6eR0xzrMSj2WNDK05DmZ2eZQe7UxKCySNpRYHLsAFJpghPCdCGe6Oel6O4+8pk4tDoZTgLuNXlXZDWoUQYlXQvvlB0uKdW9NkwNbOQFPE6Dba4OWmgcDiZozF9e129CNgVd0Ljgl6r8w8O3oG40MjR+ejCrI8Aiow/i+YkZiKuBWGMQsjYoHhBBJxedFaJKaHGN7/whad5XeRm4saa4wKpSYEP7JEkJYoZGnwAgQsacI/dWKKDgbgHl7dapulcFdC3us7Z3usX8h5/tJUp9Qed5Y2ca9PDIJEvx5vzBAWk8eS7Yp+4a+y9v+57BrdUzGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xeya5/x+Z10Ozwztf8nL3qkoaLyRvyZcn39ef3RS3zw=; b=nFbSvFVCQlEQDpKLcadbODnPyH7Mx4ioXlfDfCc5iyQUFb5aH5CEcyNLW0sqEZDUzPb1+UPV+wo21fv7y8X5RDIspOmm7N4RmwLbLztuOON9aCN7xxoT8ruNA3I8gAFNa6UCb1J6F5FXTSxi8CHQBH09Axdjk1Cl91+b/bmaxjA= Received: from CO1PR10MB4468.namprd10.prod.outlook.com (2603:10b6:303:6c::24) by MW4PR10MB5776.namprd10.prod.outlook.com (2603:10b6:303:180::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.27; Sun, 14 Aug 2022 19:54:08 +0000 Received: from CO1PR10MB4468.namprd10.prod.outlook.com ([fe80::c504:bfd6:7940:544f]) by CO1PR10MB4468.namprd10.prod.outlook.com ([fe80::c504:bfd6:7940:544f%5]) with mapi id 15.20.5525.011; Sun, 14 Aug 2022 19:54:08 +0000 From: Imran Khan To: vbabka@suse.cz, glider@google.com, dvyukov@google.com, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com Cc: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org Subject: [PATCH v3] kfence: add sysfs interface to disable kfence for selected slabs. Date: Mon, 15 Aug 2022 05:53:53 +1000 Message-Id: <20220814195353.2540848-1-imran.f.khan@oracle.com> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: SYBPR01CA0197.ausprd01.prod.outlook.com (2603:10c6:10:16::17) To CO1PR10MB4468.namprd10.prod.outlook.com (2603:10b6:303:6c::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 313b98ef-b83c-4776-df16-08da7e2ec03c X-MS-TrafficTypeDiagnostic: MW4PR10MB5776:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R5vu+gsXuf3KzkooXVOt6VpDSw75TVP0boDFkaDU8YDqM/C40zlX4bUraNh12EHl87KIR92o+7mcyDIBwWEpzADu+Vikwg+qtq2ZFkBBq2cKxBbHWvVoXdPhRVpBt8u5VMmvyUp+OezF1/r7xfCgh1tKL5w7MOsShQyPbWf0H3qqQZkP76S8hEIPItpSWQSIFjOFw/pSTmp8VkIYn4YNR5acLk9MUiNSDJ2t+Hm+d0LSkNmEb8qOkaqnBQ0B6RqQu/0npf9ymA56gN2PEgegXvG4ot/duSM/Pc7y2qutdArRUiOAiZDv5CY4j0e0VD7ZPFnbRTfwfb6FHnlg2lkjoqLVWWdIsgPoYtlLb0NaM/MtgPzVFexrD6r0h3+5ou+HmxOQA9Cy4ZaFcNYuuW/unxfXJ8K3g4Ai+itnR8JHaEebGtc33zkthwavYulucvfY0b8vEV53wviYKLPOysS0s4isxw4Ue0qn2Nfn5uq1Y9xAWdGz3/S1YWcW6INOrvSbgBiGSQB+AENJoikxiD55U4wMWwlVyXh02c+nDgv+DJbczfeBtQEyO9XWMv3WdUpcMB6+i640IUi3GqThcTbxK3zYJF7Zdf4XSkadUhZWQ+jxVNwQhyv+5C151j8fhzICK5TayOJ6l6Vdc34Ju6076R7FiETEcZT0S0QsRyWIeHEQEQjllfhbQZPv80Bs+3lRa0PbOXfdGMcFalhIbQ443bhfDxzxqlVqj2FViQGf67Bf5ttbWXtkehZPO+txlRJIp/S42F/awOrErbemQnsXHuH2+umFwYMBs2R1yPsy6DhNeXI+lYqyVEg2Ff2Q++HQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR10MB4468.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(366004)(136003)(346002)(39860400002)(396003)(8936002)(5660300002)(36756003)(921005)(7416002)(478600001)(86362001)(2906002)(2616005)(186003)(1076003)(41300700001)(38100700002)(83380400001)(4326008)(66946007)(66556008)(66476007)(8676002)(38350700002)(103116003)(52116002)(6506007)(6512007)(26005)(6666004)(316002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PsdWyoU6G39ncDI55mnE4AXjvVosHaqdeoIZz8U/pAp/XBPYSmxdcMiHCiCOB963/nz1o2J4PhK2w9vOFutyu/CAa+ky3YyS7JADdtdPBFWohj8DvWFxcx/sKb1E5YCRzDV2myLU7C36zU0CKzwqrpSP/X1A7Ihe32FmEhZuPGCn271DW7IZt8NitM0eQ9BPjrcv9VNgXt9YPbVd9WG5bHuarBgozOlzfvpVtZjayHZVEpMTxhXjRaWbCILYMoKs4c6UETaCYGbe1zscDf8gG4OenmPygZMIg/StjU33YSodFEkfeSRQk21HDhsDzqevnCwyjuf8mqkXNnOAOoMBAvMSKfW+Q1X1QSlnhRifYHyS3Age0JxhrW/08R8jmss7hLnK5FbD1Z5jcUhQd7H3ZesxYlLyi6rheqOqKxZWJNLjDOja0K2OKKH34Y1RWvt7YJ5QnAbomrNHAFjAYcZuZv8+2hjVFagzPtYW2pcKGRQaD5Esgh40XcRbuW6kzHobEvQ32oOoJQ81hA5H+Z6pUQH6zrzxnuHY+puEMYLUm6mtk50+0Zr52T1kyDxhZQkFFAEHF8BLL40lf9/AOQl2h/jPirGZlJgANrudTiLt6pvHn7nqgET6Zr7LTfEIZD78vzUnQUtGtqNTgLXTYYfmXmNi7SNn8Mrkf3yarH6yTHNNIE3Xa4+82EF8Z8lKjTPof/2WDCBTqHaMHKhzARq1yOZGPtkIT0ldRmY6PedH3sWewuY8h00lUgzL+H9eNVoljfYkjc3+hSEqYCZd6umZuRkILzggMuFUupdObOCqZvnm6oWIXXHBGJErmCUF+gOB3GZycTWsdLRq5g3AbuVWjwdZO768Qwrl2zVvSDbXFkqEVIfnc7ItHi8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FiPHZRCeyu87b2pPpwxVCjJ9GnxloBnLQVStQFhm/p74oU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 313b98ef-b83c-4776-df16-08da7e2ec03c X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4468.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2022 19:54:08.6407 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e5FrUsjP9xvvL1PPgBQIF4JJbWglHffsVMwV99VMTIgj2LKmLuhHdENnTfLJH5N+A5PICkcTGfeayaL7sLFQeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5776 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-14_11,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208140087 X-Proofpoint-ORIG-GUID: CHPEKjzzD89qmaZ-dBHTaHf-NIaRyRSL X-Proofpoint-GUID: CHPEKjzzD89qmaZ-dBHTaHf-NIaRyRSL ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=vSXjEE84; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=nFbSvFVC; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of imran.f.khan@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=imran.f.khan@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1660506865; a=rsa-sha256; cv=pass; b=hxNyLovle1Y5e13QhO69KUDHNVGAnnDZ+tRjNuZbiUJ1EvZdKtS1QEXhDX59+bPNhwnJLY hOSvELKZvEx6dk3GOU5PwxtFf37vLPkuXPMT+WU24RxmoQwl8v3dm+pyxa4jofP7enegGf VuyRIBQR2lo+cGTt0AZ4PFGzHQ7//1Y= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660506865; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=xeya5/x+Z10Ozwztf8nL3qkoaLyRvyZcn39ef3RS3zw=; b=pcu5AugjmiDy+sxMDaPLY5RFrZlaBOmNQwPEc/dcDFzJ4qfmsGvAyzpvcFmeXpjrM1z4q5 bs/W73uaSf9Pt54MB5+xnjx4y7as/ncVoIuveOQmbXhlWf4nDcMH8yGY1yqEWv4lXyNeVP 5vmeln0wSL4WgeKFV1UeCsxZbdYW0Ro= Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=vSXjEE84; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=nFbSvFVC; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of imran.f.khan@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=imran.f.khan@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3C0B6401AC X-Stat-Signature: idto5rua9d15nkttf8xbpp9bb8wdecas X-Rspam-User: X-HE-Tag: 1660506865-953077 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: By default kfence allocation can happen for any slab object, whose size is up to PAGE_SIZE, as long as that allocation is the first allocation after expiration of kfence sample interval. But in certain debugging scenarios we may be interested in debugging corruptions involving some specific slub objects like dentry or ext4_* etc. In such cases limiting kfence for allocations involving only specific slub objects will increase the probablity of catching the issue since kfence pool will not be consumed by other slab objects. This patch introduces a sysfs interface '/sys/kernel/slab//skip_kfence' to disable kfence for specific slabs. Having the interface work in this way does not impact current/default behavior of kfence and allows us to use kfence for specific slabs (when needed) as well. The decision to skip/use kfence is taken depending on whether kmem_cache.flags has (newly introduced) SLAB_SKIP_KFENCE flag set or not. Reviewed-by: Vlastimil Babka Reviewed-by: Marco Elver Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Imran Khan --- Changes since v2: - Change patch title from "Introduce sysfs interface to disable kfence for selected slabs" to "kfence: add sysfs interface to disable kfence for selected slabs" (Suggested by Marco) - Addressed formatting suggestions from Vlastimil and Marco - Added "Reviewed by" tags from Marco, Vlastimil and Hyeonggon Changes since v1: - Remove RFC tag include/linux/slab.h | 6 ++++++ mm/kfence/core.c | 7 +++++++ mm/slub.c | 26 ++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) base-commit: 7bb4fa8a025a1bd305a146022083f0287653ea12 diff --git a/include/linux/slab.h b/include/linux/slab.h index 0fefdf528e0d..352e3f082acc 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -119,6 +119,12 @@ */ #define SLAB_NO_USER_FLAGS ((slab_flags_t __force)0x10000000U) +#ifdef CONFIG_KFENCE +#define SLAB_SKIP_KFENCE ((slab_flags_t __force)0x20000000U) +#else +#define SLAB_SKIP_KFENCE 0 +#endif + /* The following flags affect the page allocator grouping pages by mobility */ /* Objects are reclaimable */ #define SLAB_RECLAIM_ACCOUNT ((slab_flags_t __force)0x00020000U) diff --git a/mm/kfence/core.c b/mm/kfence/core.c index c252081b11df..8c08ae2101d7 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -1003,6 +1003,13 @@ void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags) return NULL; } + /* + * Skip allocations for this slab, if KFENCE has been disabled for + * this slab. + */ + if (s->flags & SLAB_SKIP_KFENCE) + return NULL; + if (atomic_inc_return(&kfence_allocation_gate) > 1) return NULL; #ifdef CONFIG_KFENCE_STATIC_KEYS diff --git a/mm/slub.c b/mm/slub.c index 862dbd9af4f5..6953c3367bc2 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5745,6 +5745,29 @@ STAT_ATTR(CPU_PARTIAL_NODE, cpu_partial_node); STAT_ATTR(CPU_PARTIAL_DRAIN, cpu_partial_drain); #endif /* CONFIG_SLUB_STATS */ +#ifdef CONFIG_KFENCE +static ssize_t skip_kfence_show(struct kmem_cache *s, char *buf) +{ + return sysfs_emit(buf, "%d\n", !!(s->flags & SLAB_SKIP_KFENCE)); +} + +static ssize_t skip_kfence_store(struct kmem_cache *s, + const char *buf, size_t length) +{ + int ret = length; + + if (buf[0] == '0') + s->flags &= ~SLAB_SKIP_KFENCE; + else if (buf[0] == '1') + s->flags |= SLAB_SKIP_KFENCE; + else + ret = -EINVAL; + + return ret; +} +SLAB_ATTR(skip_kfence); +#endif + static struct attribute *slab_attrs[] = { &slab_size_attr.attr, &object_size_attr.attr, @@ -5812,6 +5835,9 @@ static struct attribute *slab_attrs[] = { &failslab_attr.attr, #endif &usersize_attr.attr, +#ifdef CONFIG_KFENCE + &skip_kfence_attr.attr, +#endif NULL };