From patchwork Fri Jun 21 00:24:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706573 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 477F5C2BA18 for ; Fri, 21 Jun 2024 00:27:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1F0E6B0163; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A797D6B0166; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8581E6B016A; Thu, 20 Jun 2024 20:26:57 -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 5F6D46B0163 for ; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 18C341206D8 for ; Fri, 21 Jun 2024 00:26:57 +0000 (UTC) X-FDA: 82253005674.26.6621C41 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf24.hostedemail.com (Postfix) with ESMTP id CAF9118000D for ; Fri, 21 Jun 2024 00:26:54 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=foNfqk7y; spf=pass (imf24.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 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=1718929610; 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=6nN6YxklHH7tg3tAizhIHL1j8bqdZ6Ivvye1GZLP5b8yxZHnq//bXrIAllA3r8Hvpu4BM6 eehkRErKM1/h/jVIDqj81oTX82sOsiW+FihUIc6mlUjfdwsJ8OjvHAK/dTwegEaRsd9Oc7 pL9bPiF44JnE1ZUjOF1nfBC7jFPZoa0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=foNfqk7y; spf=pass (imf24.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 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=1718929610; a=rsa-sha256; cv=none; b=qbE5nlMIIbt9yFOCXOLwnBbvZb9IZzIib/zmagKhP/iW9vNYWkv2LDJuDbMhE5L7oG3+du OAnLPHeo4x8MYJkShwHPfqAEZPfTe3fhvvdyE0UKANNgHKCH2GZ/tTFfOffuBcWVIWFtQm xuEGZ6fAJVH09xN4Mkzu8Vx71qFUT3w= Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L0LFt5001852; Fri, 21 Jun 2024 00:26:48 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=foNfqk7y1VvRgjjR6LQgz5M9c0dP3 6TKWNguBx6pHOxQ6q4DNRzUPqVk759skUQInYx8yOQ4Ye0nFTQZaFeEqTVRfp50O MFSX8NzG50bCmFGOVoUegiSpdAcWjvoHV1GGSjaYSsZndy4jn9tB+IfF/dBXvMHW L8/FLoV+NByHcJ37Vi+CNcCBIBozpV5XdjAGd4UWJSckIM/zdrLv7WuqSWsu3BWs 5A9BdsA5QD1NJyvv8p7SvmA9c6mjwR1e8hmKLYWdXfTnAFk4DgAFABqg0p9i/IU0 hfk70NVrCmwCQtUsd+cEmbnaZkxwFjFja0BP8XppJTTZA61nukIi5E36A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrdr8aq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:48 +0000 (GMT) Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45L0QlKR009504; Fri, 21 Jun 2024 00:26:47 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 3yvvrdr8am-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:47 +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 45KLdx1d007675; Fri, 21 Jun 2024 00:26:46 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspampe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:46 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QeJQ29819576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:42 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C16962004B; Fri, 21 Jun 2024 00:26:40 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9ECF620043; Fri, 21 Jun 2024 00:26:39 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:39 +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 v6 17/39] mm: slub: Let KMSAN access metadata Date: Fri, 21 Jun 2024 02:24:51 +0200 Message-ID: <20240621002616.40684-18-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1A4HKTza_ocuX6M60P_a4YFE-_n9G1yK X-Proofpoint-ORIG-GUID: UxAe7IFBDVT7uND_PYXcw2RbRkIaNOQ- 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-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: CAF9118000D X-Stat-Signature: iy5fuapckng8hwutm9yrbcko5uckdnzq X-HE-Tag: 1718929614-749581 X-HE-Meta: U2FsdGVkX19y60NYKLU+3Hc5+0CMVUhlEOj2Pk6mTOdCftGWjBdQ+fwHad+JdHw9qZox9Lnk7Yoj56JJcQ7crYOfLcIemmWqZBYR6DMPoSXrYSZnewsl2m96kU/bkQZnWOUHA875AMt9XApy4oPrrcqxaCeozqlt8uCDVBlv0GH+3c0B6l/CkGtrWXhQNubQJKq7nwZJP9N/fIAjd2JdDcaX9b7b4cxPPSHGmdw4ZKuzcsh9A/TBSF991UGcA8gBPgMa3UXUmx+n5J0qbKq6bLVoDQpxRA6+qigDdYXSRguS/RK1ur1qAhyf6bScDEiPySxHDJM4QymN8w0q/odNNyoiYz04VpHsDFYmgAFJDehpGmNPIqaYmasnU68H0lAiEXTIlzsRTVbPFVJrEB6hTrPMCqDLcnYcuGSk0oUuLl6UDgGz/wMNDdDpg9guLlLD2apTxMosnpdPNe7G7Zh2tMng2LIuhoPIxtfLJRb7eta36BX8uEk17kR29OoHr0Xna7Cx4hMn1J5xoSf0OpUoQ6yJpUi+oSMA3jrDaP+L5pr8gKUElZTsTDcBAEpJ8w8d2sMKWUSvMBL26r2dy/JDhI9SsTkIfcA8zzRGwaBysKGAtj9PKrZt0Pl5/QT3TnBuK7gJHsi32xxTYH2KYfR6FKd3dL5UQqlJtWS09aI8vsXjFJ5o+8kAWKoBOc2v5fWR+IlEQvdPJwRWXiZ81wWD6iTJxT8wEt5gsXwdEdhG1AGqyMLfGn57wWw7aYRRZ9G30aH4B6zDIrqXgJr3HhLyuSCXibGZkQpGqs7AMAAVaxLWSYjtezo8UkfTgjLPIpb4mvFRXkduMGrPLpgwsrIaQ2+0uPyQ9EgUPEXXjVlQtwQwSlsis0bZ0ztvYqU3xX9sVgRt8zYV/itiAc/7vprXsInrmZW40JTEegiQc3SD2TRFvcMhadEkPMzfVUnokBnyDj8dJOJQEfdtf2lvT5O KbZAQVKY 7UvCGKyI8NpEbyjYMMwSNHg2DK0uwhfZ1rD7/YDea5O1WiMJqxBatcS7aMfcd3jcD4mc/ZS6MPbz6BWaRkM+FuPWqrjPwI3xVI91+K8dpMGQCud4rqjhRh+OmGeS9fg6yYFvGJEgUPZD0J/coS4fO2flUqRgsOe1R4FJe3vT5i8oAxzB0QjKvPLnhll2i5FHVOcOltYMJXtc0Zz20grdxG85/X18K41lFHsTzz6Cq2Rks53AZig/HpkzgTVtTJ32SS+3KJ6Ydn7TcT4WQRXv2IEgBc27ZXi07OKrsZoyw461IQvafJ7XE3sO6L1cx/eANyCSdMx2xWMhpcFiiSKiIJpljjCH0DcVyPVmBb1fmCIWC2M8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000103, 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(); }