Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2856271rdb; Wed, 15 Nov 2023 12:35:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEA13RUEPnlPpJ1I3kujvfoT5H+qL+K4gEvlNC9mTRTaLVrJ/CmE+esZvD2RCBDJdQdSo6 X-Received: by 2002:a17:902:e88e:b0:1cc:5505:fff3 with SMTP id w14-20020a170902e88e00b001cc5505fff3mr8606376plg.30.1700080535190; Wed, 15 Nov 2023 12:35:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700080535; cv=none; d=google.com; s=arc-20160816; b=aXjrbl+5BlSt1D7hVQu0saiHmQlDKTNOEHOccwjq0MYATuIZKrTkcwzc844vjstMfz EpeoZTxOIy5t1QmbN8HlwrZz3ko8LaEHZQ6yhzgkvNi+rD4516CDfAMcnoENbexoNQQm CWK/qyuUvDBLdidZoaGopa+u7FLVOMxQQpfgM5/xddPlQ5672NfsOcRB0y0yuwpeMncU fT3MjJ/K8DSvsWJaUpgJWTexreEBfhSblGoCFG8YWHYjtJehrycln3pTbpWjPHZn9NrO ArSrY2wdMkvI14aU/Su91+qbsIehFIHseBEDhgbmtkSDtdp4Mi14+yj6GTlSCUhaCRRg Oyqw== 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=Prpv+ioyJJfZrf8ByIxPulecOh5L6EAjxoH7NJDKd6Y=; fh=Mk/+hh3KXEiY642GJit3QcoQ60j/OUZTCvigu+jTRuo=; b=kze7ODJvwmzCdjY5PeNTqORWyssFQix9gT5e2wgCAtdNTRl+HHbcQSjifHFqyz/K8R fj5jptDfrZEdrOddxjbW0/SesA4tbqjyOo5NdNe+OCmpfBgDOby+7rZXwFqtI1T4S6Kx T17lKk5IEx0r8ESzDurHe0oq2ZMoe1CFOi7HmtS0xpPraMuKsPV44uT/Xrz3SUZ/Rry7 ipSH+p+de/LTLJewqbfn6sKFrdOZgc52iMI9kpjl0bDTRjT1aKDZKsUsLKmoGZn91v/o G9EJMwgnumdkDOxydRE+BmwlugDVTG5z4JAvJsuNve9VGMTIK09h/kXjBw5Ita8kS+xs Dbmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LLyi7dxG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id m14-20020a170902f64e00b001c75540d9fesi11554033plg.587.2023.11.15.12.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:35:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LLyi7dxG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 A0F92802F192; Wed, 15 Nov 2023 12:35:33 -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 S235759AbjKOUfa (ORCPT + 99 others); Wed, 15 Nov 2023 15:35:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344537AbjKOUfG (ORCPT ); Wed, 15 Nov 2023 15:35:06 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C06A8D48; Wed, 15 Nov 2023 12:34:50 -0800 (PST) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKFagp016166; Wed, 15 Nov 2023 20:34:36 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=Prpv+ioyJJfZrf8ByIxPulecOh5L6EAjxoH7NJDKd6Y=; b=LLyi7dxGghDJtCwcbzTDfPAfYRWuFYqoCzNZq+CXY521UhpAdBanrtkVWi2nQKT3NzOr HTgWqLLgi+FrE/mzwQtD84pNiS9Ls6XmkBvgUSKYBxP08wRIn8RynvX0JfUnN9pW6hwQ TWjJY4x5XO8czW1HFGUNhvxyAEx7NhDKHjuyZtbE4aCPyujBrr2c8PvHLXDFdOs7OQQ/ fIxjw3EpgGf9EZtYIYz+dHPurx9tvRFSzyGIcnhKsYmmz5cOfEfPB6DDGKm1APPJ+T7R rEMITFZFc7NUwSsXCKWV2CMz9cyk0g0h3cYReM28iNkodv0ZQYsqm28QpGNOQkk6Dvf+ zQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v2rb6h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:35 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKXhxg002277; Wed, 15 Nov 2023 20:34:35 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 3ud4v2rb65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:35 +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 3AFKJ36O017548; Wed, 15 Nov 2023 20:34:34 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamayj7a2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:34 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AFKYU8m22807222 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:30 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4F4F20043; Wed, 15 Nov 2023 20:34:30 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7867A20040; Wed, 15 Nov 2023 20:34:29 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:29 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , 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 13/32] kmsan: Support SLAB_POISON Date: Wed, 15 Nov 2023 21:30:45 +0100 Message-ID: <20231115203401.2495875-14-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: VtMKqHRGouLJud_Z04fE9mTeehVK5PxD X-Proofpoint-GUID: 9JnYJ8nyLC98Hq0I8m7EcHlY1F4CxSFW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxscore=0 clxscore=1015 adultscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 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, 15 Nov 2023 12:35:33 -0800 (PST) Avoid false KMSAN negatives with SLUB_DEBUG by allowing kmsan_slab_free() to poison the freed memory, and by preventing init_object() from unpoisoning new allocations. Signed-off-by: Ilya Leoshkevich --- mm/kmsan/hooks.c | 2 +- mm/slub.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index 7b5814412e9f..7a30274b893c 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -76,7 +76,7 @@ void kmsan_slab_free(struct kmem_cache *s, void *object) return; /* RCU slabs could be legally used after free within the RCU period */ - if (unlikely(s->flags & (SLAB_TYPESAFE_BY_RCU | SLAB_POISON))) + if (unlikely(s->flags & SLAB_TYPESAFE_BY_RCU)) return; /* * If there's a constructor, freed memory must remain in the same state diff --git a/mm/slub.c b/mm/slub.c index 63d281dfacdb..8d9aa4d7cb7e 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1024,7 +1024,8 @@ static __printf(3, 4) void slab_err(struct kmem_cache *s, struct slab *slab, add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); } -static void init_object(struct kmem_cache *s, void *object, u8 val) +__no_sanitize_memory static void +init_object(struct kmem_cache *s, void *object, u8 val) { u8 *p = kasan_reset_tag(object); unsigned int poison_size = s->object_size; -- 2.41.0