From patchwork Mon Aug 19 06:41:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13767960 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 DDD91C3DA4A for ; Mon, 19 Aug 2024 06:32:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15C3E6B007B; Mon, 19 Aug 2024 02:32:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 10C666B0082; Mon, 19 Aug 2024 02:32:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA0526B0083; Mon, 19 Aug 2024 02:32:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id CCABE6B007B for ; Mon, 19 Aug 2024 02:32:47 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 732121A1035 for ; Mon, 19 Aug 2024 06:32:47 +0000 (UTC) X-FDA: 82468026774.26.DD9F44B Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2088.outbound.protection.outlook.com [40.107.22.88]) by imf12.hostedemail.com (Postfix) with ESMTP id 839A640009 for ; Mon, 19 Aug 2024 06:32:44 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=NXP1.onmicrosoft.com header.s=selector1-NXP1-onmicrosoft-com header.b=HX9ZNnMV; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf12.hostedemail.com: domain of peng.fan@oss.nxp.com designates 40.107.22.88 as permitted sender) smtp.mailfrom=peng.fan@oss.nxp.com; dmarc=pass (policy=none) header.from=nxp.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724049088; 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=Or3kB1tWkVwZQ5GufLHz+QJEZn862jt0O1AwKTJPD1I=; b=3YG8Jss40f9loz9uiZZhEPlrE7qUsmPXGWIvIQnj6Qss4pGFz+Oy10uQXbnaKSF853GI1M AytQUvXt86PvwzWf/LPjVwM+8BmHDzWaTQlTN8xGQWuEn1QGbZa7IITN7Y/5eAqHNgTY64 AnUijuoSpChRNpO6bF+F7Spcd4jwc2A= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724049088; a=rsa-sha256; cv=pass; b=40Qkndyeu1CpLK9i86EzQfkV6QsoHA1hpVpZaxcZHJ7SM7M+r6FpAxOtn2Vsxi3lzSZL9W qHFEQYpzZI4AIHLyXmZbMLW3jWJe7X7rhbAoEngKnw6b08kGTn3z0DSj/pwqVEYr/4MsFH 6JdAY6hMFEVtL+r2rIlfvcy4qebzUiQ= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=NXP1.onmicrosoft.com header.s=selector1-NXP1-onmicrosoft-com header.b=HX9ZNnMV; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf12.hostedemail.com: domain of peng.fan@oss.nxp.com designates 40.107.22.88 as permitted sender) smtp.mailfrom=peng.fan@oss.nxp.com; dmarc=pass (policy=none) header.from=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y9nXUGIP6mcdxtKqSphPiLWCN3htM6ODRZl3EQRnwROY/MxRbKPDHJUpxtfV04NR7JbBtrDbFQt4hq1vHLVP/wJtGxeVy9ZPQ6s8sincv/xGPBAU2zyftMMnb5vN8oSTF4FcDDjWfQM70cgR8LzcCnFLb95fA0PxHywffxO9luHcCsEDd1hCSDuJwJJECJka3s1IOZIlinNK/O8gZoH/U7GcK7Q6MBJ+AaQkQ6qPwcXcmH8li9nc/+xPqUE8uG6AXzuPxeSjJD6bMkkN9WSjVRSYN0H6GElr6CrDUof1nv43Z8HhUeex7S6RIIwr74MuY0rodroTgo5iuJqSoB/Q7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Or3kB1tWkVwZQ5GufLHz+QJEZn862jt0O1AwKTJPD1I=; b=NPFsnMx2e7J/XMX0w5qpDn4taQ1KyKzinBR4x2qZVnqdirS0aG5XrUbzyXRC9hQa2XwMNJTY5Hw0lgQGPD/1/fGSnQIIaRVmV6TbY3Q83M9dWCMtmjjoZSO6DvAhqHrVqUXwTHpVVOkCPfvrqpnQ7RQ3rfP27tfYqDHACtbjLARGg8kqac7W682DjlV4na5bm8hYWKGZwCi7EBaLdxLJw4Gc78B8WETgilg/6aiKaiK9nE5JR8fkQ12oCzY21BUxW//swfqynx1sjLDPX6NCUlci+N93y8wjPHUVhnyrcMj1CSL+T2mOBMOeZgn599o+P/6TvEtcjcuoPo3MTZBUnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Or3kB1tWkVwZQ5GufLHz+QJEZn862jt0O1AwKTJPD1I=; b=HX9ZNnMVUByeFBPa61DQT5fVam6B3QlcQrVhU3LkBKrZMhc5n6W8JvhY02/19i/9kUM+Iu78SKYZjw48LL+6OP0+YH2D5xOcKFJtlBspX2Zz2jhOuxXo1xXt7UmmYtmRPahI4XI7b8ag6FDflGqVzM+G5DeFkbgX6NA+ldy3uS4ajqUTmeloHwhv3aIiJneuRri3f6Rs3/os2GdPQsPt8IFxmQOqkp8U7bDjTm8gNMxu3arGhNegoQ1Vrrazs3V6c7FdlzLVoUk3dvzAW8ciGRYQ95wg81I5bO3xuJvpLqdiDSYf8dCZ9MfGaEGKPVPljw+9ECUOXHUPHL1YPFdpQg== Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by DU2PR04MB9018.eurprd04.prod.outlook.com (2603:10a6:10:2d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 06:32:39 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.7875.019; Mon, 19 Aug 2024 06:32:39 +0000 From: "Peng Fan (OSS)" To: nicolas.bouchinet@clip-os.org, chengming.zhou@linux.dev, vbabka@suse.cz, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Marco Elver , Andrey Konovalov , linux-mm@kvack.org (open list:SLAB ALLOCATOR), linux-kernel@vger.kernel.org (open list) Cc: Peng Fan Subject: [RFC] mm, slub: avoid zeroing kmalloc redzone Date: Mon, 19 Aug 2024 14:41:14 +0800 Message-Id: <20240819064115.385086-1-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 X-ClientProxiedBy: SI2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:195::20) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|DU2PR04MB9018:EE_ X-MS-Office365-Filtering-Correlation-Id: bbaf178b-7633-486b-8557-08dcc018b873 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|52116014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: 6ix1brfipdgJp/qebgx/whsFjvGgu/95QkcOMO1Y+tCL35oDe0jDCfIaJ0ZKGm6lipT0EYsNBZhPIH4hrwgcEhpgiaxGJEWdRJyp9Fr7Za25kCBup82HOPXzigow+bmfdgsDYQp6+7XcNk6d2RIDd6VTolydHmEFH31zI6lsFVlAZTGmCYUc7Rqr/+0X4tIEbLTIbR5ie9y2VHVB1WQfE842DugDn0Wo0eLQeB1IVg/CvV+jqA6vHbEOPTa0qMMauad06O2ybpvFTZxtI6Dm7axiA3SguxBXlZZu4/JRvKH21hZbMFwb1SrAq3etEHdmQa4hrPksa1zncPkIlpHiz1IDdjbqkhhRZkYgXnUUulZjplyWo20JwwIJmM7Q0edOeit5UT7KDRntGC6Yu0QBJl8obGJUlLUyGfxi9gOrkvAjToicv1LSRNQ9GFxX8xX4yKWnUXnFWrHP+g1xEBh/KdkS4JvYoZlFWhjYSSLPeaGjIU+SWq3ckuFnGohj3405TOMx3Pw4f5MU3YMVMQHMV5Vl+9ZM6d+2Cf04UoIfuGxeWHkFg9/hmAupVShYkLO6AdZeNexcR1ePcBO2fALeDrdEH7YL3Ba3zEkAUheIZwYdbh0Tupbwfn6VC811G+s3VhnnYwVtAm05DunUMvjTkI/QGjrFqLP4/56tQdnAzZhhrsZp79fehTSJQ/6tZuNbO+WcXdvSjgYyjM5Ff6fFVzFA7Eo+kLjFqPTuVJVwWWg6FD0gvqTrbg0x67KMsAXWboj1mkmX9VnDJea8mk/5/cLBRtd/xbtahDJUGpFojD16dP4IiIPemVU2dPXfjiNUypVJKw9SoXvxrnASZx1F71uY9I/oaBEGClc84urvYqsWd9wJuYVsuAjkM4xjbhTCVZt/P4TMES32Yj3KXVwCBfT3ZfXRzbawcQRQX8zKJDOjoSwiZpRajYDAe351UlCa9XwYG4HCC7MFcMkc+F81TCdJpvBPG2C63STgrRTpOJhfH5cs++oGDqiwl5tki6LA7CzHg6d2y9/c53pwKR9YLIDtXA9yFGNyuEt+D3pOTdOpP99nyNFw+Kc0iiMVfq6BVBkv9LaM0o0lTM5XKoWQmdRIL27lT9xyYaYgpjSxgNk4Dk6KBn31s+2LYt+pQ1ocH2daplFV1FSHMfiLoj6r+k3cUx5DB1ay5NRMB87DQNaEbWRP4jX73nh3PnTu5c4jR71qQFiSmc7QhS8IMLPU5QqVpZYs9/3MZ66WhoyiDmbRtStvXz3RBQYF1cID+v4Ywbu04yLS2F/HVzFxw1c0LnOpAQjIjgEBAV4Cx3BnmI9edLnNa9tcXu9DkkFbpxAxCCKjiOZ6M+49cNWkkbe1kM75qXaXF85sxCSDUYZUtElc8VokgYRJeJtRhFQKxC5uFuOxhXgEhpStXW/QpZgCdC9E3vjsnUadhtiTF0oDnEQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(7416014)(52116014)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qOmc8I4YfLPPbuDLQB4+eFFf5TdDhz1yKttYh+DlQx19MiMfmbpTSuSnqhNlE7vVtZ8Ga3tFFYd2vdwEV1seuBRqWX6iRpwli87nHOUi+gpHlfjJA14qoGJ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P8wdg8Cv7vmog6ZX3usfO3pfxP9+UXhn3LUv8OutM4HR3Hg3iWQFZg9RWIJeyH6OTVURmIXBudFfDu3h/F5c0cTgDCCxbjlOHbBVwWrhqUwtPsRPsPQJwjRNjpnbiX+5iEkdqlR9QiQRJ4RVl+7hkOgZPuDmqK9koBCIP4/zXc3q76lXBwePxPzmPjEIzu/ym44QGOIIdlR4SBoYf3tiE1+9GP7Zai/WjKALngYk8Rcf0VNTSyycLjpAEswR2NPttNS1hgJgFm4xhNkQGqQbHAgfjloLGIO2784WdIH+Xd0RdkBl4PukL12qdKjG/BgqPwfQCsrwoNHk3FuEo1nfZTIEkSFOWifyUMB9p8SsJvq1PH7CCqfZ8O2Amt6LqT1ekkDpdXZif X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbaf178b-7633-486b-8557-08dcc018b873 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 06:32:38.9516 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bUxGQcwCxjo9l6XqmBtnRJCckEJTGMqHEVht10pViuUyDd1Mgy8KZJYvEugfhZ/j8WO0d2Ft29apL1B5t88mvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9018 X-Rspamd-Queue-Id: 839A640009 X-Stat-Signature: e5fbsbrnme3zfe3pst8hqkak4sxf9n3h X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724049164-18735 X-HE-Meta: U2FsdGVkX18/Xo9pHMhrl2LP8jaTLdC9JRRWhcojrjh93C3NYLYijY5eBQ6EbyQuy4/t74EA/JCjJuqGaISR+x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EGXUNDytf6M9dbsMotVNAWdZU38mK9RR7Y94CH5NOfBKJ8AhdRnveuNMNMc42upTleyeCDywg5TsEORP6oQfXN8Y4rlp3+eMIjS5LqX1T9N2HCrcVZ8P6/g2PP2pifyngi4phIikWfmWmFbbNmE/X7bfPUNQIBhB8g2gQKuqhZpxcFymudw2RUXqRgsai22ThTiEL1XOOzamN0Og/7wxrapCrK3g3I5d8ySkzHDQBREYztsf+/VgmfCndAfVniU6ivKjaPCHszOZ6seLDjOB9M1ht8aI= 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: List-Subscribe: List-Unsubscribe: From: Peng Fan With "slub_debug=FUZ init_on_free=1 loglevel=7" set in bootargs and CONFIG_SLAB_FREELIST_HARDENED is set. There is kernel dump: [ 0.000000] ============================================================================= [ 0.000000] BUG kmalloc-8 (Not tainted): kmalloc Redzone overwritten [ 0.000000] ----------------------------------------------------------------------------- [ 0.000000] [ 0.000000] 0xffff000010032858-0xffff00001003285f @offset=2136. First byte 0x0 instead of 0xcc [ 0.000000] FIX kmalloc-8: Restoring kmalloc Redzone 0xffff000010032858-0xffff00001003285f=0xcc [ 0.000000] Slab 0xfffffdffc0400c80 objects=36 used=23 fp=0xffff000010032a18 flags=0x3fffe0000000200(workingset|node=0|zone=0|lastcpupid=0x1ffff) [ 0.000000] Object 0xffff000010032858 @offset=2136 fp=0xffff0000100328c8 [ 0.000000] [ 0.000000] Redzone ffff000010032850: cc cc cc cc cc cc cc cc ........ [ 0.000000] Object ffff000010032858: cc cc cc cc cc cc cc cc ........ [ 0.000000] Redzone ffff000010032860: cc cc cc cc cc cc cc cc ........ [ 0.000000] Padding ffff0000100328b4: 00 00 00 00 00 00 00 00 00 00 00 00 ............ [ 0.000000] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.11.0-rc3-next-20240814-00004-g61844c55c3f4 #144 [ 0.000000] Hardware name: NXP i.MX95 19X19 board (DT) [ 0.000000] Call trace: [ 0.000000] dump_backtrace+0x90/0xe8 [ 0.000000] show_stack+0x18/0x24 [ 0.000000] dump_stack_lvl+0x74/0x8c [ 0.000000] dump_stack+0x18/0x24 [ 0.000000] print_trailer+0x150/0x218 [ 0.000000] check_object+0xe4/0x454 [ 0.000000] free_to_partial_list+0x2f8/0x5ec It is because the kmalloc redzone area is cleared or orig_size is cleared. When s->object_size is larger than orig_size, just clear the orig_size area. And restore the value of orig_size. Fixes: d57a964e09c2 ("kasan, mm: integrate slab init_on_free with HW_TAGS") Signed-off-by: Peng Fan --- mm/slub.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 94f5a4143825..d03957d15bbf 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2282,14 +2282,22 @@ bool slab_free_hook(struct kmem_cache *s, void *x, bool init, */ if (unlikely(init)) { int rsize; - unsigned int inuse; + unsigned int inuse, orig_size; inuse = get_info_end(s); + orig_size = get_orig_size(s, x); if (!kasan_has_integrated_init()) - memset(kasan_reset_tag(x), 0, s->object_size); + memset(kasan_reset_tag(x), 0, + s->object_size > orig_size ? orig_size : s->object_size); rsize = (s->flags & SLAB_RED_ZONE) ? s->red_left_pad : 0; memset((char *)kasan_reset_tag(x) + inuse, 0, s->size - inuse - rsize); + /* + * Restore orig_size, otherwize kmalloc redzone overwritten + * would be reported + */ + set_orig_size(s, x, orig_size); + } /* KASAN might put x into memory quarantine, delaying its reuse. */ return !kasan_slab_free(s, x, init, still_accessible);