Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5654003rdb; Wed, 13 Dec 2023 15:37:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeVBJX07bcpBBdKTy6z4eFmItoqmL8CIVjAowCU5Vo3tH2Nu7E+RRwBfL7P1yOhS0nHZY5 X-Received: by 2002:a17:903:2348:b0:1d0:8613:3cea with SMTP id c8-20020a170903234800b001d086133ceamr5733626plh.0.1702510629666; Wed, 13 Dec 2023 15:37:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702510629; cv=none; d=google.com; s=arc-20160816; b=n2UvLmtAJ8APXnzjkRhs2gxkvdtjuTiWRNZ5fQJq4XBxqs7HF0lFK1CJuO96YV5lZt JC4L1oNB5Ocvpp3rKEh+220qXt4nCg0CfnMXMI6pi+q5amrM8fQHCIpwm062LC+CPmuu Y3wzXMZ8qptWKmBJf+VdVN0JWvcbmV1JOCkU52drDmqwAUqP5dsa+g5I2MWFxsZ8P/34 5dfkQf9uQsgHAo3EwTUO0dZEv6OxIQLwRoObH74xKUr9jVse6m+N/0qclv2+Dck/6e37 ToZj6rDqztzCDFyP22e5P9LaKtPeoj5udPRHVjjVDzz7MqD6lIU8BPeVJn50Ai0Nuy99 JH7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xivDROMC2MSJ5oqx3z383eaVzZ8qGYoAxlkMDaT1E7o=; fh=TQATEbdDZNcnk8L2eDP6eFL9HlexFaHIexhR1TH2IlY=; b=U+rkslzMrke18Wvl2lmeIUoCU9YBZDi5ynswQbhw6+RZiwLU/gJTgrQQEMsFA+6RoS u+NqkSlCJ2l/d5bNnZmiXRhRmoyzjjBn9xx2tWRERYIzykZA3BY66qsNxbfWDJIxrx28 wWhsA9hGZUaMA34UPx98qJhozaa1VY7NyHy7rt/gKYWzeGQtwfHQvDxVzvyeB2Em3plQ FA2ExdoezSyCPIGpdA5FpWbkXuog9BzP9P/Gb6SJGQTFRcTz8Mgpcxeqm2VRKrQRzdO/ pdNqgMblqZh+pOZDh5c3UaQIpj2Uc5ACvVB2BOTlZlmwVEqQLB3s4scbn4IlhITnOO1v HPhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DjrNa9T5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h14-20020a170902f54e00b001d00a56b03asi10524300plf.337.2023.12.13.15.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 15:37:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DjrNa9T5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5206B80C1130; Wed, 13 Dec 2023 15:37:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442766AbjLMXgx (ORCPT + 99 others); Wed, 13 Dec 2023 18:36:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234082AbjLMXgp (ORCPT ); Wed, 13 Dec 2023 18:36:45 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 857A410A; Wed, 13 Dec 2023 15:36:51 -0800 (PST) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BDKaLdq003691; Wed, 13 Dec 2023 23:36:37 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=xivDROMC2MSJ5oqx3z383eaVzZ8qGYoAxlkMDaT1E7o=; b=DjrNa9T57m/8zcm8L1QFOYnrBJRn3t3T+GbPlvg9ESozC376QAomx1V4JAieuR3xXXFA H+cFRBpy6BeMgCeIRwd6oU9DkgjVz4NC9ln0dHcoqf3ffdclMBKs+I9VTqS1q0Vfz7Yu MuK/WCSOq8vcBKTq9SZYwte+/N5ziupyRYAK/qcQO0z/ZowXdk0v2iPuRteOxW9+2bqW z+mcCar7cNzFvJWT8Hvcc/agFevm/4/LqFi2LGg9M2FruV0/sEvQ92HxJa6J5P/VUKJQ 0NSJyFJtEACZ7qyW6u+i0mqh08bXJfh653ydJtHVFVLbnl5QWz6V8O8vUHLyCPD/yDHK pA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uykek4929-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:36:37 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3BDNQiae029277; Wed, 13 Dec 2023 23:36:36 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uykek491u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:36:36 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3BDL4sCD028206; Wed, 13 Dec 2023 23:36:35 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uw2xyvrpf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:36:34 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3BDNaVgv31130210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Dec 2023 23:36:31 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C203A20043; Wed, 13 Dec 2023 23:36:31 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C3B320040; Wed, 13 Dec 2023 23:36:30 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.70.156]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 13 Dec 2023 23:36:30 +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 v3 14/34] mm: slub: Let KMSAN access metadata Date: Thu, 14 Dec 2023 00:24:34 +0100 Message-ID: <20231213233605.661251-15-iii@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213233605.661251-1-iii@linux.ibm.com> References: <20231213233605.661251-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: pVuzK0gQdTIFnChN-MT9dtMNaW8q7lGC X-Proofpoint-ORIG-GUID: NkNYkei8hiVoPWsPSF-7lXxeLJhRULql X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-13_14,2023-12-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 mlxscore=0 adultscore=0 bulkscore=0 mlxlogscore=966 suspectscore=0 clxscore=1015 spamscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312130167 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 15:37:08 -0800 (PST) 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 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 b111bc315e3f..2d29d368894c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -700,10 +700,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(); } -- 2.43.0