From patchwork Fri Jun 21 11:35:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13707425 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 5F07DC27C4F for ; Fri, 21 Jun 2024 11:52:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF4ED8D0167; Fri, 21 Jun 2024 07:52:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A7CF08D0164; Fri, 21 Jun 2024 07:52:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A7DF8D0167; Fri, 21 Jun 2024 07:52:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 630268D0164 for ; Fri, 21 Jun 2024 07:52:13 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DEB4B140C46 for ; Fri, 21 Jun 2024 11:52:12 +0000 (UTC) X-FDA: 82254732504.11.BE4D952 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf18.hostedemail.com (Postfix) with ESMTP id 2ACED1C0003 for ; Fri, 21 Jun 2024 11:52:08 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=WVsuBQc0; spf=pass (imf18.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718970715; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MbSV/0QgndyxPpucafkqjoUk93XB7CWZmEyrMAmxEI4=; b=1Ax3vgi7u2TbkIb8N8tdaTY74oAIPupAXfgRJIl46bPa9e/5zMKcITZRnPlhlYelpr5O6R AG8NzrSrY+LSav3doU+9otOMXoQm/ZuTXIPU8B3BzO+JYXhona6MjGWqUDek4wkDbklBmY 89a7jRI4JgEfv1IgPhDZSzqItYaqBoY= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=WVsuBQc0; spf=pass (imf18.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718970715; a=rsa-sha256; cv=none; b=TNSNIYrj0QbCAyHR6dLEY+gxEAr5mMDRn2AqiB7I9613d+P6mnKUqdVTonQ3Kr24JdoVtU N0B83j1W5vL71Os6NyAPX0nS0sAVtsb/19nGMnMZCo/yONnq0LpHW1B8Gpupc5ysgZ9q5n IRt/gS41vFQIilL/l3FJAQzpjpfPdWM= Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45LBQuHD001093; Fri, 21 Jun 2024 11:37:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=MbSV/0QgndyxP pucafkqjoUk93XB7CWZmEyrMAmxEI4=; b=WVsuBQc056gBtU5qG4HrH2NNNlJUw 7Sr84S5rrk7rEEOfI8//Xw4Ct6YIlaW8FoEJWT6o1jfD6FGf55QjK++BWrXlPezA F1CRnI2JamA8da+d1pq0kb1P91Ond+QCZyub6XUEIO/Dz53dRzsnIum6yxaXqEqo K8+UsK5Jqv+7H+Uibn8v0Qlhg4wJKGbCm58gxyWYwOCRIwvoyCJA4I4tsSlQmP6I E1CtPGzLVMpfXgbmiMyEuC0TwiHzn48bZYddiSFTBrMBJRhK3fJ/pvQgFyh/Efxk mYYtlIibIC5v4/m5ZGk751f+I9Vt36bwbgXNYNVqs2gHOaY7RQwBLiZqw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yw5krgf28-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 11:37:26 +0000 (GMT) Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45LBbPwi016947; Fri, 21 Jun 2024 11:37:26 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yw5krgf25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 11:37:25 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45L9Ijck007683; Fri, 21 Jun 2024 11:37:25 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspeupy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 11:37:25 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45LBbJgX45613486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 11:37:21 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B39D2004E; Fri, 21 Jun 2024 11:37:19 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 021142005A; Fri, 21 Jun 2024 11:37:19 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 11:37:18 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v7 17/38] mm: slub: Let KMSAN access metadata Date: Fri, 21 Jun 2024 13:35:01 +0200 Message-ID: <20240621113706.315500-18-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621113706.315500-1-iii@linux.ibm.com> References: <20240621113706.315500-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VRoYVuf6wSjVVShG8oiBisGc_65CLQLh X-Proofpoint-ORIG-GUID: -PKd_YmlYz_4O4aDzcsYfKbEiXGbUZuR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-21_04,2024-06-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 adultscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210084 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2ACED1C0003 X-Stat-Signature: 13hu9qzecm89eyjmkprnngxixiquzru1 X-Rspam-User: X-HE-Tag: 1718970728-157311 X-HE-Meta: U2FsdGVkX1+pPYTMSlt2MJ7s9HfxadiVeUC8zB3Tfpfr+MVlxg/SXlDWpMId05BprGpS7gTXBq8sCpGOvdLpZnR4WUCXPFVepQ0Y6N6+Ha267lnbX+4ItS8xugN0uHGB2I+6PeQmpARyIO1qEpzW2WhGAelkHiEylV3FS4jUhUfEr5Wq91U43dUC2RVJ5blOZB4Yw0TZm31ji82WGIuyfd8hHUYtliGm5FhdPMh7W9YfdnVwUZg8BRNdzEGP3LxgUOFLxqXZksWa4NSE9g62c5pf52rPT2D/zbyzg9021FQC/TLd79yNDQ+uaDATxmSmqcbXErdwlKVpO1OsBoNM0L4XSofaiUW7KYIuRd/IqRgzUxP3XaCR5neR4KFh787TFHM9Ki0G6Xv40VrSzi//YmVMkj4MGxyWWZVOjT8EdFhk8EKLp+R9QgxzBRm1Xa+umSH2s7FD/5ayKkw7oFZPf0hBJPCmGkOApM16qPOEezbozPvvJLq1WsntLz5e0d+Eb9nsqrUAj+9iYxIUtTXspu153R/RNKE/y+VwH6BM3JggYQI9pVVauGP/Or7/bURwAe+R7gl1bVha6qEV0vKfW9f3orUqjPUOSOKHFWmxsI+ZQ67AB9rM27Wabbo+iZWojiME3BGaDFEKKHchCXapWRv5VU0Hmwncj0zgit5yY0StNUQOYnsDgGoAVe1JgYp91ZjJgmktlog1viG9YjpANeKFxVSgqr9LRmxAbgYXTGVYRdi3jn8dTPynAii5kFxenyc/8Jh+C7K/Io18Yc9rSksRKmcToxhXhesb3F544QSHrZI6NIPnNgTBCPpwR7k5injUAWvx9R9eXkmR7FulspLucMPTncvDo9ga1sD0y6GvgLESBUcU6NrNnIyKv6FDqBnarhf+gOZavzb1cNczZkBJ5/b3wn546eaIvEiHad4/nOyubaT+sNotPM9TJOEOSMiW3Hc9HDuJkLAjBoz Qtg9IR3K y7pz3kbl7tG5kh7PS2EKpaeCSJ2YEPDY0yBDGqMjadZqrY4TWu3qJKjY17MuiryU0b2psltYIuYkkYqD317eOkkpPn/UT4fpTXWFayIryqcKYH9YN4vGKgBVEV1IjhNZoeZAqFI405RyTtz7JNNmCc6kbi1X8Pmb+uHU7SARiVW0u4DS4HJHriS3Kyq1Fo+7EWEmkR3+07/xzEFDvCV6vwt5mZ1xXUhEeOk659y0NFfdcGVUPDo55eftkirB8VNMh7++Pju+oJurJ9qzZiQ1qBYaIGmo5uJVWUZQk6gq0b0bU8C/QS/RGeyZ4ZHh/Qs1DMARC73KHOfYi3mLnvF7EexTxyTEe4EOK6MXvqUwUFjqwlBA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Building the kernel with CONFIG_SLUB_DEBUG and CONFIG_KMSAN causes KMSAN to complain about touching redzones in kfree(). Fix by extending the existing KASAN-related metadata_access_enable() and metadata_access_disable() functions to KMSAN. Acked-by: Vlastimil Babka Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 1134091abac5..b050e528112c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -829,10 +829,12 @@ static int disable_higher_order_debug; static inline void metadata_access_enable(void) { kasan_disable_current(); + kmsan_disable_current(); } static inline void metadata_access_disable(void) { + kmsan_enable_current(); kasan_enable_current(); }