From patchwork Thu Jun 13 15:34:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13696994 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 68E2DC27C4F for ; Thu, 13 Jun 2024 15:39:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 56C596B00A2; Thu, 13 Jun 2024 11:39:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51ADB6B00A7; Thu, 13 Jun 2024 11:39:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3470D6B00A5; Thu, 13 Jun 2024 11:39:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EAB916B00A2 for ; Thu, 13 Jun 2024 11:39:51 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A65CB40179 for ; Thu, 13 Jun 2024 15:39:51 +0000 (UTC) X-FDA: 82226275782.07.6100EEA Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf19.hostedemail.com (Postfix) with ESMTP id 21E561A0003 for ; Thu, 13 Jun 2024 15:39:48 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="bWFHZS/g"; spf=pass (imf19.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=1718293189; 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=L2b4MdNWoGrmhueYrJgLdkWwOUUS/TDjtdF9PAJHumU=; b=EJEnm/gS6R/e3v8issEIKy6eZmyoevxk6nLZ9dcCfY00F5XsREtnKVSdjlumqxO01Q77If 5fmZnr7L6hgTcOROqnYaSUdr+2dACeKmb6Z1IxqZ+Q6tnKSE0UBP18hGchfdbairaP3Zns zko913U4tKRoyp9K4zY42gBef0ZkJmM= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="bWFHZS/g"; spf=pass (imf19.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=1718293189; a=rsa-sha256; cv=none; b=DB806CdoxCDav7KkjLT74wx5qbHeADKygvHKHHBXjdILKftyRo+62Aj81etgJpAmlOZbgT 2JCU2mxDJCD0kXPgRAu0Uf5CIuyiIrL+7qYbHWSZkxeqKLKAcj2Nwsd2pd9tN3WsQ/2zup wQDw2Akfy9ZzTa2jJAZQxSLXELWpILM= Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEQVaB026718; Thu, 13 Jun 2024 15:39:41 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 :content-transfer-encoding:mime-version; s=pp1; bh=L2b4MdNWoGrmh ueYrJgLdkWwOUUS/TDjtdF9PAJHumU=; b=bWFHZS/gCs3+ozyXGHsIpEgSVpzyh bzelX599SlzpTGlgXKqkkTAC7MF0k5k7BqCp3QwEhA+Iaovt5FqaBZqF2dGjGC/0 kky7C0ii7uQwNvujLjMiYpa3CF40vJm3fcia3OgAk0yg8lZ1tKNXD93vFDDL6R+0 6vxudZ9Eo13YTozbVzDFCC85aZ9EkNkaqX3ZmMl2m9P/1zPR7NnB7WKZgIH8fS77 enhMDFDvQ9U0PCBOVoez3vwiMphgIInJTZSfw64J8OVolyar+1Eksm09tATgvG26 RcJAEPVlzEhn+SIfw4i0Tf8Ew2gn5gfSvtdBy8yDhWa1MMNfkDg36gcjg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4u236h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:41 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFde84009379; Thu, 13 Jun 2024 15:39:40 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4u236c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:40 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF3D9l020045; Thu, 13 Jun 2024 15:39:39 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn34nh0bb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:39 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdXFd34603580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:35 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D0C520043; Thu, 13 Jun 2024 15:39:33 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EBA3E2005A; Thu, 13 Jun 2024 15:39:32 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:32 +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 v4 01/35] ftrace: Unpoison ftrace_regs in ftrace_ops_list_func() Date: Thu, 13 Jun 2024 17:34:03 +0200 Message-ID: <20240613153924.961511-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: xm45VOErXn2zx--ADqKb53zaUOSWviMh X-Proofpoint-ORIG-GUID: Z8_ju8nlqZv5xj4EN8MEBuP8KnX5onjx X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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-13_08,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 clxscore=1015 impostorscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130109 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 21E561A0003 X-Stat-Signature: 8d87yo79fkof8q5re3ub41b145jmzt15 X-HE-Tag: 1718293188-92888 X-HE-Meta: U2FsdGVkX1+QbTqW9YXg2tb7p77mDxWns/AWM2bNjgSGKSmTyeGGKG13fVQWaMOSP997fIeBoYO1evrst7gvR+pLrMKwcbo2TmY1Sd7lERafMck6e66nYL0gSYpNznO2TT8FMZL7dcq/5cnmjFAcBvW7nVO2V0e+H2v+QONrcF4e8DyLGSwMmNBx3/Ps5ENhsyL/+JpUUukbpCBICOHxjIzx9MqQhW/LUj4pHo1W0bsZXOy6mjIEp61beH73MlKTv4rt0GHybDsGQl25L4+LkNxB35/h5eBXVvRv4pa61XOCtNPjuKK6q3BpcEll56vEdcHW1TSa5s1v20w/XdI76hL2pGNdMUBUhw4EeVBQuCxvQ6BdmB3WB8h3vMzwPNoVXgNGidKXNks9E8uHlmQ29HfVhyq7yMlHCHGfO+R8pV0KUMaXtVeWjfMqGkTvCjWC11L2gY2ZmZUFFge6Lbh/Ime0IkiD207i7EbRAZb0z5nh0xrNcoA79ODp3yOOTq0yItDWVeDQCBIvD6n8vzwUpRRUnEEoX/p4LX5RsOC27b/8UC275Y7AuqFtKzEh/tyLWZKa+FNqxdFRcAU8d9qznZyEanWexFdSCKwLooTV8hATjehl7oEgs0nis+Z3+SQrOIKdRaflbwVg7YE9m3T1thL89fqvxDtjgyKfXqI/dTnttccMDkIodTBGSRCAj5VCnj7EN1NpWLol75WL54iIe6yUjGDNAgrc0J9VUIsSi9HSl8xTDHv/3hrSgziHevGg991pHua+m3FoDLW9G1ZG+7b1HbKjKDU9Q0qriqAtPB0A42UXhJiT99InwC4S1mioafx0trCdxHaKOzJQrj/Gj9wAgB38mr1NNcFJupcyPXZvytpOiNjEWu6sqSVWz2SMTr8QJHbdT5gQXpXN1mG8bHMks710/KfqD2QYElSczl+0ZOrUvnAiXfcKSUHJrrtTpb5gm9oswQnRl6pMmlJ jz//hR+w H98PUmesa9M8aHSzYg9/NwADu39g1MCIU2G71+dl59ZUfS67GsgBv6AlU392i78hnXUUyrREPFHzmbyNRHNNvxSL1FS7Xl2dSch+K+ve/6Mf6Z/dSzfhkbDWfOK4xE4bYiWnwsorTOYuUiZouKZqUZei+r8apN4y28K6TN1EXVoLUrGaLSMpIAOJxoNK5QCrZXjJ9Wrzj6sRXmdIF+OwBbMhVHcfhc9F4Ud11WGRuU5hRpb5Pa4Qm4IPxIYZmBEyhZeNMuPwDKnysAoozQeXV883a5kXnzijXDRHHxgzRam9bWwrj4Yw2IC5gVw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Architectures use assembly code to initialize ftrace_regs and call ftrace_ops_list_func(). Therefore, from the KMSAN's point of view, ftrace_regs is poisoned on ftrace_ops_list_func entry(). This causes KMSAN warnings when running the ftrace testsuite. Fix by trusting the architecture-specific assembly code and always unpoisoning ftrace_regs in ftrace_ops_list_func. The issue was not encountered on x86_64 so far only by accident: assembly-allocated ftrace_regs was overlapping a stale partially unpoisoned stack frame. Poisoning stack frames before returns [1] makes the issue appear on x86_64 as well. [1] https://github.com/iii-i/llvm-project/commits/msan-poison-allocas-before-returning-2024-06-12/ Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich Acked-by: Steven Rostedt (Google) --- kernel/trace/ftrace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 65208d3b5ed9..c35ad4362d71 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -7407,6 +7407,7 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, void arch_ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *op, struct ftrace_regs *fregs) { + kmsan_unpoison_memory(fregs, sizeof(*fregs)); __ftrace_ops_list_func(ip, parent_ip, NULL, fregs); } #else From patchwork Thu Jun 13 15:34:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13696995 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 790C4C27C75 for ; Thu, 13 Jun 2024 15:39:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A90C6B00A4; Thu, 13 Jun 2024 11:39:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 71C2F6B00A8; Thu, 13 Jun 2024 11:39:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40A826B00A4; Thu, 13 Jun 2024 11:39:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F1D636B00A7 for ; Thu, 13 Jun 2024 11:39:51 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6BF3E12018E for ; Thu, 13 Jun 2024 15:39:51 +0000 (UTC) X-FDA: 82226275782.10.42F08F4 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf13.hostedemail.com (Postfix) with ESMTP id 3F1D920007 for ; Thu, 13 Jun 2024 15:39:49 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Xg3HEhtN; spf=pass (imf13.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=1718293188; 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=v73BMs0EqfMCwxJniJdo3jdaknlggr5A1qJ50X9w6PM=; b=rLYOBoT1cmvol8BIp5Z+O4p/9c8Bb1BGIHNBBlAUYnJ1A31bj3rkOBLosQWZHDZomMhY/e HWBY+YKs7N+tuUs4gT6Pudv4kZwoKK4mmn/+m0SifqHAPKtYbxnKSckmOJWomY47w0sU0v cFrZ0RDBOmm5jMc04Zub3/E6TyRFH5w= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Xg3HEhtN; spf=pass (imf13.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=1718293188; a=rsa-sha256; cv=none; b=4IprNRAIEv8aXFnU3fxVJ3d00DwDNi1ZVj+k4WePQtp+ACEiwASLMQk+rm5Yvu+rLnXFaf 7gkBrVB5qeL4aOMD26t2+i7CkzlGzHm6K2RczxYtotNH5eWV5CfxYEi4TN3U97aVgAEVeo 0tdLcY4neuA4CzRl9hpQTVPLSjd5pqM= 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 45DES8dv002382; Thu, 13 Jun 2024 15:39:41 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=v73BMs0EqfMCw xJniJdo3jdaknlggr5A1qJ50X9w6PM=; b=Xg3HEhtNfw4Nggs6FgLxvW/orJyHi T4CAPSaP5Pa6GxF3CrmAY/YDBzM+/N6poCa64kZ4m1eRvOaDNa+6PDOJx01cljgS 8H1Bo49BayCQsOe7qbu2VBIQW5dYHBaaQx0hCdarYas8/M+CuOxe+iolWQQ/m5m/ ysqqDxXmJr32+PF98kbzTfRXDfhdH/6oc1hqSzApmH4O46EGRs8oyxQmvtf2H/3a 0u4AJvLKmryv0Xd8fmED/bGLURZwbVgznvYl/cO6VPkZEUtLxzSkc38j5X+ZziBo GfwnpgrrRBg1oW8OpE2RYv7ok8BEDtgHs3pvIu6J0dCtx7CdJDZ27+nWQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1rbgde1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:41 +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 45DFdeJI014227; Thu, 13 Jun 2024 15:39:40 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1rbgddx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:40 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEAZNg008701; Thu, 13 Jun 2024 15:39:39 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn4b3rk09-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:39 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdYlL53281258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:36 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F407F2005A; Thu, 13 Jun 2024 15:39:33 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 800F62004F; Thu, 13 Jun 2024 15:39:33 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:33 +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 v4 02/35] kmsan: Make the tests compatible with kmsan.panic=1 Date: Thu, 13 Jun 2024 17:34:04 +0200 Message-ID: <20240613153924.961511-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: CdYaY4n1sBSfG-XGjjLpn6owGrgb3SMW X-Proofpoint-GUID: Y8_1HwUsdyB2-FrEKBSNLoa0NfmRdcsp 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 3F1D920007 X-Stat-Signature: tb5oe9f1zdfyam41is9bqnd1hemnce55 X-HE-Tag: 1718293189-551634 X-HE-Meta: U2FsdGVkX18lIj6Ag2hxuXxVgmPHRZuPG/4EjYmu9+UZKfsnx48hWjgSUuJltk6+rc9eH84tEafG1reko0z4dmGcJwkEhgMNVXuCvAv76RyCBdFu+ZMcqo6WDisoqpXQpqonKkcthjCM2Zb2My4p6b5kuqDkz7whQRMapk3vKkIAxqllFjzVnBUWx2mtnzpExZrjdicDFJPK10H7soRt5HMPk6FKvfxyvxixJMy2IkJL5DXmOcqsW27y++JqdA659u1cLHKjUJVGnuALW8UNVjdB2lq2UFGSyCzL3NdBClGxL0arsPni4ayFD3dZ7R6eXSb3H5SQe7PLCCUSPVynbtBYB6dTaOBceMk/IyVA2zVxUxmFtM6sIRzP0p1omY+89HOvg9uEmkHy564Ncgt/H4iqavFKWQZG05GPKF6n0pnQ4BRoWb/VkigiMAeH+InEU3IXipCttbWPN4Nm3q0CNaMhyNSSDJbXyZaFVpY74+VdtsTn9cnliMlx1nj+ih2rhLpi4kLvn2wdxt/cRYTkAppMmbIh2P36It05Ph8tPrYAY5NGvFXrXYdyIq+GAvHpS6i8AdxOJrwmZwdG0Krt+yqK26foBUqdEl8qyA0unqIJYwyrpEidIlE0QQ1jDe5tSHsuEE7ntim7DjmktiqaZfVR8ym8xf2+8rkoMme1Zl5sTQL80MCctUoMmEJ3ffwATC+dLB1f8Udpc1LnjC2gwSTkoEarTFCnsKSk6+02ehdRDzYs4KUYVAD5YM6YGssdi8Xxp07XOPJz13mqoVJ66k4+p0denaJVEOE+cJnO4/vhKuR2Wsh1D8KM3i7+ZyNwGz5knOQN1ItVzxGvOCpk+wDFibf1yu960zMqivm4iCMmC15QyKT8FehxXIrGXp5/9c2EMwbXBIq6Rb/PPNTRRS6VYiNnOAjWobPlnANbIaSZYVdPX3SYtdCtkmCAw+0ZeNbDyLmoDCa6ntyx4HI SWTwv47s 3OUMbi6IGj1uWnBgUEf9ab3gZxu/GhtNbJH/mzkavOQZPaMQ2S2okYntcnLuUb6Zv67/DotNoD+QRp7Vw783VHu++ve/yQT9iDas3laWdO+/DpIacODnY9n0iv3NsupWlgtnDTbYCd9dAJ9K9n0jM23jfEjvnc1ISdFqHMT4WU/t7d69m5GOzrUsl9mkMQYDmGigF30hZg5/oUzcajKb7KUi5E7X4kVDOqTLnsHw6ecKvclT+Sj9gpRQth8gOxPmoOniKH7JDWmY0/Q3vxSecuUy6YJQlwLUeYo4GlDMRfhWQVyko3fasj9xhOJIUDkksd9SLmr6l5XqUkr45U+ClOPE8a3qVaKl+SAZGgg6N5amYZXhT+5TRZYIzBw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000016, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: It's useful to have both tests and kmsan.panic=1 during development, but right now the warnings, that the tests cause, lead to kernel panics. Temporarily set kmsan.panic=0 for the duration of the KMSAN testing. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/kmsan_test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/kmsan/kmsan_test.c b/mm/kmsan/kmsan_test.c index 07d3a3a5a9c5..9bfd11674fe3 100644 --- a/mm/kmsan/kmsan_test.c +++ b/mm/kmsan/kmsan_test.c @@ -659,9 +659,13 @@ static void test_exit(struct kunit *test) { } +static int orig_panic_on_kmsan; + static int kmsan_suite_init(struct kunit_suite *suite) { register_trace_console(probe_console, NULL); + orig_panic_on_kmsan = panic_on_kmsan; + panic_on_kmsan = 0; return 0; } @@ -669,6 +673,7 @@ static void kmsan_suite_exit(struct kunit_suite *suite) { unregister_trace_console(probe_console, NULL); tracepoint_synchronize_unregister(); + panic_on_kmsan = orig_panic_on_kmsan; } static struct kunit_suite kmsan_test_suite = { From patchwork Thu Jun 13 15:34:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13696996 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 5CBA1C27C6E for ; Thu, 13 Jun 2024 15:39:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4812E6B00A7; Thu, 13 Jun 2024 11:39:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 431C46B00A5; Thu, 13 Jun 2024 11:39:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D29C6B00A7; Thu, 13 Jun 2024 11:39:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0A32B6B009E for ; Thu, 13 Jun 2024 11:39:53 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BACC8160195 for ; Thu, 13 Jun 2024 15:39:52 +0000 (UTC) X-FDA: 82226275824.10.ADE2295 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf06.hostedemail.com (Postfix) with ESMTP id 69EA2180013 for ; Thu, 13 Jun 2024 15:39:50 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=KekhLxm6; spf=pass (imf06.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=1718293189; 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=A5/DP3QFUFkYA2+5kJImY20b3CDMSHPGwimqBdu525I=; b=7qz52wuC8DYEtN792+/lSNgcpKEidQ1p6eAneabigQmkmQ1XFbRm445OfumrI2MTl2zrlR QlFJzSyI24HUcxlzYMuSRXojBH3vZD5Hy0VVobtGO1UI/DUsH9Sse/ecWx/K40t4HTnNnD ioPpn0eXnb3ii+mVBNWCuqp6laHJwTY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293189; a=rsa-sha256; cv=none; b=xdltABEn3EYeSkzJOrgJaKPqVnLX4pk85M6j78/QQg42DNjBNZ1/k68r6tL2SWFze3vFci CiBBj2MwYSCk5hk1f1Zfq+QGGcvzeJHv8K/rgm3z9AZWIVAD30cibmFOvNPzv9qvHiEMTk PQOZ/shW1eWHyX0FQ/p1RlbzKUr575U= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=KekhLxm6; spf=pass (imf06.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 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DFRYAU002831; Thu, 13 Jun 2024 15:39:43 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=A5/DP3QFUFkYA 2+5kJImY20b3CDMSHPGwimqBdu525I=; b=KekhLxm6CVvtnSZX0z6KEtIvwm8ZR OT4TfI8b0Yz+YP1+eMehz0iel4LBa66ZWdC4Cy5p1zs3+3+XgiXXjE3Pfel6eBOC 0RT5hKQF9xOGJwyPEpcPUS9htQtys7eI/X+waWmpVSeKhjqE1QIEQi/0nmkU37/B I6Sa9bLL7XjT3svhFM+kMEZwVDLzdjIkSig9jGxyyuF4P3b73Tkv4Hayw+PadE/O DaRWLXwZmwdJlTASuCqhoGhFKmrWMKlzfYKD+0HggTRyPY90G0mPDVnIH1SFBvHN mgDVNAnNbdYTcu4wO4DC9WWlwTgGSmKa9/uir8GRHLRv9TBeyM4OQ6wNg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrw11ymn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:42 +0000 (GMT) Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdfuc026422; Thu, 13 Jun 2024 15:39:42 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrw11ymg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:41 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF9UJu004368; Thu, 13 Jun 2024 15:39:40 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn2mq916b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:40 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdYVb43385236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:36 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8819320063; Thu, 13 Jun 2024 15:39:34 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12A2D20067; Thu, 13 Jun 2024 15:39:34 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:34 +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 v4 03/35] kmsan: Disable KMSAN when DEFERRED_STRUCT_PAGE_INIT is enabled Date: Thu, 13 Jun 2024 17:34:05 +0200 Message-ID: <20240613153924.961511-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ohH4Wf6GBU_oLonoZfUiQF3dUEI7gZ3l X-Proofpoint-ORIG-GUID: WaDxr-0abG3R8ki6jMioCFv3al33-FAR 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Queue-Id: 69EA2180013 X-Stat-Signature: g86exfgq7k1qifecz8wunnswu5m8rkec X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718293190-924813 X-HE-Meta: U2FsdGVkX1+6FcBLuj7E1ijjEVfCjBgZ+AblTM9bbQPg0sMh6ozZC9oReMa6BwO8xjg5jJRELEFK9zdpo5hLpla+OX451cLtb0a9K5vZn6rRAMPO+G5ZfrmS9xjrkwq62R0aRNbNVuZuF4SM8v2OpDVlWfhSJAY5KqQiIt3L8H6kdA8XsbOiY+Y2egYUoXuUZoGFiWaPlTrpOgdKTWJ9WRD713spDll/ANt6xlWFbZfnoyjmHTDgJPYpbF12MXTiJDr5JiJdi+oWiFSqODKUhNAyuUcpzOOX5m0R0En+kjuBI+MZ+Y0n3R2rw5ijTv+q7k9n96+TjXnszUJ9GRkgsdlFVc9YULmWQULqMkxGw5e+wGq/4iqONO3DoxqyaUFt0J3kIn3Lf/M2DdZ8IBDH3xdKUXG8YSj1f0U1Wg63ahutwmjAlI9GRfjRWLgqudQhiq07PdU8KKHGrRHO8nkjNCkn6bk7xL83ctd8QxhExhnNbw6SaCdHYEjad3NDJlGuzeMQ2nCb/vaV/VhudhtbA85hUftpw45SUkoO0+EibiKXKhKOywX7eiFdSPfAplM1P2zUfsZ6+73iCNi1xLDKQQHW8WmS+oFgwp/wAd4KRYDie4oI8A7T1yOI/HpAJZ+74scuZf8xS2j6sL4CWyZ+w4iwRyAPHOf/4tn27MZ8imfstOQpijo7OM2Hj63u7mmUXqhQ94nflWSFhwztRa4kb/03E/4Giyed8Z5hZvl+6m+qS5mJmOr570504I9V/kyI1JTyv5tUNAFVQy4FsElj/vnxwOLW7f3sRrck4TWYtsQzMZ+WG5G6WAhKq4i1uDH3ga2zJHuBGQlmuUPEcYQYUfVYqch6++u/gLBRt+7qXRRGAqk+M1wVySBkxrGHUTwaQVVdiLy6k4ztsgMcajM4FV58gGyucrX3qhsahWAjhz9SXZfp5t05QhG9/3ILhuNwkG8O0qxnZA5iQx7FCtx EpbyJQqN u8U/jLHj6DaHW0NPXH1NPxRubdaRoBlrRDCnYcpB9ZqaNCTkdTxDYRDzP9ckLaTGXWjZbposZgqAKpylBz7fF+TAVXmCmLEGRmO4VYPijJKsOouE+loO1Did/hxaRB4sATqrhXAco/vKL9H5UfcYtNZTkTSaarvDEyOZhj6ZOKOzmkvg9j0L6rsVdE8iulAYCtCWLVQMBl1WXn0h3ukrL8ibUyA1cKUxGXbQONJam5u9OKCdRwqjFZ9hHRltAF5GloTU2uBe4zKiW72bZMszJ2TJgjuoCjbQcbkMgiANd8WSGb7dl3Wh/IoZHPAYJtxqiRCFP X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: KMSAN relies on memblock returning all available pages to it (see kmsan_memblock_free_pages()). It partitions these pages into 3 categories: pages available to the buddy allocator, shadow pages and origin pages. This partitioning is static. If new pages appear after kmsan_init_runtime(), it is considered an error. DEFERRED_STRUCT_PAGE_INIT causes this, so mark it as incompatible with KMSAN. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/Kconfig b/mm/Kconfig index b4cb45255a54..9791fce5d0a7 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -946,6 +946,7 @@ config DEFERRED_STRUCT_PAGE_INIT depends on SPARSEMEM depends on !NEED_PER_CPU_KM depends on 64BIT + depends on !KMSAN select PADATA help Ordinarily all struct pages are initialised during early boot in a From patchwork Thu Jun 13 15:34:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13696997 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 5B2EEC27C4F for ; Thu, 13 Jun 2024 15:40:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E95166B009E; Thu, 13 Jun 2024 11:39:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E6ABA6B00A5; Thu, 13 Jun 2024 11:39:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE3126B00A8; Thu, 13 Jun 2024 11:39:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B06E76B009E for ; Thu, 13 Jun 2024 11:39:53 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5535B160197 for ; Thu, 13 Jun 2024 15:39:53 +0000 (UTC) X-FDA: 82226275866.06.42F6E47 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf24.hostedemail.com (Postfix) with ESMTP id 0ACB718000E for ; Thu, 13 Jun 2024 15:39:50 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=oLMpNDAG; 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=1718293190; a=rsa-sha256; cv=none; b=zwpGlKTkofM3pi6/VSwZhbldUkydEt1+s1Xu/lhNCoNeEJr9/K8ioxut6vHizum64MTICY J/eXwKTgWcXW8Rwb5CdcM9Xso1Z/cYRu4wZVIzhK+n6IOC5X4gPZohAIOlPZ/3xgWAgaY1 2v0RAMO6cUBhlAvLMVC0uuYTPdqq5PQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=oLMpNDAG; 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=1718293190; 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=Scz6uta8wJUcmkDwOaiOL8UogdsQpVaK9UJlhoWG7HU=; b=mP1nyzPy+bSioXk+I8FzLmGRV3dJk4VqfxJmdbF0KsAF3nCLQ7VTdqPsvkwGKwEhjNjFXB 1x574nxW6VqTtvR5c30Gp2NZjtCc2wJQjUhCFIY65D/NPOnmnNYDBghoWU/hzfYEdtXi6g yC1KsbmHLxROl7M/OmGtJS/X+b3eBWI= 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 45DEHJou025389; Thu, 13 Jun 2024 15:39:43 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=Scz6uta8wJUcm kDwOaiOL8UogdsQpVaK9UJlhoWG7HU=; b=oLMpNDAGW3lNjF35W0Na5bsnFjVsP ChO+aFMnL8nZrB32nIvqrttlnBjcBqom8/0JUKbcyowxJaeI80aNtEvz4J3cIsQR PIR+A5pxUN5+j8voxvKphmIMHEL8tJV/u4U3ZUdVxIwjhi5jdTwjqtQq0vNOHx7N yH9R14bvr8YbXvCq47eA1Q3gkmlqUuaixM93T2sC58bd4b9JNqr2tQfWJAiJLu2X XScLUxujz+0ZJxMCS0HXH595V2kG8ubf+UO5lGwfna7RWVkvs29WrtsSvorb80uF lRhRak6zevbquv2VLL4ycw6FxZ4GiK5iML03hT3+bb9t98VHxSW7gNzJQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt36k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:42 +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 45DFdfK3026738; Thu, 13 Jun 2024 15:39:42 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt36d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:41 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEAZNj008701; Thu, 13 Jun 2024 15:39:40 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn4b3rk0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:40 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdZ6i53084524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:37 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A0222004D; Thu, 13 Jun 2024 15:39:35 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9AE382004E; Thu, 13 Jun 2024 15:39:34 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:34 +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 v4 04/35] kmsan: Increase the maximum store size to 4096 Date: Thu, 13 Jun 2024 17:34:06 +0200 Message-ID: <20240613153924.961511-5-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Rjws6SciTz59Dde6VDV_aw_xavPEr1pZ X-Proofpoint-GUID: Xwy5kU6ucR_kMY8jtxtA8RihxWWe-8mA 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-13_08,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=742 adultscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130109 X-Stat-Signature: 65kxkoj38p8fu3bygreor6p7snzq5gak X-Rspamd-Queue-Id: 0ACB718000E X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1718293190-470635 X-HE-Meta: U2FsdGVkX18sXC7AOfFEEMr+4ETVsoaXrrBBfnGKVX5tYxqjdnoO2Lkx86aKXExvlDim0MhcKoYSUGa9QC20EeUKIBR3zgZL4kQSVKtJ3zgFGyyaL7I2kmLHbs8kNTdfYxH8HKp7MXRd/qorsbgms0LcFT0p7GoxueCJbt9PAXLTbtyTbVXNAfgMq06DCph42sTj1JvJr3VrlGUBd7jNB2UiP+dPe1pEcVYWAULkFbWJeo7v+IYRvmaK27FnV1JbJjulV/cNsGgvXFjgqCTkW502PCLN6gjB4EDYsUbireVfeanZwN5yVyjVpUzRW4clgtvGNXbspFgFXxI/xcn6q8ITryUYORqA3zHTL0rOZQKxq18XA/aGlsDSdg5nqe+qeRDI+d6Nd2N3UssYb3o7Pv3tcFsnnj6QpMXqFbgMpK1Vmfg2CyVwYdRvPmHDObOG/lCaU0nsQsZ1qRSwmFD5KXJBa/FBsXDBpIRuoak+22cW8y68rC5jI5PR2reUxFa7zj6TqmQqwf4miHcZCyrIY2oClmKMyNm459fvvTSGgvxyOJz8Ntf67fm5pB/6wwrso7aIhYjxmkmbI/LdF8Z5MPRAtipj448JPfJikHyp8+DQ9PDV77V7wB+WoYjQyPur20Kr7XCfRS4EQuc+rMjMECE79TpY/Dd4Lbpot/zCFPbaToQrGvjM8XPEyAm/vxMruwDT8ElaZmQ9tRWoYw5szq6/jri1HIZvHa1os2macIaGvoKE60JyOxMT1x4Hna7MWt8kyDNR2kIxtctT+bqXZLxZB7Wn9lF+edVOvHNhw53MDajQ1ClSQNTebNwpT21Fx1d1ItpfY3EtNVkLY5lH7Azdvv7LSZzMg8w7fOAeazDWN1DgmS4yRDlxwmlOTPi1N4XaRC4hAx8Dl+G0rqDuZL5vQbD/m6hDlDxRmeR0IE/knff2F4T7UjrlULZZ/UnbRHfUcwGUwqGS+l8mhjc 88IjL27u ELLdbVviuxjD1it876i2btp91P76SFXvoo6XogiD+XrofjzjHRoG5av/zNBCC2/nMhepTlz+/fquJQG7DFo63ztelLKROvqddeM5eLAVQSz7h4SLkyr270OJjDs+5Zla1sP8PJ9CX5ZCpAwsAOHbbdzc7ghSefxwAkqQPuQdejnugbuA02SiXR5oZR0xlLxFJDOsnyELbd6G7Rs4yrSHtcWQfjUACjkFRh1iZSOYVHXb7iXM0cZfwTo5n+vUMeg9nWkZLnsUWkOhgYVmnisfUodlfNFpvvmDCWvM1s00K3O/2sKF9eWI42ybRLqXHPtPKgRGKn5dKG74KjXN6l8CYfd/y7jchDDExHM4lv1DDLcQrH9o= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000016, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The inline assembly block in s390's chsc() stores that much. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/instrumentation.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/kmsan/instrumentation.c b/mm/kmsan/instrumentation.c index cc3907a9c33a..470b0b4afcc4 100644 --- a/mm/kmsan/instrumentation.c +++ b/mm/kmsan/instrumentation.c @@ -110,11 +110,10 @@ void __msan_instrument_asm_store(void *addr, uintptr_t size) ua_flags = user_access_save(); /* - * Most of the accesses are below 32 bytes. The two exceptions so far - * are clwb() (64 bytes) and FPU state (512 bytes). - * It's unlikely that the assembly will touch more than 512 bytes. + * Most of the accesses are below 32 bytes. The exceptions so far are + * clwb() (64 bytes), FPU state (512 bytes) and chsc() (4096 bytes). */ - if (size > 512) { + if (size > 4096) { WARN_ONCE(1, "assembly store size too big: %ld\n", size); size = 8; } From patchwork Thu Jun 13 15:34:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697001 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 4D900C27C4F for ; Thu, 13 Jun 2024 15:40:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60A406B00AC; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 542A66B00AF; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25A8B6B00B2; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 041276B00AC for ; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B77701401F5 for ; Thu, 13 Jun 2024 15:39:56 +0000 (UTC) X-FDA: 82226275992.17.E0F52B3 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf28.hostedemail.com (Postfix) with ESMTP id 67916C001F for ; Thu, 13 Jun 2024 15:39:54 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=oo35mO8s; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf28.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293193; a=rsa-sha256; cv=none; b=r4fGiUD7XfiMXWRzLI0+Wk3GmNb9gGlZrv8b5LjoybEFv+1cKPmY8bOUR31GmokN0LXx37 1P6yFDnDJYQz57Prq1aH19k+QhkNsnaNQtDZjkrYCV2kLiTG9J+GaS2jyzYHsBd+/5Vx3v nC83bu4fj7m0/TvdqyIHX4Gvbo8wv+s= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=oo35mO8s; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf28.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718293193; 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=3hDUyT9rvjh/uqttZeOy24s2Df+NNUjOmmqDaE5+6Vk=; b=c1e9Jb8TtToo7ZzyzxuNlqcC2vqWtafL7dAOsuF29vTkRxMHoN50TX2W/IaRQESRwDUHoJ 7urbyicx4lkWv2auLL/ExmQKe0AJb16w6ZhvnQ4VJS55WmaKdZ7C8vaiO4SKeITxuh7I0D WrkMmdLmdnMQaNU1lZVulUufiJRVDGE= Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEp8mB000837; Thu, 13 Jun 2024 15:39:45 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=3hDUyT9rvjh/u qttZeOy24s2Df+NNUjOmmqDaE5+6Vk=; b=oo35mO8ssvN7YO060I591Spt+NCLM JxLupeTo19zW3D3ipzVJ20z/tPMBvRX+aXuYBKGnPXPArL5Vas8vaDyOIcIRMSlp N3CBKePxeBRpFlxvf4Ox5j4rM7wltI3Mdodr2wK80yUu2T420zum/dUHT39rr2Jl no3XsB9VRdG8XzCcYphTFeoDGMzae+wtRPIguoxBgWx2jdVzZJlJCrUJK0RAK7Co hFZc2Aud2b/jMGeygTOQnrko5+nlCo7C2geLMGVSVXgyB33Lf5Ua8semTr6QuDNR 713bmLVkKr3GbdSrNF8t8lg59qCKjkg73w+uV62qqOhtIWipy4dFK/Zxw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrext11p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:44 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdi5h029681; Thu, 13 Jun 2024 15:39:44 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrext11j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:44 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF1l4j003930; Thu, 13 Jun 2024 15:39:42 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn2mq916t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:42 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdahY56033716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:38 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB60A2004F; Thu, 13 Jun 2024 15:39:36 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 446BF2006A; Thu, 13 Jun 2024 15:39:36 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:36 +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 v4 07/35] kmsan: Remove a useless assignment from kmsan_vmap_pages_range_noflush() Date: Thu, 13 Jun 2024 17:34:09 +0200 Message-ID: <20240613153924.961511-8-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8E0Zbtz0t13y_6R44lPTfF_XRZ9IqBsC X-Proofpoint-ORIG-GUID: TKPnZMb8tT_RMAgqeLavlGAFctQInKt3 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 67916C001F X-Stat-Signature: saumgwuqai76gf5hxbutjkb1uzqgiqak X-Rspam-User: X-HE-Tag: 1718293194-97137 X-HE-Meta: U2FsdGVkX1+AnwOz5dyCezkvsg+LkYlAfa1zpS6mEysqDTySR9XnrykAPpixW6P2PLvrZLzLZ5GsUjbCX5QDUxtxFoBiabnDXNVeedHOJLUmbEXhUbqRQWbOOOBN3HS4zN2gJEl+/6+EmZs0cOzqCEsBwSX4ClUQh1Utzj9EhTFrh6q0NnSa5WA5bx5FfvhvrUEi1hzKiCLQIIvSCxACQumVCPEU+RM+36mJQC9qz6WmurlqF7kSmf/PoOZq9VClI5wrNw7OgPMNmM0Du40nmNuShQ1ZpAnw3NLV6Visa5A44GPkJQKhmhxoAHHixuEz10Iz4o4OprflPtbAjcphckvyQHHJ7nepvPcUaXG481HNqYr3ayDb1aoeg2lMf8AmdFSJW4s/iqq3ZPiB5v4Coyvez7ZZ8AjA3mx6ZFqGQ3iYR7KRQHsia4AofUiv3NBJrfpWZ8HnGRFLSJHvbqpAUhQz0NKq5VopDoOu+6X5GKXsb2bRnJxss3Z9jsNtMck/iogeM94wMGYfLdqIwN6VRQbIuPV3j7n+S5EjfgHYTyazL6dvsRlQsWAWvTzjMBwPJTaJqNiHNYuONT8grxOrO+P+0OjXfhebqAzw/q3uPkQ+JUdw10w29mjc2bnwnas/CJTUkhyC2P+8HKs3VrK0umH2o+pbVadWizw3Th4n8845Ym4cBFo0mxPhJEZOOTZHbb2whmq9AqQuVuAV0nSblMVB/TJEGW+N9BFLTbt5VARaID+fzXZZLuI6pVqntFlkYKTs08GKtZe5t+Xpz4lQ9ZOrnizOcbqKxJFecDVCxAtDM4GSf2ECTDCYtBHFC85yXcLoSMSAT8MfASO1Bem+VJOoyvrT242sd7iOQafpuem/gKyENY9wOcMDyyUyIE5fkiem95WVKFG+iuovZgUbKuIKnIT5rBOY8Sc/8mPfIl7TBye4UY1akVEs5JpENP2cvZYbyWi0qolf5N4RwfT hj4zsfDE h1Wn0qoUjAfjaY/S0TjSoJHozK1SQFPqN3RZysOdtH8vr9VqdekAUgUBjJzEvAh7IuRrO0Rus2ioPKW6z+SFvhQl7cN3YUJN7w9UtCE5JN1UnxiheTeq9igi9m7QUGRWqte1RQMFC+ZzlDO+yb6ZA2UW6k0FIrnM29zx5UU3eCdBp1SB6Yg90/aI2Yt5wd5hmhZeiNVw7NGth8wJt9E1Ob+Ku4/5Qw1EaxB2hfsILcEsc2kdFJPWo0N4S/BS9zcfAuIF/XRKYJbFu1lmKFdm3NyOWtxLgNByq54ou7V6hK8YaMYIxGQkz7OKeKeI8j2eiqCk2 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000068, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The value assigned to prot is immediately overwritten on the next line with PAGE_KERNEL. The right hand side of the assignment has no side-effects. Fixes: b073d7f8aee4 ("mm: kmsan: maintain KMSAN metadata for page operations") Suggested-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/shadow.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/kmsan/shadow.c b/mm/kmsan/shadow.c index b9d05aff313e..2d57408c78ae 100644 --- a/mm/kmsan/shadow.c +++ b/mm/kmsan/shadow.c @@ -243,7 +243,6 @@ int kmsan_vmap_pages_range_noflush(unsigned long start, unsigned long end, s_pages[i] = shadow_page_for(pages[i]); o_pages[i] = origin_page_for(pages[i]); } - prot = __pgprot(pgprot_val(prot) | _PAGE_NX); prot = PAGE_KERNEL; origin_start = vmalloc_meta((void *)start, KMSAN_META_ORIGIN); From patchwork Thu Jun 13 15:34:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13696998 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 D7E03C27C4F for ; Thu, 13 Jun 2024 15:40:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C23E66B00A8; Thu, 13 Jun 2024 11:39:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B86B66B00A9; Thu, 13 Jun 2024 11:39:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93A4B6B00AA; Thu, 13 Jun 2024 11:39:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 76B276B00A8 for ; Thu, 13 Jun 2024 11:39:55 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 390401C0348 for ; Thu, 13 Jun 2024 15:39:55 +0000 (UTC) X-FDA: 82226275950.19.0DF2A65 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf11.hostedemail.com (Postfix) with ESMTP id C84594000F for ; Thu, 13 Jun 2024 15:39:52 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=UBQFPbWH; spf=pass (imf11.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=1718293192; 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=YaTjcojmIIYPSV3AqgAoZ8tGeMyuD+KvoajbKIBgv5I=; b=Qk1Nh9VYH5mzhEAkrMGJyp9xn9jOTVRsqlbQdsrQSZxV9NqrhfweF8LjXhtf268NEtnfpB vJ4hmcBC0nAvm/+LTrkul51JzlNmw4LsI57RN4brKjzxQwy4GoiduqrBku2Y55PUpN9T9Z KhzVwQvuJpDYgMVKdErmU2Gwt68u7CY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293192; a=rsa-sha256; cv=none; b=PcyPYf0OWdtgunVcDzsMQjzyuxxoYzH6NncmhgYBkfXPnA/fWYom6Yrv9eIi71GjvQyyBT yVg3l6L9CwCLuN7y9NFJHZKsYLYRwhZ0kCeYBkUekYR3W7WpnAI2VrF7z8U8hblbcJewOO TPSsPKgTGbyuXn3ocf0ahfEdjCUtpSM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=UBQFPbWH; spf=pass (imf11.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 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 45DCR4OS031281; Thu, 13 Jun 2024 15:39:45 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=YaTjcojmIIYPS V3AqgAoZ8tGeMyuD+KvoajbKIBgv5I=; b=UBQFPbWH52wQgeblivmbAIG5/vj+n XOPZZsDy52b6UtIMUG4QvgiFPwNQIrlze3Kl01W8sCsZgP8XtongAQZ46/zlMEjL Tl/BERQRnRwvh/HbFxFr34Lh5HWfvX3XOZLYs0L5OP294po4HniG+vnBX1fgpwxq ThXwmB3Ha/5ygNikffkdZaC6mgj6OS9kxaycBeMxP7NC+Ppyi5rdEX5590uw1+O9 sBfdRaeiMRMDzxLn1lGnmIHchaHQ3hrAfF//NbPhYMQL4kGqPl7Btizwl4Q1AUtB zosD4gxL0/UOExpvSrPdjC4SDQjxw0HLUoiKa0kx5FO5QRzyTEv24yv1A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt36v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:45 +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 45DFdid5026772; Thu, 13 Jun 2024 15:39:44 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 3yqq4rt36q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:44 +0000 (GMT) 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 45DEqSGd027243; Thu, 13 Jun 2024 15:39:43 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn211979r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:43 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdbRo48890310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:39 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D82F2006A; Thu, 13 Jun 2024 15:39:37 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CE30720063; Thu, 13 Jun 2024 15:39:36 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:36 +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 v4 08/35] kmsan: Remove an x86-specific #include from kmsan.h Date: Thu, 13 Jun 2024 17:34:10 +0200 Message-ID: <20240613153924.961511-9-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: I6lUMZaRn-eKqMWngW5wl1DQIlqcnkRS X-Proofpoint-GUID: Punmgb6NwOmY9ZII4z-shjRaLe710KO- 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-13_08,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130109 X-Rspamd-Queue-Id: C84594000F X-Stat-Signature: nq47bfxunmzqfdeb73igjb1o7c34ryqy X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718293192-632176 X-HE-Meta: U2FsdGVkX1+n/xMOGbQCI/l76Py64fBNlmL3k1/k5vrByIHbmWiVDjYuEJOekbrP9D6+OeLzjOg3xq3AUtfWsVtdnfqFozFh5EiWeQ5FuFtz0K6qksT7QQs7defdZ1HPbnNeGKomcW2f9PfCfYotqDr+/lCY+A+qLOwgoqzIk9GPDOQWICAmBOrWnOiFrO/Whsheo5TIuf7xq6l2dDkgflPAL+bpuCDU1tJSmTvzHyqRqvvpTzFb5mNwNvEakY98f/6F/HEGZwLLwL88JasuzWeV3pJ1VqJ0uVx1iZtOzxNUPYDBbdWAdYdqiEa5XuAokABjCBpCyY4fc99Y7aRR3ubDme6TXtv7z+YVGb0oxnI0M4uBBKIDf4nVDw02rMpmOLzNrF93OMg0rBaCvKjRXKj7xZyY+TfTPZqdAdNAslqdo7EbYa1e/nn1Bzs8h+vvM0QFHePhcnT9ia3bo39E6/ZvZnH1XEAxe6Wd+TOUvTJ+e3vj0eeRtRwoy1X49LRd2xPdIeHZeYIePK+MthwZ7+5pkKunuEgUv8mNc74XLHfsvtR56njgfVDSkrwbYuzlSF9v+Z+pfPPi612HmzetvIeDG4OYEHQxcFWNsGfF2+e+WXIOLDGyeNuuRHNpnEMxO5F88u+sxVd0JMGpZ5H6mfmRSLs7OUXt35IaUh1N7TEmGxTZ4nAXLvmAnLICBlzSOqnkaOJWwoRW8jAWBu44UiP8cyfCRmXWSOVU8I3VaENjjgWsf3H4Cbj69E4PY04r+ADy3LUA5yeDrpunfHq47NF5/NTMVeMRWPREsAOOpl92/wxobvQ0+OAldEX2utdofhPWa0C634f6pr9ZeVeDkS3GrpwCILVD+K3dR9x510GhBml6Mf2wERj2bI/wGbe9bYztax1OP/99Z5cCHWzeL/euKy0MVw33/tJrVg7n+cdi+sOXcjJN63bktkZns58Xbn5UtyNfhxXJ0Dy8rKk xjxBy7hH eFh7hZa8GMCaD5UZ4SFIRwVi6owIOe7yB1e8aZF+sWYur2LI4qEirTK8w12GEUVEVzexcBrnmH9HEUahykaXYoPqGSxSdxQkm+R+ph4bSazqd1esFr3WoGWjnC9Sz/17tu2IAW+4dI70PXq1A55H9D2nGYNdTXWw/XJaoo8abJyhm0LK/ClA9agKOh+YhLCMEYUaS4EtqYxcTJD0hToQrrGEG17A5ztj3lDcUw/F+zSHWnlbirCHMz/ASM2e9EfN3jbm289nDv/wYWKOQJXdlO1FV8Q== 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: Replace the x86-specific asm/pgtable_64_types.h #include with the linux/pgtable.h one, which all architectures have. While at it, sort the headers alphabetically for the sake of consistency with other KMSAN code. Fixes: f80be4571b19 ("kmsan: add KMSAN runtime core") Suggested-by: Heiko Carstens Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/kmsan.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/kmsan/kmsan.h b/mm/kmsan/kmsan.h index a14744205435..adf443bcffe8 100644 --- a/mm/kmsan/kmsan.h +++ b/mm/kmsan/kmsan.h @@ -10,14 +10,14 @@ #ifndef __MM_KMSAN_KMSAN_H #define __MM_KMSAN_KMSAN_H -#include #include +#include +#include +#include +#include #include #include #include -#include -#include -#include #define KMSAN_ALLOCA_MAGIC_ORIGIN 0xabcd0100 #define KMSAN_CHAIN_MAGIC_ORIGIN 0xabcd0200 From patchwork Thu Jun 13 15:34:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13696999 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 6D51FC27C6E for ; Thu, 13 Jun 2024 15:40:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C98B16B00A9; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAE6F6B00AB; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A00006B00AD; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7E65F6B00A9 for ; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 461091C03F6 for ; Thu, 13 Jun 2024 15:39:56 +0000 (UTC) X-FDA: 82226275992.12.5CD8AB5 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf03.hostedemail.com (Postfix) with ESMTP id ED4D520011 for ; Thu, 13 Jun 2024 15:39:53 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=kpM3vAT4; spf=pass (imf03.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=1718293192; 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=7LzF+mdGOSfbikK0rRRb7FcZ7CcG1T7oFIQ1dXnxY58=; b=Zi8nfHUZYJuRMVWWz82/I6Dc5uaBnTVV1nGs4PIsuPkfqWMoegadLBzyGBCQmYi2q7/8jI KCwsMOg9KBDmeeFN61QnZSA9t9OyCJmyGMj1AxoZqO+bZM4R+spcNpu+XU3bVCZxAB2Lcy RvT4SiwqY2ZjU7qEJ0SkCSnod86u0SQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293192; a=rsa-sha256; cv=none; b=6Z0m+RNZRK+95+zvCSmQ+6jdaq+ZUHQXyRFtC0Ow7kit04gTFurkJbuivk2dxxzQ7OYffR xXbt5jTs4T81kSCPuWNBLRvFPe7MAMTv+sXKEqhJexRQKj2/W2JCdI7U+dFAvO7o9unY0k 89kbIZqdM4bQGhhBS1B6HBYcMBUWdmQ= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=kpM3vAT4; spf=pass (imf03.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 Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEKeSI029454; Thu, 13 Jun 2024 15:39:46 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=7LzF+mdGOSfbi kK0rRRb7FcZ7CcG1T7oFIQ1dXnxY58=; b=kpM3vAT4bXVDrS5mSI5qUEzmNa956 9k+Yox589t7V2hPwBLnONF8D10CIK+pniabCuvdUX46pzx7d5J1qKsIbzkdBsacT yrf28vfgieC/2sZF/9W+IR3s9Ptfyycs417HLnx5ZW13OsMIXkwJybkzF41rGeXE iNhY8Aw4o0fB3WJZ4N6T1QvcimrtsBO/VJ5sIwJ3QKExVhG0zBu2pQWjid72ikVA xTaO5gWwDWoFOxZ9NkaljOnIwTSXdsoySD9wqYToIFZkH+3IPCg7zqoH+W1IyFEa WdHsXdK4haZxflkHo3rGgG1iLQnkJ7hgzjUqsZSnNPsiWKsgsDzHFKo8A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqr0vsy4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:46 +0000 (GMT) Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdj3A023918; Thu, 13 Jun 2024 15:39:45 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqr0vsy4e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:45 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF7EKD020041; Thu, 13 Jun 2024 15:39:44 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn34nh0bq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:43 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdbKC56885574 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:40 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D2C5020043; Thu, 13 Jun 2024 15:39:37 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6087E2004D; Thu, 13 Jun 2024 15:39:37 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:37 +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 v4 09/35] kmsan: Expose kmsan_get_metadata() Date: Thu, 13 Jun 2024 17:34:11 +0200 Message-ID: <20240613153924.961511-10-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: DNHr_yy1T_Z01HP8UOfToGMrh2Q-YjYa X-Proofpoint-ORIG-GUID: _fT-888Ew5czqGiJ_jte1hCxiA1X8Tlx 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 bulkscore=0 impostorscore=0 mlxlogscore=877 priorityscore=1501 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Stat-Signature: ufk1yjtzythn151cri1b7gt7djunngbm X-Rspamd-Queue-Id: ED4D520011 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718293193-646335 X-HE-Meta: U2FsdGVkX181bqSukpAOkl/lH3JP2Cf8jejuC3q9gPKctiKiw0i1/p3PDHnlSP4CTTfJt6ZKO4RWcqhDQTobJ9DZHLB/Za0ewvaBpPjm8qTIg7/lhm7XIb4lwU6viPXbvheg9nAQImk1Q9F0uNxE9mIumknqYoShwtB9duEcrt1ixMFSAuM8q2eqWvw7fl6ffpxvK6DNuFO3apGAlKPQJWbjkNcHfXmU+RZCcLkI7rN17+Oxdk93Dr75zV5SowNbFWAscC+SJnZMHv5ml3ZMxe+oHy8fN7hpoXSkw8T4pE/XDBH6VJcjnufUmh9mezinLoUCePcQOa8kTw4e8ofZZx6dPDGe4xe9lkcffAlMyQSXcK4ezqWECFojXNN/63MjvhR+IxVUhz58ZrO1TZQuD27eRe9UYpq/yBcETzss6ljNNac1nR4uyWVt1tXTpYH3QB9XyL+eoVjMTA1d6694SJs7Yb0Q0TLppJnX0oRNdeSQCZfplaPAoKgY4/pIQqNkPKL1Iwt9INRwrrADMnucqQ/Jpt/moqqxxgKkhGOYrK7Iujfir+x13j3Owl9fa+/EHOFKdVndydIyRnosLi5na6ogeLoI25kWkBFb9H5iVhsUqCOBUHHtqf1o5SJwvllHFrDK8RWLRSk9FAEu/FeJfqW411GsLnlfhwvAD5/+zD5HJbWjxuzkA/r/ws+GcAz6MSuXnfL48nHtKLFpCc8MVq5A8/1Jxggk5qFGv6vRlIVuIjdj0waUE8FnZENGYkawVmLxExwAjlJoO7P83zzhliLCWiWZsieHcC14wfc0+RS6qKcBu5tCZ78xXUo00CbjwfDmOFjGUWLAZZJEhCLlH9OGTtdnK0urynWlAxE4oiNY34wl5uII6EzIRVxQmdWBzBWyMnW22ySGijya5SKelid0TqMy8pruLipq7kOMjUgEzP4yIxEj20M1bwPlXqfD8VMVjg2ux85xFGEp90Y AM1hjUPo N3/RaFJKWYIofAeqU11kCn7XE1Q032TzjgnCk2PGMqUV/Ps0vFzCj/32V5TBSaP+TaYD5pfXNS3ANtNHT2jRRLdnOdo9fLEDXpfHteveyfs2ln53mzeErVPfOlLtzjwDo1SkQvnh0egB98fbKZhtk8cN99R09AEw/bFzlKYgI8xnfMNpFgvrQdN4PFCP+Pi8lgWZhHUXRNbH+93bCvfW9KcSVmlTFja5+gT2Z7OU/uuBEOcdA6bg/tIXIQ949kx/upKBttgTBIQNInA0Kl5EbFJaRpqrtb7LYz+XQoXBOn3cFZkPtAfTzJq8slBdOjFEez3tlCwVFUi1PaLA= 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: Each s390 CPU has lowcore pages associated with it. Each CPU sees its own lowcore at virtual address 0 through a hardware mechanism called prefixing. Additionally, all lowcores are mapped to non-0 virtual addresses stored in the lowcore_ptr[] array. When lowcore is accessed through virtual address 0, one needs to resolve metadata for lowcore_ptr[raw_smp_processor_id()]. Expose kmsan_get_metadata() to make it possible to do this from the arch code. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- include/linux/kmsan.h | 9 +++++++++ mm/kmsan/instrumentation.c | 1 + mm/kmsan/kmsan.h | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/linux/kmsan.h b/include/linux/kmsan.h index e0c23a32cdf0..fe6c2212bdb1 100644 --- a/include/linux/kmsan.h +++ b/include/linux/kmsan.h @@ -230,6 +230,15 @@ void kmsan_handle_urb(const struct urb *urb, bool is_out); */ void kmsan_unpoison_entry_regs(const struct pt_regs *regs); +/** + * kmsan_get_metadata() - Return a pointer to KMSAN shadow or origins. + * @addr: kernel address. + * @is_origin: whether to return origins or shadow. + * + * Return NULL if metadata cannot be found. + */ +void *kmsan_get_metadata(void *addr, bool is_origin); + #else static inline void kmsan_init_shadow(void) diff --git a/mm/kmsan/instrumentation.c b/mm/kmsan/instrumentation.c index 8a1bbbc723ab..94b49fac9d8b 100644 --- a/mm/kmsan/instrumentation.c +++ b/mm/kmsan/instrumentation.c @@ -14,6 +14,7 @@ #include "kmsan.h" #include +#include #include #include #include diff --git a/mm/kmsan/kmsan.h b/mm/kmsan/kmsan.h index adf443bcffe8..34b83c301d57 100644 --- a/mm/kmsan/kmsan.h +++ b/mm/kmsan/kmsan.h @@ -66,7 +66,6 @@ struct shadow_origin_ptr { struct shadow_origin_ptr kmsan_get_shadow_origin_ptr(void *addr, u64 size, bool store); -void *kmsan_get_metadata(void *addr, bool is_origin); void __init kmsan_init_alloc_meta_for_range(void *start, void *end); enum kmsan_bug_reason { From patchwork Thu Jun 13 15:34:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697000 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 4A589C27C4F for ; Thu, 13 Jun 2024 15:40:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3A966B00AB; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E39AA6B00B0; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC3746B00AC; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 871826B00AB for ; Thu, 13 Jun 2024 11:39:56 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3745312021D for ; Thu, 13 Jun 2024 15:39:56 +0000 (UTC) X-FDA: 82226275992.11.53FE9B3 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf30.hostedemail.com (Postfix) with ESMTP id 10A8580003 for ; Thu, 13 Jun 2024 15:39:53 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=qK+vecRb; spf=pass (imf30.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=1718293193; 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=EtpzWUsKPF6Xqg09UGXz7IHFcSozBdT63cYyYIkbG/E=; b=BzS030IsVPrIuvlCpwzldCyVWlAzMB80n2n+27WPCwc9KmFqwnc91cclmL5SkrDFvBgwSr JYzaCcCy07PAeia5F/sSV6L6USKG37RkkCqXLzEnAWkioaW4jl6AQIEPd411HprSr1D5cv ZFTfJyovCHxgoapvBqlZDb0RBKYszGw= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=qK+vecRb; spf=pass (imf30.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=1718293193; a=rsa-sha256; cv=none; b=Py69v4nV/q5ks/ck98Z68mctnLE6z81GwvR4kn6CZvRKUtZiArcrH+aco5WutOTeQKRs6w qdTrb/9zlL9A7iVJ3uyqbbkBbcMn7FpgxTXu6P48PbxFjLf7dhnE5Twce4zibGvn6bTcm4 VZmsAnjc0PORIrQPBY+VAlkO87p/ulc= Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DFaxh5028926; Thu, 13 Jun 2024 15:39:46 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=EtpzWUsKPF6Xq g09UGXz7IHFcSozBdT63cYyYIkbG/E=; b=qK+vecRbYYzCJkRsHBWubrva3REep w/L05qAPzmCKy04ck7vhAnXHPdQL7ZgY4AB0/HwhxaazpXScZzYfEI7dT2/HXWEQ sK6/3glkhSZDbHnN3sJeK1GUk6U8wd3J5meIeDstRJEMRWqT7aHpxfePPMVFag4G wT4UdP62uM8MtrSW2QWQa09IjK1EVvq3NzwKhJ+N3BQxJpkT9oBvYST3Ljo/8G7X LSyp1nWkVWc7Ywi81lW8IyUbgTH6UASVaM1n9CfRpdAUt0SefudhICkZlF1fUC63 gCQ2yuJj8651Sly70S2kImGowL4ZHICA2AxR/mgD8iysnBsEdRexIi7bA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr320r32t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:46 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdjpx002434; Thu, 13 Jun 2024 15:39:45 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr320r32q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:45 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEU7Sm008700; Thu, 13 Jun 2024 15:39:44 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn4b3rk0u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:44 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFddjr52036052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:41 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB49C2005A; Thu, 13 Jun 2024 15:39:38 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 783B82006C; Thu, 13 Jun 2024 15:39:38 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:38 +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 v4 11/35] kmsan: Allow disabling KMSAN checks for the current task Date: Thu, 13 Jun 2024 17:34:13 +0200 Message-ID: <20240613153924.961511-12-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LKpz0MVqEHZkt6RKhjF39DHCXdemLjnE X-Proofpoint-ORIG-GUID: 4diWKsJb6QpzSM8Rww7A3YFM9_vI0f-x 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 10A8580003 X-Stat-Signature: puqswqeoy4mehscc8onfps4f9utoqp9s X-HE-Tag: 1718293193-235186 X-HE-Meta: U2FsdGVkX1+x2WwHsVraqXHhaHdJre6I339qmIEJcawAvom6s2O0/FJWya76vRFzf/WfyQ24vHpWPzmAUbyjHMn0lGrDA59HmKTjKrBCgAx3x1+dnEB32fGsta4mV9PJjd+OjTmfiIM+V74twSiBelKjxJu/WsnVVMPiDT2cjLeZExSZZQq4gD7FlXv4RyIY8hw8oqUlrBW1ekUafcwGNoziDcOLMECTCWHzLTUbzM0/sWQ9g5myS2RicOu0YWagO8lvdZRFKgtJreb6OnM8x6dLfscVxfLII3pxrpl5bRliw9tdk1qYd9UXEZMDmCZLCm8ewAhOncIgrsHjn11V8NM/nH7mlFtSkYzdXG1LIxUN9WqtE5PuInrbCeqLWh41qBqfFKUQ4c5MHAZUymiUn9+0vW7QlMHJk4GeizI0t7ygxZfAnw1cAAL9n2uK8ehIOtxj2zhNSLLaCus5F2o7F3IERAhKMxPoAO/oJjZAnY9t/teU+njcisHsAX1dwu0lnA82DiVT63Sk+M6nyceJ9qg//nvhyZ6HB8yJbSeYe4d/5viom1eOk3X9HDcP53H62jh2cdx5X4nTQlt86A6MyUgrF6r68j5sjdcHhZVgzsvdF61xVAm0+3D2yC7S8T0eL9/nmfKEEuNNNpSGzy0axWr+PMeLHGUVTDOG7saS+bL37DB1G0lWET9UEiHrxCg1oUzRndwXRMRPZSL5wSxseJLbTaSPeFO+CZIMP2IXaDWI02QgqtB0cpV9y7Xo00Kr/vLp1pHPQEzikm6Edl4evYs2xkk4h5n1yv9V0T78hA/FFUWN/Xb4FbDf7/OH+DRp5ghL7PlrGBSP8TnbIEg35bDHXuAYbfA72zYB6W4SrPB/6z2QaSVjRGFhb7t1InRzFmVqMKDUfuayMlRXUIwNYnw+P6oF/XDzxrpuw0I4zPw463G/zSlVLDq6kZc4l1UZmuHkD0QkmQzq3ideAlz kl3gwgw2 uG/ONZh0mCrPlP89/eW0FRDAAl10zttEVBEGzkP0s6w0x6Tdwj9EhGRqrv2UFTMah1rdEnps2ZltkqsRV9Qz2brAET1a1tPkvfpDZgiQ4BhFogiTs7OhTrszxZQ5V7f7yWgsNem7sonqSiiOzs5z4QrRNbJm+U48DGnivCE0WJHub9PRvBRsprOhzp+Sfxgwq4ijFSm77oqwe2x0vgI3TNOdQPC/zcHeyc9R8XOYLPmT+JxPokhs6rMiaYvqjNtu6K8yk+7EiYoCqDv/WDzCtLnD5ZjzfC4RScyxA2kD/zSMMwUD6DpoLxePPaw== 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: Like for KASAN, it's useful to temporarily disable KMSAN checks around, e.g., redzone accesses. Introduce kmsan_disable_current() and kmsan_enable_current(), which are similar to their KASAN counterparts. Make them reentrant in order to handle memory allocations in interrupt context. Repurpose the allow_reporting field for this. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- Documentation/dev-tools/kmsan.rst | 4 ++-- include/linux/kmsan.h | 24 ++++++++++++++++++++++++ include/linux/kmsan_types.h | 2 +- mm/kmsan/core.c | 1 - mm/kmsan/hooks.c | 18 +++++++++++++++--- mm/kmsan/report.c | 7 ++++--- tools/objtool/check.c | 2 ++ 7 files changed, 48 insertions(+), 10 deletions(-) diff --git a/Documentation/dev-tools/kmsan.rst b/Documentation/dev-tools/kmsan.rst index 323eedad53cd..022a823f5f1b 100644 --- a/Documentation/dev-tools/kmsan.rst +++ b/Documentation/dev-tools/kmsan.rst @@ -338,11 +338,11 @@ Per-task KMSAN state ~~~~~~~~~~~~~~~~~~~~ Every task_struct has an associated KMSAN task state that holds the KMSAN -context (see above) and a per-task flag disallowing KMSAN reports:: +context (see above) and a per-task counter disallowing KMSAN reports:: struct kmsan_context { ... - bool allow_reporting; + unsigned int depth; struct kmsan_context_state cstate; ... } diff --git a/include/linux/kmsan.h b/include/linux/kmsan.h index fe6c2212bdb1..23de1b3d6aee 100644 --- a/include/linux/kmsan.h +++ b/include/linux/kmsan.h @@ -239,6 +239,22 @@ void kmsan_unpoison_entry_regs(const struct pt_regs *regs); */ void *kmsan_get_metadata(void *addr, bool is_origin); +/* + * kmsan_enable_current(): Enable KMSAN for the current task. + * + * Each kmsan_enable_current() current call must be preceded by a + * kmsan_disable_current() call. These call pairs may be nested. + */ +void kmsan_enable_current(void); + +/* + * kmsan_disable_current(): Disable KMSAN for the current task. + * + * Each kmsan_disable_current() current call must be followed by a + * kmsan_enable_current() call. These call pairs may be nested. + */ +void kmsan_disable_current(void); + #else static inline void kmsan_init_shadow(void) @@ -338,6 +354,14 @@ static inline void kmsan_unpoison_entry_regs(const struct pt_regs *regs) { } +static inline void kmsan_enable_current(void) +{ +} + +static inline void kmsan_disable_current(void) +{ +} + #endif #endif /* _LINUX_KMSAN_H */ diff --git a/include/linux/kmsan_types.h b/include/linux/kmsan_types.h index 929287981afe..dfc59918b3c0 100644 --- a/include/linux/kmsan_types.h +++ b/include/linux/kmsan_types.h @@ -31,7 +31,7 @@ struct kmsan_context_state { struct kmsan_ctx { struct kmsan_context_state cstate; int kmsan_in_runtime; - bool allow_reporting; + unsigned int depth; }; #endif /* _LINUX_KMSAN_TYPES_H */ diff --git a/mm/kmsan/core.c b/mm/kmsan/core.c index 95f859e38c53..81b22220711a 100644 --- a/mm/kmsan/core.c +++ b/mm/kmsan/core.c @@ -43,7 +43,6 @@ void kmsan_internal_task_create(struct task_struct *task) struct thread_info *info = current_thread_info(); __memset(ctx, 0, sizeof(*ctx)); - ctx->allow_reporting = true; kmsan_internal_unpoison_memory(info, sizeof(*info), false); } diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index b408714f9ba3..267d0afa2e8b 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -39,12 +39,10 @@ void kmsan_task_create(struct task_struct *task) void kmsan_task_exit(struct task_struct *task) { - struct kmsan_ctx *ctx = &task->kmsan_ctx; - if (!kmsan_enabled || kmsan_in_runtime()) return; - ctx->allow_reporting = false; + kmsan_disable_current(); } void kmsan_slab_alloc(struct kmem_cache *s, void *object, gfp_t flags) @@ -424,3 +422,17 @@ void kmsan_check_memory(const void *addr, size_t size) REASON_ANY); } EXPORT_SYMBOL(kmsan_check_memory); + +void kmsan_enable_current(void) +{ + KMSAN_WARN_ON(current->kmsan_ctx.depth == 0); + current->kmsan_ctx.depth--; +} +EXPORT_SYMBOL(kmsan_enable_current); + +void kmsan_disable_current(void) +{ + current->kmsan_ctx.depth++; + KMSAN_WARN_ON(current->kmsan_ctx.depth == 0); +} +EXPORT_SYMBOL(kmsan_disable_current); diff --git a/mm/kmsan/report.c b/mm/kmsan/report.c index c79d3b0d2d0d..92e73ec61435 100644 --- a/mm/kmsan/report.c +++ b/mm/kmsan/report.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -158,12 +159,12 @@ void kmsan_report(depot_stack_handle_t origin, void *address, int size, if (!kmsan_enabled) return; - if (!current->kmsan_ctx.allow_reporting) + if (current->kmsan_ctx.depth) return; if (!origin) return; - current->kmsan_ctx.allow_reporting = false; + kmsan_disable_current(); ua_flags = user_access_save(); raw_spin_lock(&kmsan_report_lock); pr_err("=====================================================\n"); @@ -216,5 +217,5 @@ void kmsan_report(depot_stack_handle_t origin, void *address, int size, if (panic_on_kmsan) panic("kmsan.panic set ...\n"); user_access_restore(ua_flags); - current->kmsan_ctx.allow_reporting = true; + kmsan_enable_current(); } diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 0a33d9195b7a..01237d167223 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1202,6 +1202,8 @@ static const char *uaccess_safe_builtin[] = { "__sanitizer_cov_trace_switch", /* KMSAN */ "kmsan_copy_to_user", + "kmsan_disable_current", + "kmsan_enable_current", "kmsan_report", "kmsan_unpoison_entry_regs", "kmsan_unpoison_memory", From patchwork Thu Jun 13 15:34:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697003 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 8538FC27C4F for ; Thu, 13 Jun 2024 15:40:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0A856B00B0; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EBC4B6B00B1; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C97236B00B2; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A58766B00B0 for ; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 65C771401F5 for ; Thu, 13 Jun 2024 15:39:57 +0000 (UTC) X-FDA: 82226276034.25.B011C30 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf03.hostedemail.com (Postfix) with ESMTP id 2722720008 for ; Thu, 13 Jun 2024 15:39:54 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=VORhykUz; spf=pass (imf03.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=1718293194; 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=/gY59diCnvafEB+4mQiN4AxCmJVF2c9HWCLDsUZw+Ho=; b=cdyi+mFnOZiz8/E448nH21Aad98CrB/GsB8JsA4vAGKn0Wu5z4feytIA/nH3JC6Ckz0xIn YCVTSWZ9ie9CQWjeHKyAXXwN4XGNqc/Pqzp8SDpHG7wfdj6IsOzuWYwzaeaNkfTjIxkgnC xyfm92j/Odsw7Q8/V/5deUKd858z9jI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293194; a=rsa-sha256; cv=none; b=rljiebgDmyvzAxm6zeguG79Kyd/XUA0pcgW/1NLcpl80C2MYcJ/MS2MkQ6zH7Qp9lf1tHS it2fAWqzEXHrxxamp9RRFkidRIwHDnu3PWmVvZxlXTaDh57GGzaePR0vGHDs3NfAZ1Wzpd 3RS6+qcDY9cuDadsOxHkuL5+xFRxGVs= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=VORhykUz; spf=pass (imf03.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 Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEMmKu009466; Thu, 13 Jun 2024 15:39:47 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=/gY59diCnvafE B+4mQiN4AxCmJVF2c9HWCLDsUZw+Ho=; b=VORhykUzQX07l22DxUNjzV7kQCcYh 7XxHs+Bps15m/3JBqePHkv3myq1XbKPZDKvC0FURk9yD/cR6iwe+1KOLSJj7EDqg quf/XqRbNm9Th+zGbk+uuhGQUaDZWSE2LYJAton/eF/dkq62fn0xjoQ/H7xG5rzx V0xS+gqlQXA/rJncbBaJ0ShISo1TnAfKhNrlvp9lSRSTEXgWomF18OJqzRXoDng2 NHEdQFOurXW/cZ6DMBn7PJzt5ky/1UT290NrJ2Zd9MIHLwGbK/0rFkYHu5HcZvBh PpRd788nlZdHsBOWYK9VPBgFfH0SQ97SovcNENgJ2JmvNSWelGZBuardw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr28g8buw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:46 +0000 (GMT) Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdkhn032507; Thu, 13 Jun 2024 15:39:46 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr28g8but-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:46 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF54o7020086; Thu, 13 Jun 2024 15:39:45 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn34nh0bu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:45 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdduK48365846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:41 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C5972004E; Thu, 13 Jun 2024 15:39:39 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09E292006E; Thu, 13 Jun 2024 15:39:39 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:38 +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 v4 12/35] kmsan: Support SLAB_POISON Date: Thu, 13 Jun 2024 17:34:14 +0200 Message-ID: <20240613153924.961511-13-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: d5DLJuwF3n7IYysGR2MUKcLztsyMiSDS X-Proofpoint-ORIG-GUID: gIfaDqrA226oT8V3lIkGJ1p31k8efaLW 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 phishscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Queue-Id: 2722720008 X-Stat-Signature: xieukkmbngjnwedrb641c3bdgo5pshub X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718293194-966474 X-HE-Meta: U2FsdGVkX19jko7xGKDm1G7FMqE3be8FJWULlhgGQOdQEL0xocgqEqchxejlM7pzZTMYx0vHCyGS7KtNnahANOGp+9gcm+Z79tQ1njZRyG+7tGUmiRxCpf8iWLDk0wNPWrvYPS1yc4+rQHZCjcOfvRNzDpAdJ35B0AAjJIRPWZdFSNVumRLMihXx/Cbmb8130YEawPFgO1MqUygBoo9GFj9P3h8Gk60bqDDR3Ex6VxA5Jeskjltu/9mHa0iAeE+I/AelSqhQggRLTZY6zRp9rwHJ4kfl36jzrcEoEG1nxg1t04VoQk5dFfz2njh3HO3HFHec9fD9P4UNeKa1ZW9VD2J/c3zkbYQ/DprOEezQvRGG1d7Ggdy9qPDKmeBZrHtlDHa7fgB6qkL+McETNNjzc0dnUWHXLGXN20WKpxmuPEharJanEd+gVtYV1+5MackpCvySLkoLcG2f+44r0sBW5jUzl80mqGkOEK1URj7GdWOOJ5yqkGy9FZVoepv5Q9dvLrKMqpigJq4Yu8KD9YugIv2ZaD7K1Rbkt06teuGu0SK9kRmo8hhEhNTelUjWljNPlMQQGRi7YKtBrQPItsvoDlUysL5XQYjvqbA2ioCEpFbp9irO0l8WwTp3iXi9PcUQbagYbJ1MfdHHGM9cKpKvmT1qCbtE8CNdp6D94lH5w/eN7kmdIfs/iZ8qTog4ja6xmRDM+CROhMRJWLgrvCJwqoSAcXml7HD2WOK2qFOqhpdu/eY6Chu4VS3AjsmfZEx2QqBrYEP2nyYwpwaJ/0mpU2EiIu8QHVod4yCjejfcTOKHW9nKPGjHCsBUNBW2CslTnC7j8ZSIRvhbS7BQdVmpzMak0dUMMGaMVggxP6wRxCM30+scEMHrPW8lOR6XnsnxkKONsjg8trSEuLVQlp82Vfif4ajobtnrLMHCJneWmRxGgMUSdm8+KqMNJpL8iyYnynjVdxyQaX8ePuWAazw Qz6hkOg4 wsbVBdSUB9d0NaHL6cJcNY5Ry7JZSV07V9/O2RaP/xXQd9noY2bhyXknAQ82+hWOHmp+Fd8s9S6q1oxossbX2swYIPHVSsnrFIf2bmAA43+UWcQL99YztycGkssMWREnqduBXEqDc6Mxx3Sqe+NalelRKg5HRsHoz9WuHj/A/BL9miuRALjrqfzJN9FdRuWJa3R6esP77ID+Ucx9sEGn3qxTcXz8DFJoFCcM+/UwVwQoeqR1Sa9g0fQAUuyOap72BS8koCnKizeN7o/LAa/pUyH7N2zDT1GKjhUBNInbBqPMRRaM= 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: 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 by using __memset(). There are two alternatives to this approach. First, init_object() can be marked with __no_sanitize_memory. This annotation should be used with great care, because it drops all instrumentation from the function, and any shadow writes will be lost. Even though this is not a concern with the current init_object() implementation, this may change in the future. Second, kmsan_poison_memory() calls may be added after memset() calls. The downside is that init_object() is called from free_debug_processing(), in which case poisoning will erase the distinction between simply uninitialized memory and UAF. Signed-off-by: Ilya Leoshkevich --- mm/kmsan/hooks.c | 2 +- mm/slub.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index 267d0afa2e8b..26d86dfdc819 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -74,7 +74,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 1373ac365a46..4dd55cabe701 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1139,7 +1139,12 @@ static void init_object(struct kmem_cache *s, void *object, u8 val) unsigned int poison_size = s->object_size; if (s->flags & SLAB_RED_ZONE) { - memset(p - s->red_left_pad, val, s->red_left_pad); + /* + * Use __memset() here and below in order to avoid overwriting + * the KMSAN shadow. Keeping the shadow makes it possible to + * distinguish uninit-value from use-after-free. + */ + __memset(p - s->red_left_pad, val, s->red_left_pad); if (slub_debug_orig_size(s) && val == SLUB_RED_ACTIVE) { /* @@ -1152,12 +1157,12 @@ static void init_object(struct kmem_cache *s, void *object, u8 val) } if (s->flags & __OBJECT_POISON) { - memset(p, POISON_FREE, poison_size - 1); - p[poison_size - 1] = POISON_END; + __memset(p, POISON_FREE, poison_size - 1); + __memset(p + poison_size - 1, POISON_END, 1); } if (s->flags & SLAB_RED_ZONE) - memset(p + poison_size, val, s->inuse - poison_size); + __memset(p + poison_size, val, s->inuse - poison_size); } static void restore_bytes(struct kmem_cache *s, char *message, u8 data, From patchwork Thu Jun 13 15:34:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697004 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 93D5BC27C6E for ; Thu, 13 Jun 2024 15:40:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 806676B00B1; Thu, 13 Jun 2024 11:39:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B3DB6B00B2; Thu, 13 Jun 2024 11:39:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62EA56B00B3; Thu, 13 Jun 2024 11:39:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3F1B66B00B1 for ; Thu, 13 Jun 2024 11:39:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 00A12C0184 for ; Thu, 13 Jun 2024 15:39:57 +0000 (UTC) X-FDA: 82226276076.09.E8B0C4F Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf27.hostedemail.com (Postfix) with ESMTP id B72F84001C for ; Thu, 13 Jun 2024 15:39:55 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=cWyIHDq1; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf27.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718293194; 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=fhyNLk4BgDYNJAsfSc8ftWCxz9OlL/4RiKPE6HJFalY=; b=iYnqRuLg7STuJsq7bNVY3tUiXtzJNjicSyfYaWTfygUW2Kjb7yG2ym5F65KDHvAnUJvfA9 qAs46uo2SWR8nvG+TXMkYiF84+4BJ3Q+BRBNZY3isYPSGIigN0C7HJ80cQc5sqKzhy0bGJ ZB3hAbMiUOD272cMxjSEcWCIcIEMLXM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293194; a=rsa-sha256; cv=none; b=69il4tEeWHMRsvEmXMbI8/yybG3aaTym/c69wtIiclJMEg/7rBoHtHoczNutK/1nlnoSP7 e44w+W/drA7DSmW2KnOm75lblGnkavUnCSYNND6wXAODxq8eDYXVINZW+tNytpQtD3m+uR Xr0/2bhOnnncHZws2bwrshXrM/TnkYg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=cWyIHDq1; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf27.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DFRdFr006553; Thu, 13 Jun 2024 15:39:49 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=fhyNLk4BgDYNJ AsfSc8ftWCxz9OlL/4RiKPE6HJFalY=; b=cWyIHDq1RAItpr8T2Zral2xZSc0zm jtsseHWF19RO2x3PrSFtVLi8ZXut+8Dmv3tmY20C8zxzLD+JML9M9wLW2vxdbEsa 50u3Lc7QsgF0q4fMEos0LVe8HD1Ib0l+tc5VPBRPrRx+yTu2XbNpbssvbSksB2Ei 6KlylZq3vo1AcWAlcRtK429x8SS3ue+WWXN+ZRKReTxP0iYS27kJymM6d2F/nquD yOMiy+y8vyEnh+jxqbxM+/2rbS7GzfrdGgo8dNsy9LAIqNO2vqQ3VWY4k4/QGA9P 5XEniWJ85wtYe/bLQZIAPuXhCJes6aI/FD6qqgYy7J6YTSPkltobxKhMw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrext122-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:48 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFbRBs026015; Thu, 13 Jun 2024 15:39:47 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrext11v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:47 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF1n5T003878; Thu, 13 Jun 2024 15:39:46 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn2mq9174-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:46 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdegR28836448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:42 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0DD092006A; Thu, 13 Jun 2024 15:39:40 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F70720065; Thu, 13 Jun 2024 15:39:39 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39: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 v4 13/35] kmsan: Use ALIGN_DOWN() in kmsan_get_metadata() Date: Thu, 13 Jun 2024 17:34:15 +0200 Message-ID: <20240613153924.961511-14-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VR4XIXc8lKCWS8yjNDEOiQ51qu6t9VNR X-Proofpoint-ORIG-GUID: k0noGJyAWC71kZXWZHDEVVjEwOhT6Aub 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B72F84001C X-Stat-Signature: pdwtgtrae7cmsgpg45cszckof915td3s X-Rspam-User: X-HE-Tag: 1718293195-408685 X-HE-Meta: U2FsdGVkX191nUSU3+LP4kxaoNvJDsBHMPJ7DeN3cdVND5/2MytYzs8Cg7/VEVPubwa96QuwYa+B+s8Pv/+A7CdP4zg21Pcig8tyWAD1Z8HVy4mymkbAwLzKctZMSfScwylBxwFsKxz2pmlkqNd+rJJblZRmOAlRhQaP66kpnVN4aRNInwP1ktFrh+YTtVIbI8RiwnClJTnAavTmBGWgH58C04qsdb000ZPGtPyPAPjQZIBVAP3LVhiuwoB9jdWS5+nOktg0eBPlH/y8opHQr7HGYQY8rARegcPf22cfF/soWfFUzw/7SKS69Ur2zUcA1m81cz5jgG2mlhlnnVHDry47b9s275Ti/YoRZI6r/OaeUqCa8WrHQ6tFLU1E6OXkDQpI4o4anWqM27MBigmkkE/BDWDkya8HwcL/rOsuogRxmT6Y1DzMGtk8jPWQR2bF4ukdgcZuQdWCn55Q2hSV5tnqvwDtsA27c7QHl5/+sOEfM0X1a8fJHJF9IJhygnO7mpW1u1a/Q0prPkPp8rGC2PwBjkzoUwXW7YgAj9mMT0xHTCsURI3eTLEBAl1gMG2XHLMt349Aw8LcBs/82xEZFGlubzIlcgBdIeNs3DWqtSmBYQY36EmIfPyVpk2cutVyXJdi/GsYmbLZmWGu+2epRCI1blp5CxWzrwE7N4XjWSRuYzlbZRFK9r3lcBfkwnS8+388Fi4COOXuS+4MDO/jbJgYlHdWrtQkQlnPqeuO6DPpKvqzRhqtTirRdTgix6cRnDyJ6j0z/Y16QAVXkcnhT2KMovnuk9czpKOKye+qD1JkY0Km2++ZQUr8tEDr8bWYWL+3C9gY97FSbVz9dbMkXRBjDvUwTUzNjD/GyTqwcaxUbIU1oLA+EF6CkukZYYZE+nfs+GF+eDptsmYc7Zq9g3bOC4DciHQKQzwXd3V8c3eIArM078Kq23S9IRugwGK0KTyLJi7KkhAgTD6BxkL D70m9zDh eG5p+i21gs9C+DFunhnRKxAcFNy60TddRFhwsePytCuFbsjxcMIl8sM9AFw3WjkqFCNUFXasXZR89X1zwnH7RvwRz1fkEO8iD9kv9JD3VpTk/klAFt6He25FsXq4wQRTG2A43L3YswVOe8DqDxOOb27WnirbyOyR0TuVt+R8DHiMQej+N68anzyjhqfL7kUiJjBp8LnyqTxAev81i1AdjhKXuUOeoECqn9AXkBXcslw/9Y/oqCyFqg7Vgmtv+zl5LTFXz/Y/P4mMJojB5/uAFRuM1+f3bzJqbllGr X-Bogosity: Ham, tests=bogofilter, spamicity=0.000010, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Improve the readability by replacing the custom aligning logic with ALIGN_DOWN(). Unlike other places where a similar sequence is used, there is no size parameter that needs to be adjusted, so the standard macro fits. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/shadow.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/kmsan/shadow.c b/mm/kmsan/shadow.c index 2d57408c78ae..9c58f081d84f 100644 --- a/mm/kmsan/shadow.c +++ b/mm/kmsan/shadow.c @@ -123,14 +123,12 @@ struct shadow_origin_ptr kmsan_get_shadow_origin_ptr(void *address, u64 size, */ void *kmsan_get_metadata(void *address, bool is_origin) { - u64 addr = (u64)address, pad, off; + u64 addr = (u64)address, off; struct page *page; void *ret; - if (is_origin && !IS_ALIGNED(addr, KMSAN_ORIGIN_SIZE)) { - pad = addr % KMSAN_ORIGIN_SIZE; - addr -= pad; - } + if (is_origin) + addr = ALIGN_DOWN(addr, KMSAN_ORIGIN_SIZE); address = (void *)addr; if (kmsan_internal_is_vmalloc_addr(address) || kmsan_internal_is_module_addr(address)) From patchwork Thu Jun 13 15:34:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697002 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 206A3C27C4F for ; Thu, 13 Jun 2024 15:40:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 88CC76B00AF; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B4FA6B00B2; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A78F6B00B0; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 189626B00AF for ; Thu, 13 Jun 2024 11:39:57 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BC3D9160195 for ; Thu, 13 Jun 2024 15:39:56 +0000 (UTC) X-FDA: 82226275992.16.4F7D3FB Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf14.hostedemail.com (Postfix) with ESMTP id 81015100020 for ; Thu, 13 Jun 2024 15:39:54 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=C9B3gD6x; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf14.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293193; a=rsa-sha256; cv=none; b=UhMyY+2vjr6JIPN7cWFp/VTqu3DTOvipOnp5quD+5Lk8+UF1JewB05aqOsQOOvhRTjmLgC +1BmAXXgdXzu7x0q2Hj/QX/5Enu2EPHmHymmXfGxrCIqGGAtaOoqTBuJL9UUJthGordzY6 TGseGvWYPGj/uojc9BKrioaecwyD1T0= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=C9B3gD6x; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf14.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718293193; 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=CQQ3u2h7dcFLBX9YiN0MD8i5Yqiqh3Ez2ST5U0/0yhw=; b=i3cNwI9BwEeO4YjtfCreGEozvrAtHyCee49aJxyubtYwpxHNTmx9ChXDL7FET5cH+arJ4L GYaon6E5cHhJhssa3pw6y9sS8Es27nNxYv5phs8avm+RL3Cr0OeBIBU8jrTlTpzAhYJnqJ xrpo3fa3uMs5beH6Arzhj9s1sduQSnw= 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 45DES86s002416; Thu, 13 Jun 2024 15:39: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=CQQ3u2h7dcFLB X9YiN0MD8i5Yqiqh3Ez2ST5U0/0yhw=; b=C9B3gD6xMn4t/5RiT1yZlP3WUmW3e Yl20IZRYZ6uPlrUEn40Vy8xS4A56YLMR5ka3YhBysgGTcUiZRISitgugV2NOV7dg IeoM4si4EuWQhRCYV660qE3pRICKUk1IVs9BzWg1bszAzNw0fNYbwO56zBM50qFj cC55Eoz7M8/HWHU1jIzGkrnsyTHIZT8FCRV9HlratyKhdh6Qkh+vY8UdUP23Prhy 8+bm6BdfZ8XcKk2v55SMwnON92K90uza4SPc1dEuEZwWZKZM8Dd2RWLMJEyBosFk 9DHajnq0HfKhMQvVW+ljxck4zkpzfE+vFNc/ne4sTwZihr8P8/2+J4ImA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1rbgdef-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:48 +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 45DFdlFo014327; Thu, 13 Jun 2024 15:39:47 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1rbgdeb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:47 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DELP7P008731; Thu, 13 Jun 2024 15:39:46 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn4b3rk0y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:46 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdfJD49217960 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:43 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30DB420065; Thu, 13 Jun 2024 15:39:41 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B299920043; Thu, 13 Jun 2024 15:39:40 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:40 +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 v4 15/35] mm: slub: Let KMSAN access metadata Date: Thu, 13 Jun 2024 17:34:17 +0200 Message-ID: <20240613153924.961511-16-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: i6q6hWHhRl-wcxMBB5jGTOrB5o4Wtw90 X-Proofpoint-GUID: Hdll2VtH1-GxrpJV3pG_l093JfGpbX5F 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Queue-Id: 81015100020 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: bkm3mptqge83trp9ebyocz5iftb9bkb7 X-HE-Tag: 1718293194-498929 X-HE-Meta: U2FsdGVkX19FABCtyMlogsYBAUOTkw6EnzLE2scD7lDlpuFxl1wO0/ac8DfHkbLpnl4tguiWLC4hEP3zTz34dhoao/6asE19ULlChG0YzY6Tt76YuUEFAbvJ0TZnhCqbVgzD7rpAizshx+/2J+paYYRAR5uzb6kr6hMG1xqYJtWEfJpBhykRRO3uXrN8ABOJkKpUbwEbgSLy9900FwIq7/rgPLqaR91p/ClZUgn9Fgrm+5zz/Kpcwrdip812UXq/u8F28nlOB4oR6JU+9IVOWROmNORYgzw2ZC2XVPnCfarkfzmlgOjAlvB/KZv62/IdxwI+FOWMOQhr1AfrBvN9hvigimkNZFRtlJMOlbQX47o4w9I36vuao8e1YSlEI2G47Zp53qsvwbfxDVqAQe94/4EJH7wY16WwCyw/cNlTYrBBeFH5IYA2lB0rmzWB6jBwYxd1+jZRkGiBjAjcMrDKIdOZalb0P46GcxtXRmz2QHG/TgKRoVAKKSFj0y5ze6P43aCQRhM72DKzj56w30NSQHc5zwaNtxj9d3569ErBzu845n/T363/VqzgfRPMSO0pz6T9ha9dSJXpUxgPfOD7exA6Dz+99F01AndPPOqgrcqtzrUSAEPu3Zzd5XtmowR5pn/2nLuqoEAcFC0G2FnLJ3xsfRoQSjA/HZ6zVohAesQof7zgx1KOAi3HDp/9/Fiv5alpT0n586yAlQaP1tcjbA10WDs7m4cBU1EGkJHgxdxb1KRNp/fE3GW8dPy5aPjxWIEd1NoYgf+Bh1hPfQRxvdGPXsewqlJSdZuC+URZM/5IG009t+nqNTmPaqaCjFO7TJ6dI5Z2ekjW7oIX3TZRHyQ7lzB7cCnkBkb/XDcbkskjsm/ycritNKMsQ41rl6xLltcH7lBbkrS4M2SLMNMBPJM9xK/+nS0KLV3O0v/4AtO7LSdtz3oUhAuvmTT9szHyd4zTPPoTiyWXIrZETIO gpoXB3LB 29CIEPSMdzTVacpiPKXAT7BUAZETi8f5IFnWFngb8yj+2b7VGHoCjf97MZW/4b3TcGiZxBlky3PZaRKYHsp6MJ30+D4K8pd2OkpQvK4hrPbwdO1/5s4sUUKIDyDGBZUAs9nYvtTF6HRGqSaSNtfbJOTa+drVElAN9r8+8w5vYPsP28QkMxo7FfCUoAAldlrEkGgJlo8fHYAAtLS47Th0SFFJZxEe+qYLCFeuSHOW6y2R/r7vLT24np7y+d4clh00x2epRpDC2kIi7WG0RdmRzAJD5OMaBmFWYm7qfRQpt7RFVYOWPT4UiW7HjneuHrC7X8Gv9FdAGZ2OvBKTTf5gqitUNEQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000023, 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 Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 4dd55cabe701..a290f6c63e7b 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(); } From patchwork Thu Jun 13 15:34:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697140 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 162BAC27C75 for ; Thu, 13 Jun 2024 16:47:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A0FA18D0002; Thu, 13 Jun 2024 12:47:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9BFA76B00CE; Thu, 13 Jun 2024 12:47:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85FC18D0002; Thu, 13 Jun 2024 12:47:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 69BAD6B00CD for ; Thu, 13 Jun 2024 12:47:15 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EC50180225 for ; Thu, 13 Jun 2024 16:47:14 +0000 (UTC) X-FDA: 82226445588.20.03890F9 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf13.hostedemail.com (Postfix) with ESMTP id A395D2000F for ; Thu, 13 Jun 2024 16:47:12 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ILj8Ey+G; spf=pass (imf13.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=1718297231; 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=uLXUx7Jp3bWbEFcECk7slBB0jNtnowMXhhGygxJBd8E=; b=eWrAJfLY6LI2DPId0Y3+gtMEfyVJj78VuN7Ix9n2Fy+nZ6nJMu97EDtWr2tXEY8OsO+E3b nRjwR3b75W0Yg+WspZ0z8QoZE3DFXaRwcEQibYgYUyIr57+8GbB4fTUupg02UhyEDVhT2a bh8n1GlRBjhu4sE9cGqRuJa3kqHa1dc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718297231; a=rsa-sha256; cv=none; b=5q016qV4xRbwu3CA68BZy7DQ09ORpDXLXytOGi+Be4xo+PVz9QozD9AVKfC2Qr22Xck7Ei NFt2nzAhF0vVd1l/pm7fVsCLO91Df6Y2Uzp7g6fQDceafjF7hWA6N7IMWF1zS2l1vZsHZ/ RHgWvKrtJ81+QHNBx1Rz1ZMMC3pFoiw= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ILj8Ey+G; spf=pass (imf13.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 Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DDoRSf002951; Thu, 13 Jun 2024 15:39:50 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=uLXUx7Jp3bWbE FcECk7slBB0jNtnowMXhhGygxJBd8E=; b=ILj8Ey+GeP8nN2owTF8zsbzwpRcQj qO8hJBDrYsWHvWkneuCadTPak54P+eMoO9lWl2FOhSUVpgP31wAQ8I0yLWn5X3L4 PQJ7GHenGzZzD1U2GlwV8XNM6BidA9yS2+kFZ8hwPssap+yZlF+RSYCt69fqq7fK Cx7Y9gwdxrUj2hso+XG4MWf7caTzXpg7d1K6d2Qsw14nHavswhandJcqmQJWz/AF rfeF5T3StB+ibSzvbvfLbokeTBY7kLBKfXnUwGEkeKFCzcMQCuR5zIlIvKQwU5q5 UFXYB1n4JNGut/DrvkVJrOLUgRY7lFy9XfSh7AvjA/YOG8z8RcPmnmTMw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqy258xxg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:49 +0000 (GMT) Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdnRh021098; Thu, 13 Jun 2024 15:39:49 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqy258xxa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:49 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEAxeS023597; Thu, 13 Jun 2024 15:39:48 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn3un0qgj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:48 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdgvl55640438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:44 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48EFF20063; Thu, 13 Jun 2024 15:39:42 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C9CA52004E; Thu, 13 Jun 2024 15:39:41 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:41 +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 v4 17/35] mm: kfence: Disable KMSAN when checking the canary Date: Thu, 13 Jun 2024 17:34:19 +0200 Message-ID: <20240613153924.961511-18-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: I4PaEB_PP3Cvo4oOH-ZDVke6KXq6_-uP X-Proofpoint-GUID: X5BX2RWEHptsiw2F2Vy6DfHMQyyCihli 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Stat-Signature: yhx36nz69a9666ytrukna9smctgjm1fr X-Rspamd-Queue-Id: A395D2000F X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718297232-183678 X-HE-Meta: U2FsdGVkX18CsuBNqQwAID1k/ZEvzg+sqwz4PICLLfWC052xRZbi5geAgk4hAzlPzbJNtFwO32fXv9RWonU+V5aPNmSMK5kfFgBeuCUmpr4cLfsx8fy8Wy/zhmqbgBGvykGy1kQicGDoTuWXfwD+Yd0DNeYwbC9pTekBRg5rTeTRraqiUf05o/c/2J4eZJ/lv08PBy9y9a+IGTslx5nHDwstWErxvx1H/S7wPE/ekgUIEciWxv0afIXsYrv4wPeIGEV+t4AScmDCqDNN4uba5gBn1eZJCGBFcIpcXjKflbp/49N9rfg0+wKN2+P4Q2mWnU4ckECx1dnvLWhyJGzlRfkBeqGbkaOhH11xsEmNR+YpwVNx2PfGVK56ESDNe77LSwrc003Q+aOqIi7+Buz+NSOCNioKNU7wXYKB8cXB/bh4nCYbSXGQFHOnNQg+YnJ2dTzUSJ0h0fnugBWKnT5hTfx+jaQ4tKpPYd76/zb8XUpZGdWWswOJVPzNjC0HKQ2JeYPgLO9cqQAoGQ9ksKu+0hkXYyWT0pCGZcAeT9pmjAVsOz6xK7bVI8sSMElOhtEp2y0AAioWjteK+Z2bjwhPn0HgbN+Ys0SZ1veu7YYJgHTwdfDpsdktB46TwX9H8udJvngUzbgHkpaJxZisX6SyO4jbshWCyA48pTsloJL7cVdfT0Hc4k6q5kO4Gyh3zCdHIxXcnUSp5n1BnD8hyVH3vE2tlBX/UQ3VjjXsZtcRuKmZ3EzoNQVqRcxoAxpAOF0hwvYTQqflYxUISBXmcqAQnxQVEBFFIonZkcBBP/9SD5BZ4URI1zT0y+TSDk++LB4kCQa9WQ4ylpP0FuqR9eTHVLbv/e9KZx9G5FnVRmU3tOZVw2uXV6ROKYCFtiM2vvupnfwWNmV4AIzmesIpXAziaNWivSONkaTVpfMnKAxpNE6SSFMsi828kZVHZUQ+lzyQnCMTCYMpLEvz/kxbBKP Bq2HvW1V Tfn51x3LVTQNvZwdLI884V0Q7TZJS2FrbAkhCpfug/k1uv6w17hstnQR5G9Ca/ywX9JXEOnu33K9Ri7aOGLdn8bh+BAc91KtNeMI/RZ1xazP/Grr4wsms4clwZi0KaWBdGuSGKQ2WyKmlEjI0Hq/DdBIqPKmlIzXJpfbcsVj3H2Hs+9aU6qIRscp64NFUkHr8dY86z5m6A3PI/rB8NgRg9DxpVJBFfR0nSEjKNBnECT2AXgtt6jqY7UDOaOW3vpZnlAVmV9xc47kd/wLwFXOJkiMeSTwk39F4TD6dHj/8Feohy6b32wSo4GKD5Ynb+WVX9TNc1f8PJ99dQXQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: KMSAN warns about check_canary() accessing the canary. The reason is that, even though set_canary() is properly instrumented and sets shadow, slub explicitly poisons the canary's address range afterwards. Unpoisoning the canary is not the right thing to do: only check_canary() is supposed to ever touch it. Instead, disable KMSAN checks around canary read accesses. Reviewed-by: Alexander Potapenko Tested-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kfence/core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 964b8482275b..cce330d5b797 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -305,8 +305,14 @@ metadata_update_state(struct kfence_metadata *meta, enum kfence_object_state nex WRITE_ONCE(meta->state, next); } +#ifdef CONFIG_KMSAN +#define CHECK_CANARY_ATTRIBUTES noinline __no_kmsan_checks +#else +#define CHECK_CANARY_ATTRIBUTES inline +#endif + /* Check canary byte at @addr. */ -static inline bool check_canary_byte(u8 *addr) +static CHECK_CANARY_ATTRIBUTES bool check_canary_byte(u8 *addr) { struct kfence_metadata *meta; unsigned long flags; @@ -341,7 +347,8 @@ static inline void set_canary(const struct kfence_metadata *meta) *((u64 *)addr) = KFENCE_CANARY_PATTERN_U64; } -static inline void check_canary(const struct kfence_metadata *meta) +static CHECK_CANARY_ATTRIBUTES void +check_canary(const struct kfence_metadata *meta) { const unsigned long pageaddr = ALIGN_DOWN(meta->addr, PAGE_SIZE); unsigned long addr = pageaddr; From patchwork Thu Jun 13 15:34:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697130 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 2511EC27C4F for ; Thu, 13 Jun 2024 16:39:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E6676B00C6; Thu, 13 Jun 2024 12:38:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76F956B00C7; Thu, 13 Jun 2024 12:38:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C1236B00C8; Thu, 13 Jun 2024 12:38:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 31CC06B00C6 for ; Thu, 13 Jun 2024 12:38:59 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C2D0B1C02CC for ; Thu, 13 Jun 2024 16:38:58 +0000 (UTC) X-FDA: 82226424756.25.AA3E749 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf13.hostedemail.com (Postfix) with ESMTP id 7B25B2000A for ; Thu, 13 Jun 2024 16:38:56 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=TpSsq8cF; spf=pass (imf13.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=1718296735; 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=pcK1rMwKAY+PK8Ytyz/2vRX/RRHh9XTkiYTIv46ktrM=; b=Zbx7tTY4p0AxeMKt/lCBtI/DyBfUFruFn5ky5o8t6tohgXXQ61TDfu3ojHdFp3lE/MO2TJ OfORGRh+ZWw47j9DCiOv/B2Xhy65VaCZA5kTVymHpKM3O+Goe51G91XOu8Etyou9p3libc fvFZNA3ivx+VwLKQHUvSpT92ic//Vnw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718296735; a=rsa-sha256; cv=none; b=pjGiPH9zPW8Fe7nhjYYWrmI0hk2cwk11RW3DAAcH+1j15G/gBikELPJvBItzTCIY9VG6Qq qHDXZRNYfPY3KoI+F5NbpAxLieqVnGVXPR2a2ELQ6EJDTxuD3j3w7vKuzD6DHl6ne1yYoZ p4fwW0K7rrV7sqdnYK0bvAf8VDW47BI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=TpSsq8cF; spf=pass (imf13.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 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEQSMW026603; Thu, 13 Jun 2024 15:39:50 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 :content-transfer-encoding:mime-version; s=pp1; bh=pcK1rMwKAY+PK 8Ytyz/2vRX/RRHh9XTkiYTIv46ktrM=; b=TpSsq8cFzJnwe+u1suk+FoH+lPoVM M0wKWuXfnzK24xPI/asMuY0NJLtc/QQp1E8CuZWPrRfAIxHh7L6vtwUO9WCobLCc KNXiKGdxN5ltwzKdCslukI62H2Gbhtv2hih2dOS4Fc/upBNGBPSKnFsB4UcNYD/m GnamVPbgk676OGVACc7WZ0WdSFjmdCc/P9o5+i/Mev0kxAq/u6yKK0HLzs0feBAK 5s5YgKXZaH+73ir1mf7kp7TYwWfeYek8KacEbuD+IY16WLmBo+BOs6St4lQ1OMHE kFmWgE6lOV31MU2ov/KzIoIPMEnsolHL+WIQ12Z2d3gdXgK1F5hfsr1Yg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4u2373-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:49 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdn8N009704; Thu, 13 Jun 2024 15:39:49 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4u236x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:49 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEAZNn008701; Thu, 13 Jun 2024 15:39:48 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn4b3rk19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:48 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdgpn54854064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:45 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CEE4A2006A; Thu, 13 Jun 2024 15:39:42 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C27C20067; Thu, 13 Jun 2024 15:39:42 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:42 +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 v4 18/35] lib/zlib: Unpoison DFLTCC output buffers Date: Thu, 13 Jun 2024 17:34:20 +0200 Message-ID: <20240613153924.961511-19-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZkRkVKlaPl-5RHA19x1OqnW-klsEghkh X-Proofpoint-ORIG-GUID: Ftz9VuNKiSSNqeta_DO5F7fudUAWQDRT X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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-13_08,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 clxscore=1015 impostorscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130109 X-Rspamd-Queue-Id: 7B25B2000A X-Stat-Signature: 6xb5h9uorhf8iaabhj4ncrcwcxqrxnuk X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718296736-321974 X-HE-Meta: U2FsdGVkX1+RtJuwz/sy8hniku3BNU9iNuAnaVz/S0ysimUEA0LTbMiyhyASBVMLzyxQqdRf/dGSZUeG8GbSEG4oPxqHo3YGmWHA79L7aKn3qrJaaHLWfA+8S3FeEnu64lhuMD0AG3heom4MijNrGVLUJ0oVlw6f1kLEC9VYqgH+lDZo+OMoOklV/C4VEhKF7BKjBb7baIP429tC3nxFQQwJCgHRiwlbJRlKdQk5Nv5UN7kuP2H2EKC6X0GHwmBmAWQqXIlMqtTpa+vBT1qf01jw9xvMN+62IDWXnxxqFchYXHN9O+ppPOm2AppHOb2/aj1VJX4EDFaCDrKyO2bipyB6c99+k4OZGeVaVtyc9AQ6w+WgvTedy4kFYihWImLGn1gMrSmDw5yotnAhTVX1WlRzHuhYf81a/PL8QKKaAQOl1GczvICu//7z0B5l9l4DYvhIfu45nIRAB04sGM7ManJZjQhvY4W74TisV8BswBKQVYCY/gbUee4L+pqyB5joqggu4llnguiokyTT5AAusLkGdUNcrjG4J4j+TrNDEDH7ZZi9zFDvnUoLEJ30T7qH1XKThaHeQVjFRvwg0ZpYHN6I5vCvC3EmtwO0D75kcIQY7HH3u92r3J26IYaWmMCA1g5ic+1Ri2aE1cyHB7Vjx1BN89/1CIOKJoNk2jjTNhYpnL63e0gDyhlTZRe0Wtud64pHNgtSaZ+z0f1qmwWiHPqBu5TpIG9I+maxjQKumCGINgGqh/4n7huGSxECjlCmAnFvZ+0gkzK/jpkvsCHPGHuUXZ/m8nUnlysC8WzbygYD7mG2+LgQ0jtd8vWywLkpSD7Q/9nU6lqHw8M6jQlKITVlglswufCZ+Bn4GmJ+Lqxp77qbnzoFkhKNqBHEENn1b+VWhs18NtJbNfBnckS7us2rnCofLAWkLJmZEcEh3h70qqhg6Q6OusPtoTlazcF6JUPmKMm0oXnFXzr1DpM YjnF2fTT jYwvOIrO2KgHA1DpHh6dFGjAIydT+voQiH+xuqHYlgcSW+Bg+MEojvVTgbCVgeR+ObO8HTtgK+dIrcDDZF7147RGFawulWkA7qJijiuPq/AMEtCE5H1BETfRToemx4ZLIUp6BtiD1VcioIOpFwAVY/XN279Q2T8SsKViyRuG/5iGe9seXKhp/9d+ohqiDKEKBvaL6j/7sGj50lbXNrAl+6eDgqHRe4kFxLwmPzbYOZr9PkoXDzOkeGbPp+1ZBR/27bloHVLWYH5AFa9mnuZkTnwTFy6bZ/PsqNCqikKo6UNdoCW007WZclGQykGC7gXNcQdhkYB3hmMaCrAJlvTE97tynX6UYlQK3ujZ4Hyrb55+m4SjFOAPY0V3kXYIomo66MRRQ 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: The constraints of the DFLTCC inline assembly are not precise: they do not communicate the size of the output buffers to the compiler, so it cannot automatically instrument it. Add the manual kmsan_unpoison_memory() calls for the output buffers. The logic is the same as in [1]. [1] https://github.com/zlib-ng/zlib-ng/commit/1f5ddcc009ac3511e99fc88736a9e1a6381168c5 Reported-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- lib/zlib_dfltcc/dfltcc.h | 1 + lib/zlib_dfltcc/dfltcc_util.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/zlib_dfltcc/dfltcc.h b/lib/zlib_dfltcc/dfltcc.h index b96232bdd44d..0f2a16d7a48a 100644 --- a/lib/zlib_dfltcc/dfltcc.h +++ b/lib/zlib_dfltcc/dfltcc.h @@ -80,6 +80,7 @@ struct dfltcc_param_v0 { uint8_t csb[1152]; }; +static_assert(offsetof(struct dfltcc_param_v0, csb) == 384); static_assert(sizeof(struct dfltcc_param_v0) == 1536); #define CVT_CRC32 0 diff --git a/lib/zlib_dfltcc/dfltcc_util.h b/lib/zlib_dfltcc/dfltcc_util.h index 4a46b5009f0d..10509270d822 100644 --- a/lib/zlib_dfltcc/dfltcc_util.h +++ b/lib/zlib_dfltcc/dfltcc_util.h @@ -2,6 +2,8 @@ #ifndef DFLTCC_UTIL_H #define DFLTCC_UTIL_H +#include "dfltcc.h" +#include #include /* @@ -20,6 +22,7 @@ typedef enum { #define DFLTCC_CMPR 2 #define DFLTCC_XPND 4 #define HBT_CIRCULAR (1 << 7) +#define DFLTCC_FN_MASK ((1 << 7) - 1) #define HB_BITS 15 #define HB_SIZE (1 << HB_BITS) @@ -34,6 +37,7 @@ static inline dfltcc_cc dfltcc( ) { Byte *t2 = op1 ? *op1 : NULL; + unsigned char *orig_t2 = t2; size_t t3 = len1 ? *len1 : 0; const Byte *t4 = op2 ? *op2 : NULL; size_t t5 = len2 ? *len2 : 0; @@ -59,6 +63,30 @@ static inline dfltcc_cc dfltcc( : "cc", "memory"); t2 = r2; t3 = r3; t4 = r4; t5 = r5; + /* + * Unpoison the parameter block and the output buffer. + * This is a no-op in non-KMSAN builds. + */ + switch (fn & DFLTCC_FN_MASK) { + case DFLTCC_QAF: + kmsan_unpoison_memory(param, sizeof(struct dfltcc_qaf_param)); + break; + case DFLTCC_GDHT: + kmsan_unpoison_memory(param, offsetof(struct dfltcc_param_v0, csb)); + break; + case DFLTCC_CMPR: + kmsan_unpoison_memory(param, sizeof(struct dfltcc_param_v0)); + kmsan_unpoison_memory( + orig_t2, + t2 - orig_t2 + + (((struct dfltcc_param_v0 *)param)->sbb == 0 ? 0 : 1)); + break; + case DFLTCC_XPND: + kmsan_unpoison_memory(param, sizeof(struct dfltcc_param_v0)); + kmsan_unpoison_memory(orig_t2, t2 - orig_t2); + break; + } + if (op1) *op1 = t2; if (len1) From patchwork Thu Jun 13 15:34:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697007 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 A1CEDC27C6E for ; Thu, 13 Jun 2024 15:40:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 154EE6B00B4; Thu, 13 Jun 2024 11:40:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D83A6B00B6; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA8DA6B00B5; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AFE226B00B4 for ; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6362D1201F5 for ; Thu, 13 Jun 2024 15:40:01 +0000 (UTC) X-FDA: 82226276202.28.611D3C0 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf06.hostedemail.com (Postfix) with ESMTP id E97A8180006 for ; Thu, 13 Jun 2024 15:39:58 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=BukJUSkj; spf=pass (imf06.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=1718293198; a=rsa-sha256; cv=none; b=FgYnqXJlwawAylGTJWnKUDqaer6LupM+OQtR/94zcfGtsV+wGlzX4vDCinmSruLGucY0u4 wKt2E45ssyH/RJN53qlV8Y72A0IAlCgk7XrJRAhuBi/rbfmroaxcLpNluzYOfEC6WQ9AkT KnzrM6Yusx4lT/qzp/yrVuCoC8eKR9Y= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=BukJUSkj; spf=pass (imf06.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=1718293198; 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=eOJVqKOJuZasA86pPY8j/wtn7XC9Zj2RO1nXjWn3Mgo=; b=ufp7y9TVcCYNaFgofH0wFpko4NwiGi8CHPmcgDtm52ETSr0c+CLC/04+58jYBnV8SN0hDK SOu34DB1dHUa8Y0Vz/N8b5a1Vhpthqtw00f07OJKe+5p4ThOG/nE7vuKs251XaelZ1KX7I Go6vfwLwIg4ih4AyqmjY14fTS5Hzi0Q= Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DDU5Ym014079; Thu, 13 Jun 2024 15:39:51 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=eOJVqKOJuZasA 86pPY8j/wtn7XC9Zj2RO1nXjWn3Mgo=; b=BukJUSkjWGig/i2Pqbb+I0C4LWrZ2 sJ98mrin5N6kufEajPSUKOdUl3QZjqK/l3CkF8AqEvrKjg6IshFQERAAM0x/grxT 47mwYc5Wuj6dfPyJ1wVZzbVNSuJAL8TCmqSZSXp0fkdjktij7o0PrutEom4F106Q yQ+E8h7CA+f3/264dU4QLGmtJq0NfL5EwNW/XdDTSsChRXbJa9meYR5kHJhQ8chj cUmT7f+Lu/3jtxgwY0o3O9G92WyPhgFpNb8oDOKDx+tBGCUN4xScF+3r1j+7JUrg JRcQ58px+B7uwlShhJvlfoktSl+2gDjqA2AwoOj+auHfVlPfzffvMxy1A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1pa8dky-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:51 +0000 (GMT) Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdYRq029998; Thu, 13 Jun 2024 15:39:50 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 3yr1pa8dkv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:50 +0000 (GMT) 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 45DEh2w7027209; Thu, 13 Jun 2024 15:39:49 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn21197ag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:49 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdhMV56033720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:45 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61C6620067; Thu, 13 Jun 2024 15:39:43 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2ADF2004D; Thu, 13 Jun 2024 15:39:42 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:42 +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 v4 19/35] kmsan: Accept ranges starting with 0 on s390 Date: Thu, 13 Jun 2024 17:34:21 +0200 Message-ID: <20240613153924.961511-20-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 0eY3MbH0HS6MivN5xeWsj9Ia9OM8Lgw9 X-Proofpoint-ORIG-GUID: cRp1zEfmWI6SKhzVPAlyMPh3l82rIXRt 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 priorityscore=1501 adultscore=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=998 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Stat-Signature: mj7daezgbxds5jst71wgks5mf3j5tgjd X-Rspamd-Queue-Id: E97A8180006 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1718293198-221179 X-HE-Meta: U2FsdGVkX18QDs0ORcTAGYTFUGPPPe911bN72XSRcMHCIZlsLH+llcaPbKt9uxgMyyjZfBJn467aNONjwl06qDmFTdtMoUesrYUZCx2wVJpEgCGBMQU7QN3M4TcHxq0AYU/O9kmiQ9xTQpR47u9hc64peNOpp7DMVpBvbkRrF/DAh6l1ZBezOrSrh5TIiBiDS5bnXbMOSIFoya1GNjI7dxeTsSxQRB2MTZGbH7SFxwAWEUrmTmtMTbMrKt5R/Wo41Mw+8MYV9DftSVajhn6+nPd7GJnzT4QLhUTe5gNviHU8nTRmkINLYaz2Y0Jqf5NeK3kCsM7c6taS4NGdH8oapyGGc0UID5UeDT2+hyQqf9x634pqnsbUOe0vTa4M2xGrFQ5TMF/cKIFOooTEdgHKjnNRWNvyNnPFDeh7BI955GjjKwNOK8zrN5FvOBAjmXnFNwHMPiyLpCeAFQ6FDZb4+W+Z7/nEvQMozAIFkYyFXmjciXw4IN88Kf/cwMAMdHaDZD3IYm8QZlzy8ztdbYOGdyPbn5vgLkYf2lKBo+F/JuuPqinSpUSYgQVtYu+Qbvk1/qfNDXVFSUrlH39EG486VGcKAsJboELqDT0juyW+kxCdVOuoE9EJcXOa9h8vT5IN5AtAy/VRR040kBugegbSjQfnk1w+7cghPKGezTGPFTF+zlk9CFh+0twVaKeY3Y0+U8LTjiUcNdlLkHw6yc1fpv8d+rTqAY+j2sJv5GCz0wOSEPLZHHHajhAHOsFtSmgNIsLqwe3O/hjlzWa2LuWNK9Z8gT0rxWAhK7Kijgu2rl8h7h7LMXStW7BND6ospVDyjzEmJSgzfiWQ/e7FPYT9OkfdsLAWM9Q1v8Zn/KmpJz9FlUs+VIRIjOqPyzx9iidpSPF71rzk3oTuyNW1mbQLczZcqx+wGpxWJAYYS3Dh9DNgFMpePpF89Qr2p7y3gC7VgBv/Q8ttd+qZzwjk3mi H3MEXkUH di2ZkRoQRRzhE8ai2PzwRYwJXeNI7FxeKUuRk1NJLpiI8w/LeFURQqyNcqjP8u4Wbt1wk5VL2LiI8tlzMjoRbVCtuEh9oxAtgxyB6mw1M6sa9rsu9FVLmKlL5fktEfPQPqI/Si7FuNFlnA8ggfa9m0XpN3TI4KLOuBkhMkjrweeXvIAWfsmGC7r+sxiqs23Gozuukk9TIU6KsgYpPJCnUStfgknRy5lpzvl+vyFsIoNc9/GU= 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: On s390 the virtual address 0 is valid (current CPU's lowcore is mapped there), therefore KMSAN should not complain about it. Disable the respective check on s390. There doesn't seem to be a Kconfig option to describe this situation, so explicitly check for s390. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/kmsan/init.c b/mm/kmsan/init.c index 9de76ac7062c..3f8b1bbb9060 100644 --- a/mm/kmsan/init.c +++ b/mm/kmsan/init.c @@ -33,7 +33,10 @@ static void __init kmsan_record_future_shadow_range(void *start, void *end) bool merged = false; KMSAN_WARN_ON(future_index == NUM_FUTURE_RANGES); - KMSAN_WARN_ON((nstart >= nend) || !nstart || !nend); + KMSAN_WARN_ON((nstart >= nend) || + /* Virtual address 0 is valid on s390. */ + (!IS_ENABLED(CONFIG_S390) && !nstart) || + !nend); nstart = ALIGN_DOWN(nstart, PAGE_SIZE); nend = ALIGN(nend, PAGE_SIZE); From patchwork Thu Jun 13 15:34:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697005 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 996BDC27C4F for ; Thu, 13 Jun 2024 15:40:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B1D26B00B3; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0871D6B00B4; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF7276B00B5; Thu, 13 Jun 2024 11:40:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B2A986B00B3 for ; Thu, 13 Jun 2024 11:40:00 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 76D6CA0978 for ; Thu, 13 Jun 2024 15:40:00 +0000 (UTC) X-FDA: 82226276160.11.60DE9FB Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf02.hostedemail.com (Postfix) with ESMTP id 2F6C48000D for ; Thu, 13 Jun 2024 15:39:57 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=bwkgaq1s; spf=pass (imf02.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=1718293197; 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=OrFUkNCKCdyNkojULrcA9z04Ys3K5qGxpLIcxQ1wcAk=; b=8SXJhFSJ2h5dNJNqxMaZIe3TWP8ZgVs49pl8sIt3daQQmDVv922/ruf36ME+a/YK8uAd1k 1ExLf/GrIrY+ap8z7552+3Q67kBxV9VzbAaF740mlslLFqps9Y0bBEAy7nlzYS0p1tPU9u hHq6aNf0vaZE1caJ2HSbZV+DUiz49K8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293197; a=rsa-sha256; cv=none; b=A2OiSJniRzYM4XcE+Y1hfzMbuN1DgCA/amsv8g6M3bM1fayq4T6fvrYx8lWG6QceiObKd9 7fE3QVOSgHguNMK8mpaVBjoRb8qFObGCnpOb3G6zs1+yC7hvw1SwTnJte0B3kO87k3D1L2 8Y6VTmzH6k97mD2Wf1dI/XuZg2gcYTE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=bwkgaq1s; spf=pass (imf02.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 Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEuZuk004482; Thu, 13 Jun 2024 15:39:51 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=OrFUkNCKCdyNk ojULrcA9z04Ys3K5qGxpLIcxQ1wcAk=; b=bwkgaq1sCV3LyvhB24eEZ9MPd9jIA HiYyxmXczPU6ADPejnBlmgEDlUNoO5BZ9/YAR3AHdQDegvjyiCoQnsFzrwxn9/vU zh2Q4gUuzXAQb9o5ainLK2orJwQwAfGVfSTl9Fo+8c6tt6nkZ8kC9y2ivbT7caLI Q1z3vdkn8gL3olv8JhzT3wjN7Wzh16db5S6WR4MmCjgQTOro940+iHOizxUwp6IO 3WvgrcYUoSlq5fK4bES9dDXlXTJ7sIgXpb/YBXPI0M6npKa42/bTwlbhm7mP0ABB DFdFUFGzIRC4oSzGOm1iOtVG1pW3j2BBpJn2CfZIjEwuE+evVDx/o5lWw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqr0vsy4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:51 +0000 (GMT) Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFcUxP022003; Thu, 13 Jun 2024 15:39:50 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqr0vsy4t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:50 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEHVA5008719; Thu, 13 Jun 2024 15:39:49 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn4b3rk1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:49 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdiCB56885588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:46 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E79F72004D; Thu, 13 Jun 2024 15:39:43 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74D2C2005A; Thu, 13 Jun 2024 15:39:43 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:43 +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 v4 20/35] s390/boot: Turn off KMSAN Date: Thu, 13 Jun 2024 17:34:22 +0200 Message-ID: <20240613153924.961511-21-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZmERwDat_iaHUwLFh2JI_yp4CB75f3A7 X-Proofpoint-ORIG-GUID: EQioorNQlY6wC5efdYpQfigM9KZNmuSy 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 bulkscore=0 impostorscore=0 mlxlogscore=751 priorityscore=1501 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2F6C48000D X-Stat-Signature: o1gomdhfdukmn8ss9bjakzcgqt6f7ytz X-HE-Tag: 1718293197-435828 X-HE-Meta: U2FsdGVkX1+xCKYUTqcKBnhQO0EE6kajh60dzj6bItznloMyg5ESDLd4Be5YiuYY7s0RcrS0l9xj6Thn55TNa5GVeKIK5AJWg2DQy2u51YQbWBdnNHdn+lP/elilPDRiwT4cj2eefXvT0U/Mx2e5H5VS5xTCroEH5YvuB+l5d0R1Inf4B9likWBPLvw5LFtsDtzz0xVvt6Id+szsx9VNd2//sN3KmMalv64K6Mc29BoNv6OlUN6Uu8kbjfzHzNvTrxMALHuFMccVjZddWB58pNvgHeAzPVy3OKUSkfAKQfUJCzu6bBGJHYzGPtNHHmxumjiyZbEmimZ/TR6ILsXgO3TXVzbMpXvweV7gPvYdttYiDJiSmPJ3dmtY9P3RQF0Y/RzoVlG+EUvLDENvaHH41cVO0xQK5nYASjxpnHIjO3wLXQrDuvCWqCLS67BfN5T41+1pDuej3nZDOoxuq6hitDwxZS/wQ1wTKxnWZtrHg0LCxsvuXLwqiak4Kk9nYuV0oj/i/TL5wcde3CJ/YAv7yXj9sfRDzyNVX//xUqWjVzmBnmd8qe3QsVQreYOx9IlWIcIvfFZNOX8AWHLN8qY+slkxaNmf/60l3Ei+LpisTsIroMMocQUiLJ2sUxakSpHIAn0ERPPyR8ZDJtIeAHkg+GSUe24LuPhmuZBA309eE093bD1uk/qrhPl0N8zTO6RC4BL8ZoQIU+ToOdhvUK+YtMafpCSLQVRvrwdmqc98RvYfj3vtuNM8oIagYlzRJZ0RFJHw4kDEjLqn/9BkLj4ban3kln1d1ZPlGEZEhP7mt1e/PHquvsbHk6yELaKqcv2lhF94LRgIpH1SS/xASwa0tgK31Eue4mZYA74vYat5+NfHUK57eadKoZbkHe/o0imNj32s19+7Uw1zbfnul1Edj6RmxUYSHO0wjT2ELje5LYs9ZvawuDlZP8AQrdxR6S4Z//g3TTNU7lAEsuM/zEO AH31x/gV CgTvZsdvW71QowNfwZgexgqKwfJk4S9WoroeDREmaY5bNSdmTaW9bI6MmqMNILkB+V7S43U+ubvGmmQ0qBADcIkdxDnaAa+v0eLmp279dHimCGb6gnwwJbRhb/VcW4v0sNOnh4+a7KvNuXWIG6URKALTo9egIBigCxKW8lKByVYUbjWLPCvuvVqiUMQ8zWN4d1R0j6RNlL+qYJhB+RWlq7bqs3/1FMwoe2GS2oYa9TPiU9/kabhJB4Gp3SKZR39+yIyd6moVs2tuJjSps7rxR11tFry3WYV+doDEOYTUHKdqdo6zYVaHpjpIe1hPBX78BosFsSlSYG25liOnK4Ey1oqKpNezldIPU6XKFOIQPHfzHILc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.004982, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: All other sanitizers are disabled for boot as well. While at it, add a comment explaining why we need this. Reviewed-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/boot/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile index 070c9b2e905f..526ed20b9d31 100644 --- a/arch/s390/boot/Makefile +++ b/arch/s390/boot/Makefile @@ -3,11 +3,13 @@ # Makefile for the linux s390-specific parts of the memory manager. # +# Tooling runtimes are unavailable and cannot be linked for early boot code KCOV_INSTRUMENT := n GCOV_PROFILE := n UBSAN_SANITIZE := n KASAN_SANITIZE := n KCSAN_SANITIZE := n +KMSAN_SANITIZE := n KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR) From patchwork Thu Jun 13 15:34:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697006 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 BF067C27C4F for ; Thu, 13 Jun 2024 15:40:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB4596B00B8; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0BBD6B00B7; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE9666B00B6; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8BDCD6B00B4 for ; Thu, 13 Jun 2024 11:40:01 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 438FC1601D1 for ; Thu, 13 Jun 2024 15:40:01 +0000 (UTC) X-FDA: 82226276202.04.46E491B Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf17.hostedemail.com (Postfix) with ESMTP id 077F940012 for ; Thu, 13 Jun 2024 15:39:58 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=VHXN9WfP; spf=pass (imf17.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=1718293198; 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=EM2Q29X1oynbiWdgAiIUaE04pJnjihVfcXc099lsq1w=; b=1vaK2VhVRdHBv9XnV2p+UTqcV3KnAk32NGWHG15RoaeTcruhH7NcTwJXudaHnBgQL4Zbsz crIm4skACNk7ulFbi1PMm/PDMIWuICx3HnUTv+qNsuL6cYxOqxLjozFlGZha8JpJwm8n9v QHfbI1AQXtHQ/Nan2mDF1ek6LaMaQRc= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=VHXN9WfP; spf=pass (imf17.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=1718293198; a=rsa-sha256; cv=none; b=28hkvcsPIIL1aLOLnKIc45GNQC+my3JtVPoEZE1IZYHhbuhQAiJ/X3fbCwzSO9laSuiQQ4 9nxsSUi1oDaWscgF7I1UshW9jppgDt5CpTTjx+NroOE3p0dqOW+f54dZVNbzQigfsRvSqw /Eu2GKhc1fkdCHp9pLybTvM8fdqUH3k= 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 45DFCHUA026549; Thu, 13 Jun 2024 15:39:52 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=EM2Q29X1oynbi WdgAiIUaE04pJnjihVfcXc099lsq1w=; b=VHXN9WfPNvhruck+pL72M4V79RivJ ZMl6q2Rwgs3WiWfsRdXS+e3dJlXVyPpJte6qvhoXXifApmELTvQXsNzxeFQo4y8M F5TQO7BMr9esz9c5KNK64+sWYDPu1wj0YsUuFRa1klGGTShdxn2esV3hHQUfmraf pu43lDgkg6o0aJb6J1wYIefxXX1Dv+yO/CLYOB0mk9Uj0w5xmeKTbQclDVkF3M01 ug+AhktgBW6gCNvkeJDqyTik1e9w+RVHdZ3dwBI++r2Zff2mrgxFEbdsq3S9bIiJ EmIGW9MDMJf6NzZC44vnR96SOjCrnsLtil+TC2iDm3oZPgdrnWLtI9+Sw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1rbgdet-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:52 +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 45DFdp23014395; Thu, 13 Jun 2024 15:39:51 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1rbgden-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:51 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF7EKI020041; Thu, 13 Jun 2024 15:39:50 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn34nh0cj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:50 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdiU951511650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:46 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7916E2006C; Thu, 13 Jun 2024 15:39:44 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 067C320065; Thu, 13 Jun 2024 15:39:44 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:43 +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 v4 21/35] s390: Use a larger stack for KMSAN Date: Thu, 13 Jun 2024 17:34:23 +0200 Message-ID: <20240613153924.961511-22-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: lFkUDj6LN0n_-DjPlPRJL1teLrWTofxF X-Proofpoint-GUID: TOtbwEEWWHXcQFHvMIb0mi7O7rB8fdB8 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=869 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 077F940012 X-Stat-Signature: bechen3k5r3zhwa54sric6rnqtk8oydi X-HE-Tag: 1718293198-64469 X-HE-Meta: U2FsdGVkX1/6R2tk5zo0JzpGaWF4YBs0D5VAagt2bkGNrHQNCtLXcHd3JE0z01M0ajcD0ZxGcIQNAr/b1N/9kSUt5IYk1bh90ZXqYUojK6kt0XEQc9kkcAejonlj4oQb3WjmUlpbYDdKzgCvq1BhIYu67V2AsxXaj8F9LMZShFX1jXeW9JC8QLHwJkrXkSEq3zb/1CUjTtm5QTFyxdYEx4e7pimGBKlMLWhVX6P3DZKld5D0HUzdOzUYE+kYIjpXHEG+aWdi+42fQ0XI+ehAfvIxEGQAZBdysC1ooTJFKUhdHGL+7Sz86ys+2fTFE3uXOBFbuGzhzxN1XrsqhrXkBeyFHc8N2fKBzlZatk7mc0J5rtkDr/9ia98HqWJZwZXteZba3URoj86IYuAe4c6KlHweC4csUkg26hEXd+4icD43Sbf/EVZc+E476vIVX83lEUo9nSDcR7g6LwC/2n8CAh+anBFO83uAW08gn5xxSIrGbENQLlK+Z2xu02sceBCMViJ4B0vgSUVkM64ON12dhMaj8sKmvs9qtGUBwbCjo1ls2MURD8urgUZQUCdU8xOq+0tNi7WvOXUsCqi7pPzeGa0Cfu1tNygKaw505mB/QfiqNndC8HgJ1oLfc85506AKFVnzVajOaDhKzmI66a16iHKV+70tQTWqzmv1XD+7oKhM8XFO/Ty9Punh28rYNIWkLqoSdCN2famYRdMFCNTlnA+j2sLa8ExhYL3HFKxDIXPf6R9/b4RsNIY31NnnxStoEqZdrjFTOZD8TOIKvFkccodaqL9Kx1P28cl33LAGwyyYE/6S7/KNHxTOy1BTK4fHjA+V5NNdvdR7rTkTPu/Brl12LvTaTyEb9+Fp7H4yanoEChRDHI5VxarHZ67vsXmBAB2JEpK5SVtAYbpamdTQuFVGgVpYtIEOr9D02MgkFlZ4sFga2rLF74Rnkdl4R3FhbQlmcEZKPE4dnSHrjtE tXl32ptJ ke1cwlR8BhRAl49lAtCoeLE/nawNBOprLEzYzBFHnfONAvt2ilzqa/30/YvnZKmBUIyWz86My2czX7QlbkQESNXO8+jROtv9xgNM74dQTQDzTAVYAbs3QXrgRRkYnygOoEkIuE9mA3yJuSJzgZzR/KvpQq5E0k7MS1YQ6U0dlU6AqAlWETTFAu3y8DDgoPyJ/WGjYO730LQo7T5Zx1KVJ7DLR4jc/LaSjcHbUu4vE/Or4kUf+xunAlhUc2e/I6nhFZ8aL3zclZleDTlEYO0PZ11bheQ== 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: Adjust the stack size for the KMSAN-enabled kernel like it was done for the KASAN-enabled one in commit 7fef92ccadd7 ("s390/kasan: double the stack size"). Both tools have similar requirements. Reviewed-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/Makefile | 2 +- arch/s390/include/asm/thread_info.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/Makefile b/arch/s390/Makefile index f2b21c7a70ef..7fd57398221e 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile @@ -36,7 +36,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds) UTS_MACHINE := s390x -STACK_SIZE := $(if $(CONFIG_KASAN),65536,16384) +STACK_SIZE := $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384)) CHECKFLAGS += -D__s390__ -D__s390x__ export LD_BFD diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index a674c7d25da5..d02a709717b8 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h @@ -16,7 +16,7 @@ /* * General size of kernel stacks */ -#ifdef CONFIG_KASAN +#if defined(CONFIG_KASAN) || defined(CONFIG_KMSAN) #define THREAD_SIZE_ORDER 4 #else #define THREAD_SIZE_ORDER 2 From patchwork Thu Jun 13 15:34:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697008 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 81F5AC27C4F for ; Thu, 13 Jun 2024 15:40:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD8D66B00B6; Thu, 13 Jun 2024 11:40:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B84EB6B00B7; Thu, 13 Jun 2024 11:40:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B0066B00B9; Thu, 13 Jun 2024 11:40:02 -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 7B2DE6B00B6 for ; Thu, 13 Jun 2024 11:40:02 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 30F64A0199 for ; Thu, 13 Jun 2024 15:40:02 +0000 (UTC) X-FDA: 82226276244.01.DB145C8 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf03.hostedemail.com (Postfix) with ESMTP id D152D20007 for ; Thu, 13 Jun 2024 15:39:59 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="p25W7o/C"; spf=pass (imf03.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=1718293199; 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=erZvlatfvJVe/hx7BkMgZ/7G1oP598/R1HnuL1JF6tI=; b=jKuBTSgP/EFkUkREZhqXaxhsDGJ12MHBUa4vkWfkw8GPEDycbEwk7HrJz6y4guFpasoux4 k37x2dj1X4TFkqyVerhyZtzCgunYVh64qa5MDxBAMSFP/gNbhiXZ5zF0qYFdIN2QBoOhdP 3BFV3InhkVs2XzYTmOkLVWQgXJv4uW0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293199; a=rsa-sha256; cv=none; b=xm9zB4320QZUqNa6bm78ElRfYIVR6wTwEJo//wRlACi+ALbyLVQEqIhZvgkmUc08bkwJdp wOCmALjbUmGvjM2uHBbPGw5OoKlirh8Kf4YPVaXF1iaIv/N5qz3hMatyjLB1tiXMTMvDAU Zk4HNyrnDyaYGmlhT/Lj/GTfWViyOBM= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="p25W7o/C"; spf=pass (imf03.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 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 45DCR5FB031311; Thu, 13 Jun 2024 15:39:53 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=erZvlatfvJVe/ hx7BkMgZ/7G1oP598/R1HnuL1JF6tI=; b=p25W7o/CudREsmrJUDH5PLBqNrljD tqE16he8MhCwPgkg5ElsKa+qj98SqC03fly21qIg922NsKjc827uqcq0YUhmeYTv S4D5e/Be34FRsBN7fhFZ7h4nfl9f34pcu3TIYKi2Dx/fiaphS5JeIcqTI9E2/7t3 odXw2JaVSzdAR5Ugqn052FHFETAvsaWtADHDkqDbChrTdGyKFcebKkCEaBBOZyHf o5GKEcWB/lZBABQa61AK4/MNrw/yBv3Tj/sbhuu/CjE3Yr0OQUcv8gGWwIB6rtgz ciOq8/zMPfVc7jKuX+2Isy1M3h4w4/T3ssw0Ki+A+NhCLRa32bXjQXtAA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt376-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:52 +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 45DFddrG026714; Thu, 13 Jun 2024 15:39:51 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 3yqq4rt371-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:51 +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 45DEfGBi028808; Thu, 13 Jun 2024 15:39:50 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn1mus9fp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:50 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdjMV14287222 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:47 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09C862005A; Thu, 13 Jun 2024 15:39:45 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BC4F2006E; Thu, 13 Jun 2024 15:39:44 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:44 +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 v4 22/35] s390/boot: Add the KMSAN runtime stub Date: Thu, 13 Jun 2024 17:34:24 +0200 Message-ID: <20240613153924.961511-23-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: bDXYjt3QTW4jb1VpShiRGF98SrMCVjqT X-Proofpoint-GUID: gWs7Typp_vs9CO1C98hB18fAlqU4x_JW 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-13_08,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130109 X-Rspamd-Queue-Id: D152D20007 X-Stat-Signature: abs3465zqhfazxysuepuw9efj3jwt6nk X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718293199-322245 X-HE-Meta: U2FsdGVkX18RbAwCUctzPz4LXnCar68GRfA+p3hjtONzNrCeju4BWXbK5a+d98iRYdvV6VfAgTCbOkleFHcFOL3emU5gQvsA8U2Mt5EGOmZtEQ1J1god6iPTr7VcWID0CTriXxDniI+dyOfgmvdr3W6kSEo9Bk8gZwFfRFoKBR6TPAstf/kbbfHee6Su/ieHvYQQJSphLyzRR79utzAQyHOna0FAgccl3NnIfDi3D7HlZwJij6uWGbP5IsIqlHwzLHzw7rQ/AZI+17hEZWuVe5ClUDoAusjVsigP4ZK8dzLYoOttIqYDykKDI3MBsI9BcahpcqvDW6zk325n+P7JBeCV3ericH+wh1uRV0aT5ovhgcSqR3NuJsRfrrtoiccoIApLRnuwy6w9JuSlfjgh38YGkbyC94VVC7n5KfpFkGA6UNPdDNviTqQXzmf27LnBONJo3KEcch39oTRagFn+yrkovU7u1F5ShGtlw+HYh0MGV//YMM0W08J59kQDCRRNEUAqX7XGSIa1xi0l+iABq0xgH1RZUhqatg6CaRxVxVIZat58JBoa2xdKIbD2GsYSO+t5t5WljBpjS2WkSfChCDgd40LY1KOVJFStiwLNWoLn3aNRlxRKuJUMw+qGKkMP0P9ht2ylwiVflpVyznKeh8zdA2HMHvzdtt4zihTKTZwmhShsTmkTnSdf5qRSnIIltxtVe5bRbjKfj5fric6FYee1J9CgNCmGq4WEsXX8SPk1Rg2S4qdP0KlOC6Mg+3Oz81upowli3DymJrYDhu1jgZB4h+odkvJC/eULjFWPh9B5lXZFj7yKkmTl7+gx+t/n5/fjaDX1lrIssVvmyKDhuHXWbIft2cpIZyU7OnYEuffyLgSM0Qq1ZGlvbMzOhrOh7QTnEXlHuSNQLxF8AEt2H7QflGA86XCI0dQhOd9E9CIJWMLoSxn+KNSQkCzKp2etuB3VBEEeQZVCjtqVaok BSmu6RcQ mGMXI6kz/PQ2sW7z8hvrxV8s4hEoYXGgm5ftdah3/lCDvR4Px5DBRFKaR86u7caHzix8lSqFY7q2n03ZqLGJKlmKFRhzyi5Clm1cbXoVzMmouIolM8PI4yzvkTT4+RIbhqfhd3A72WCW3ppIKxEDcEcviqOKEWMuEJZ3wmnJ7UPbxqudkpFkayl1ZFOMvUF6hvGIixn+LlT2BMC0xLWBKLiZn2opMFAuGTDOg6Df2aQ9xOMCsrpaOuAHReFK7jve2AEnQViqJp0I6cdr6PjGVqI3NjWhSEE2a4+o0sqeskRBCc/ZCUAljeFiy9iWnRWHxWMKuas2aefKPOoKSnHMRYeazj6vhNTkgwB5Lq/EN9xUvm8g= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000130, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: It should be possible to have inline functions in the s390 header files, which call kmsan_unpoison_memory(). The problem is that these header files might be included by the decompressor, which does not contain KMSAN runtime, causing linker errors. Not compiling these calls if __SANITIZE_MEMORY__ is not defined - either by changing kmsan-checks.h or at the call sites - may cause unintended side effects, since calling these functions from an uninstrumented code that is linked into the kernel is valid use case. One might want to explicitly distinguish between the kernel and the decompressor. Checking for a decompressor-specific #define is quite heavy-handed, and will have to be done at all call sites. A more generic approach is to provide a dummy kmsan_unpoison_memory() definition. This produces some runtime overhead, but only when building with CONFIG_KMSAN. The benefit is that it does not disturb the existing KMSAN build logic and call sites don't need to be changed. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/boot/Makefile | 1 + arch/s390/boot/kmsan.c | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 arch/s390/boot/kmsan.c diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile index 526ed20b9d31..e7658997452b 100644 --- a/arch/s390/boot/Makefile +++ b/arch/s390/boot/Makefile @@ -44,6 +44,7 @@ obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE)) += obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o obj-y += $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o obj-$(CONFIG_KERNEL_ZSTD) += clz_ctz.o +obj-$(CONFIG_KMSAN) += kmsan.o obj-all := $(obj-y) piggy.o syms.o targets := bzImage section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y) diff --git a/arch/s390/boot/kmsan.c b/arch/s390/boot/kmsan.c new file mode 100644 index 000000000000..e7b3ac48143e --- /dev/null +++ b/arch/s390/boot/kmsan.c @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +void kmsan_unpoison_memory(const void *address, size_t size) +{ +} From patchwork Thu Jun 13 15:34:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697010 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 6827FC27C4F for ; Thu, 13 Jun 2024 15:40:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D9EF6B00B9; Thu, 13 Jun 2024 11:40:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 08DC56B00BA; Thu, 13 Jun 2024 11:40:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF6406B00BB; Thu, 13 Jun 2024 11:40:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BB2E96B00B9 for ; Thu, 13 Jun 2024 11:40:03 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3B124A01A6 for ; Thu, 13 Jun 2024 15:40:03 +0000 (UTC) X-FDA: 82226276286.29.7103B9F Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf01.hostedemail.com (Postfix) with ESMTP id 03AD940014 for ; Thu, 13 Jun 2024 15:40:00 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=OO19bEtV; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293199; a=rsa-sha256; cv=none; b=NGJY+vIKBhoCT9xx4LmhtlMoeHlB+MBcmAC0G3MfWW3Ai+bgDhcoR7a2Xs1OUcorrQ6vuE 200ex+rAhMLU33/7Et05A1lzOSx9dY5AYSkz/sVPM94K25MFJ6VNcmKjOaXBMJuwH5OXd9 ZsnTF5fGNCU4VxN47FO+e79j6iQQVFE= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=OO19bEtV; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718293199; 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=WE3ASvt90HWWKhjLUTLn3R+jUtOfzIMMtdYDGL1//DQ=; b=E5NVh9+xgIPezeqvCWA2vaBGubU4/UQXzK9JvKw6+Qn78hhqeWQnp0VyZ/IcqbxmW6ANJH wrK5IZEL5CqTZy6i2g9H28QWqgtzZU4turC1wGSwRfY1tA+1omZ2zi5kmQSlFh6PR3R8e2 rB1SQ0nLmp1LhwFIBlU0mkK+8g7KKKY= Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DFb2rh029023; Thu, 13 Jun 2024 15:39:53 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=WE3ASvt90HWWK hjLUTLn3R+jUtOfzIMMtdYDGL1//DQ=; b=OO19bEtVtKBKVVcGKT/C74RqwSa1B qUSDYpILt7gsTYZ7QNSrXBWsFScxl3omhmJiREfBpMMkmWTb0cjc6NCS9iVQ+Au+ /aDcY0nqk8+BwnrNlMoRiQPszpt72+3N3ypN0lHAunKmu4cbOZu0d7SFVvpqO1NN 4swQz6QTIrMpwCQPMlS/QTHyAjt9zpx5/0Ma0Dg4dSrsNpeH0B868z76mXvusZsf iqaDGJ2EfnSsPOH+ttK177nrI1g9NgzYWNerAP15YXY0u6ODpqXfugDNX1nwBIQD ILs2Ce1u2e+aguMnduSfcN49CK7NdFuFn7W5+HeU/MJNhH3QJtWLQb3Jg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr320r339-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:53 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdqjx002506; Thu, 13 Jun 2024 15:39:52 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr320r336-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:52 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DFQIkC020048; Thu, 13 Jun 2024 15:39:51 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn34nh0cs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:51 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdjs034407104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:47 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F1C12004F; Thu, 13 Jun 2024 15:39:45 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1CB012004E; Thu, 13 Jun 2024 15:39:45 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:45 +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 v4 23/35] s390/checksum: Add a KMSAN check Date: Thu, 13 Jun 2024 17:34:25 +0200 Message-ID: <20240613153924.961511-24-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ulTkjm7pMVe1lJk0PKbDneTOx4OY0nhv X-Proofpoint-ORIG-GUID: 9ji9F25my1L1xSdWHnNVFlCBm10zOxYa 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 mlxscore=0 adultscore=0 mlxlogscore=936 spamscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 03AD940014 X-Stat-Signature: dbbww637krym81eqdboqgxeo8zyeoy6h X-Rspam-User: X-HE-Tag: 1718293200-150471 X-HE-Meta: U2FsdGVkX1+mEz4q2J43qCIa3+G17LGteYKnATbjhHxLQ+2MA/fOStNiRJMlg9HNaWZDbyQPBf1ZUyi1Iy0ShxtukWh8iLbWairwS4gAQolFfiqw/EPsf0e+2z7om+M+Y8uWf0nWOw2P+P8MIVQJH5iMMCs5BZMc68XDcFs/stdA7srJ6ath+b54AOBl5IaCoB6JyFRtYwL7W5a0bTd2I2ylz99RNJLr8OFpN4AJPe9oVWYxLk+P+8uXiBZ/vy4QRU0pePthSoa7XUNZUaNkxUKFOPzPOsjljO4yvKHOOS17Y9mWSU5j13ZgYFgf0nzdGOFXAieN4gKklpcdcRWZhFGsYCk8dF5Kf+NKluI8oHgy3km7P5+sH6PrmvHB8buUQDEAUdg/eKjyIn14QnvpsPQ4/z7w2e+to9fg46pG5zFCicoh5PmqM59Oeq7GSbUT7hF5QatOHjB6IVB1BScmpCUXOecX1dckYctoIHj5GT+277wFR0bNcXMnxq1wqeyEHx+yhOT0Knfzo2tujeh/sfpyDHPgdOWdKhbsy8Yt26NrWFR8PLHyP8dDHJFx9Z+2vlEGV3exaBQLl7uGa+0j/KZyM0+Hto5bBCfH1n6l4i2RbKOUyiov2ZuSgIAnElTBb+qWMYnrJCqy9GhNKelIYW8j0QeQXXHR3qrym0GuZGXA8fv8q0oa19DrVaDo0UeNQL5Y1YPkUUmVU+08hLQR+rSveyaIZUOUoXrxTsujBsqP4DBpXBW6/vENqtGx3HTa4BtB0sHO3N/sQR4dnBLljcI1hFeboQrg3FObNuS8uXma3St9AG3I0ga5/WBwOE//9pkKY58latzwxAr9S7tk0hJ6jvhjZKD4nHvVIsYszq0Z3xLdFeDDBfpOd0zKtjEbVAWgFyvJL5XAv9h9Y37klNeba+EFpKc4C3AE1C9PwQih6HhaAf58b0DFlkhg2TLQMj0Cxrx4xP4yIVwrHro d+jsPJbR JIf9FSxJaeAPMiVeWjWNikoAJTxpvzb3DlOF5f4V9nY4DI2atyB00F/XnQGBaYoNuISd5C3CXhdzKN4ceAY7ek5ZvCldfQ/q/aybzJv44Qsqx989NyVR1zLlHsGbR3CCCNNtInmfwIplY7CFFRKE0MOlBxB9UVOFjbk1Mu7xvmF3hNy6FNnUlKNQx1vy0Q1Ogo1ex0xfAoUFpJkISZJqwFofI/GH/ZtWnthdnD+4Tyj63+yNPtFMEFmKsOPGvDMGYWpltIgzWZNnZh7cM9CIQ6QcOXg== 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: Add a KMSAN check to the CKSM inline assembly, similar to how it was done for ASAN in commit e42ac7789df6 ("s390/checksum: always use cksm instruction"). Acked-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/checksum.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/include/asm/checksum.h b/arch/s390/include/asm/checksum.h index b89159591ca0..46f5c9660616 100644 --- a/arch/s390/include/asm/checksum.h +++ b/arch/s390/include/asm/checksum.h @@ -13,6 +13,7 @@ #define _S390_CHECKSUM_H #include +#include #include static inline __wsum cksm(const void *buff, int len, __wsum sum) @@ -23,6 +24,7 @@ static inline __wsum cksm(const void *buff, int len, __wsum sum) }; instrument_read(buff, len); + kmsan_check_memory(buff, len); asm volatile("\n" "0: cksm %[sum],%[rp]\n" " jo 0b\n" From patchwork Thu Jun 13 15:34:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697009 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 72ECAC27C4F for ; Thu, 13 Jun 2024 15:40:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3712D6B00B7; Thu, 13 Jun 2024 11:40:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 321EE6B00B9; Thu, 13 Jun 2024 11:40:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FF366B00BA; Thu, 13 Jun 2024 11:40:03 -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 E374F6B00B9 for ; Thu, 13 Jun 2024 11:40:02 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A99B41C03B3 for ; Thu, 13 Jun 2024 15:40:02 +0000 (UTC) X-FDA: 82226276244.03.D873052 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf13.hostedemail.com (Postfix) with ESMTP id 712DF2000E for ; Thu, 13 Jun 2024 15:40:00 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=RNt9Kpbt; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf13.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293199; a=rsa-sha256; cv=none; b=qYRFxs4oF3waCOdoRGzaVNkiHlOfTEIoc8lklofFNbxzL5/UagsLB1Xk9ZxY9KZ3UjWZU6 OSHRQGxUyA95smy/SQk0ZxTZo0DVXNoQgd8ESi96YPenLKJ7X5ZGY8s22jt9Hm71LNbRhF uXgYDtPyR94CwwOWtbppqhUJxknlrgU= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=RNt9Kpbt; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf13.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718293199; 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=tPY2/xfj0WoITwfgq4isE+nahUee+x7RgpdrRutXdLc=; b=lIYJ3lczVu7eLt6U0mM3/T/UOwDNImvubEVzQ/qIcJ0aXY3n+9pOy4Hk6Fh4hr6RFHvds6 7ZK9j1H11dnyckkWvzP1ZyTHh2med3BkEErDj6zgQN3B0Y7EAT2jGq0aCpq3jwvGNg6Fb9 AZjLZtnxaYVLu0m80uP6frZSVUBPWoQ= Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DFQWrG031303; Thu, 13 Jun 2024 15:39:54 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=tPY2/xfj0WoIT wfgq4isE+nahUee+x7RgpdrRutXdLc=; b=RNt9KpbtT8zBkD+WuuQkoJfVFmKu+ RBc4v4DPmomg9KJxhTXgP8qrxggTUGaCDs47zrux0UusTn9FwnbEVBQX8oAbMHwE BM07tWNkcX1Vrvkei0vClxE5jmniD5YF7qz7dybD09S/HpUj9gXOhsRIcX+/55v3 GOWK8oXqqG6Pw1wulaZR4jrZwWT+nBA7V9yxg6xmnzafzIZgurR9rbj5pm7so0J/ 3603+UzkIGPonrxREn4ivyIpoTNoW7725FjQTp5ldA2fMjnCRylHQ8xghvUAuGgj q+Qn0GgicoRg5HbGCpqtQoR4U0Dr/VhLL4WuwjTz7MxsZTfI6lIZT9r7Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrw7hv3h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:54 +0000 (GMT) Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdrZX022239; Thu, 13 Jun 2024 15:39:53 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrw7hv3d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:53 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF9UK0004368; Thu, 13 Jun 2024 15:39:52 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn2mq917v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:52 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdkST44368360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:48 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A5DC12004D; Thu, 13 Jun 2024 15:39:46 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3367320043; Thu, 13 Jun 2024 15:39:46 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:46 +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 v4 25/35] s390/cpumf: Unpoison STCCTM output buffer Date: Thu, 13 Jun 2024 17:34:27 +0200 Message-ID: <20240613153924.961511-26-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: hp04Eoi4U7PgytUYtQKm5O50m1EiIDWu X-Proofpoint-GUID: aOZfXgWJlu59bLyx5qDPGv483tF6W8_R 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=957 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 mlxscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 712DF2000E X-Stat-Signature: 1rpb73tncpjbuij8ft1g8c18o8cm169d X-Rspam-User: X-HE-Tag: 1718293200-661320 X-HE-Meta: U2FsdGVkX1+6knuTI4aAwSuk3FFsVYexd0r/zy78XG2Ea8T6DBvj7MoKa7X2lTXQKEUHxd7rvWrqHtumYpraBZG5BJ1VC3lEAhNmJM1kC/eGkNtKVVAK2vUXQsxlEeNRYG8IWyHSiOtSaMxQ0TrdWU0PCuam5z40EcUtz7uR8zVt58v7jZiXPyV8iPBnIebSdqIXE9lCrPhtys2bpmWBwVLmPnF23ho5rLZDU8sLuSS90Ytu/QH/v5fM5qr7qVBXhev5o+q4imdQOWMyaf78o3NECuAgq+1Gfmja3Hjy+B1jUHxmShxBaoij+tVF0wk8o6JlWwP9FBKuWfa9RPPcUATGjYfoTuGreBJMzMwmdZqEKajH+3EyXsn1fiJB2kuzFyw6HMezD59oiLTcCZ0l/gztENTpzRzWw8RiwghnlBBOOdho3H9DsSEEUMIfZ6CyXabZJrFP4OHCgF2Q7rBKG1EJq7hNRnEv/LeNDlVMP1IWiLT+wdq7El5OgKy6VgsdsopgJZ+8EOhfduxu7r3EeNskpKIB0vNc9F8ymAiu/xIfvx26AOP91TRwWSXYNVudTrYNTTZj45MrUUBVs7yNithN+ClksNGE2mU1ge9g9tECylVU7opZplkoBffaEMYve+cwvQvQPQ/CfYM/JJZIMNwarudIQl+huQD+cmxZUGrppclh5FSa9IWxqlcCylNjODJHeciraJrF+eMbWKGDWTOcWjr3VOcwqe9KlUX7nZZI09XowBviB31tAcNGjIQUOS+sSJqSrOpKut0R5585e/tmydgM8PG2BGXqCbY0B+smpPhewuFyikQIYx4L0f2mT30UV80taDKlxh7d32IYGtxHw77mmkBCbaGL0WwRKNmF78QPPelzamx7B0xbep/rLBCOp/wRpfXFf/GVzgzcKn5lgQ9PXz6cXCsiiaRXjhO4cmmPqEsl7MSuBP6HcLXefzhOL02sYnO5wNb5iGR z+lIz9eK gqvVTqP0rTXvDvPwYLCGde2AYXkSjJ0dzVdTFbVGhvvg7UrKj4lDJeodQGtHl9UfNvdxEkf4pmUgPDDr2mtZMxoDUbzJONV4bl7RyGUMWV52VURXEJ81L70+f2elc1k1mvxBCZKaLe5HC1pxfevl37f6plYu5mzlmg1MWOx5JVWSf73CDPYeRgb8jbkUlZiK65cIkB3wnwG9Hx7qkw3mMfNS38PiYLKDwm2o5cugxHI5BUOxYCFMBUpaE2w== 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: stcctm() uses the "Q" constraint for dest, therefore KMSAN does not understand that it fills multiple doublewords pointed to by dest, not just one. This results in false positives. Unpoison the whole dest manually with kmsan_unpoison_memory(). Reported-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/cpu_mf.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h index a0de5b9b02ea..9e4bbc3e53f8 100644 --- a/arch/s390/include/asm/cpu_mf.h +++ b/arch/s390/include/asm/cpu_mf.h @@ -10,6 +10,7 @@ #define _ASM_S390_CPU_MF_H #include +#include #include #include @@ -239,6 +240,11 @@ static __always_inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest) : "=d" (cc) : "Q" (*dest), "d" (range), "i" (set) : "cc", "memory"); + /* + * If cc == 2, less than RANGE counters are stored, but it's not easy + * to tell how many. Always unpoison the whole range for simplicity. + */ + kmsan_unpoison_memory(dest, range * sizeof(u64)); return cc; } From patchwork Thu Jun 13 15:34:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697209 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 BB959C27C4F for ; Thu, 13 Jun 2024 17:37:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 309AD6B00BD; Thu, 13 Jun 2024 13:37:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B7A96B00C3; Thu, 13 Jun 2024 13:37:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17FBD6B00D2; Thu, 13 Jun 2024 13:37:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EDEA96B00BD for ; Thu, 13 Jun 2024 13:37:22 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A0A1816025B for ; Thu, 13 Jun 2024 17:37:22 +0000 (UTC) X-FDA: 82226571924.30.4B1FFC5 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf23.hostedemail.com (Postfix) with ESMTP id E0800140004 for ; Thu, 13 Jun 2024 17:37:18 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=S+yKKexk; spf=pass (imf23.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=1718300239; a=rsa-sha256; cv=none; b=mHJj6bQpAvG9JA+F8r2Wyn0Q6uCxABorW9st9YQNDXKFdNE+U84PYCl+4UgeqApqu1xJad x+N8R73NHRdgsj0/e6E5UhXXe8jcUnHVyuiVFws5MwwRTn/YciHieRLOv4f5TE7hWrr2Uw aLYVZ1BnmEPm+ar/fD0cbTgM4d7FzBc= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=S+yKKexk; spf=pass (imf23.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=1718300239; 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=fXcYk+VdmTRPCkYYKoxIVDK6lI96vBOrCjw2t1Z32BM=; b=wlyhd+NrKQQMAn0bo4jNGWt5CQVv3rK+LIuzN20sB7sSQPwe6oDxCKoyzxN3M3qU89YrhH CmX4oAGONYQunEeUe9vsrVJjDv6r9CvCbka3UQNSM53/s5ErzDlIvGX7GTlYIa0NBivYVt aEJ8Ag4LaoxbWxZxIkiYSilStk5835M= Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEZMqu011319; Thu, 13 Jun 2024 15:39:55 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=fXcYk+VdmTRPC kYYKoxIVDK6lI96vBOrCjw2t1Z32BM=; b=S+yKKexkhzK6llI32AH9rCLuxFk7Y MuK0rSwnyynnXT2Of/r6V1Z4cZA9AwA+6y86s5MYcZ9F4AkoFwokKBegDvw+RS85 NL3G9O7h2KGgiYWy04i4/MUJdQC3A+LDg9wFF7ybPScd4ohOfuakUuIJ6ICO2Dr4 oUMUJQuFgVV64aSPvj8bsBr/l/LrqKUYAopuE2hz/iPX0iE/P2CxGY6bXsjOgBOK T8ptqc4MpL9vq+zGPXybfYWw/30rswf0CmNmZdCtL7RlY2c8Nj/E16heHyo6zVCc 7empj83Z5CUppmcsASS6xp11XGDrEjPSyl9UiwuiDu52VIi3xnDWKUk3w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqx9b11u6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:54 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdr6p006622; Thu, 13 Jun 2024 15:39:54 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqx9b11u3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:53 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEIs5l008716; Thu, 13 Jun 2024 15:39:53 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn4b3rk1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:53 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdlCw34538120 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:49 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36F3820043; Thu, 13 Jun 2024 15:39:47 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8B4120067; Thu, 13 Jun 2024 15:39:46 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:46 +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 v4 26/35] s390/diag: Unpoison diag224() output buffer Date: Thu, 13 Jun 2024 17:34:28 +0200 Message-ID: <20240613153924.961511-27-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: sBifeLqkoYZGxv3xk2zoKYFp6VPoCgvk X-Proofpoint-GUID: m5hntwp6bIJOI40CcQ7BmmQ7MU6AE2Xn 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Stat-Signature: j55wbirinn8pj6wifyi9qbe3yb5u5k5n X-Rspamd-Queue-Id: E0800140004 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1718300238-439559 X-HE-Meta: U2FsdGVkX1/avKGm1NuuivfwX/fMxU6fgisJIbmLYFDD3m9nyI9nKIJWsn86hJdkO4OXN2EmQ8ny3vKihIldWcAnA8gPizk8BKKj5xdLS/WZE1kx4MdOYa4E4nxcBb4zvzAUcfEQIE9Tj+bu8aoKyR1+WUuqKP2Jj7A3wsTOHET7IbY5kacRKxmvxePqaIH+OzperH5P4ZJEzBCXo3fLKEabJJPvW7xQEP0sGCQh4YOBwidOJ1EW1N6t8e89HSd56BSG03P3YiGof9vp/HyWnMYQ7T+yTY+rClzd7Ulyi3Gnai0F255kqnEp2i7p3WLw1ij2knMTLGUBBTtVLvX9WwiT7SP+MeKWiEoyvUjy5jheLRJxI+Ofpx2+3lUL6r7JCFWsLdPp+YyiDOB4vspxpYwKmWRIdIfpRDHR79VjK8PBOecTbK22ZwLapHnJT/PS94WryR0dFTCOEJHV4C86xZkTuRYYTYMvrHeoInLQMrg692lgMK0/reZ0XskLKDagFZ//paQICzi2Q7NfPHIm2zeRewi2sZRMlnJ5fVbceBYfAYGII3+9wYdsGIpomvIOBcGa5Mla+mVqT3FJX9jOnPg6fIb9lREENB5MVmNBndHNk448OfmKN1pxnGvFYDqj/ka8mcmF7Pv580zz/ftq3P5eDcjkmPQkD+w4sZS36yuvEuGACAQpqppAFLKLpOZQbJvZ16ijvi7kl8R0otiINY4IukRobvcHCXIf1RZyNtBHUKR4zzPqnzzQ92Js4IgS6QF7BxV1qMKDfXg93WMaoJL+5LI9qvm6KzJ6m2PfADJfM/jD2QUAjToU6ERjTlCYaspbmERZciru1JveiZZmPGuTMTJ9fBlUPWTevdt35QcTW9SmgzBH5KDQJR+B7q+sgqOClgSPsIY0qd7n9U29CoSkQNb/7gMkBabLR3pkri2zKcRq5OlId7ifRdCfnYGjJ4DPMy+l7JLQ5T4rxiD jujc0GBh hrTQBmO2e1uls/f/jZJtn5MHQkk1bbEQSpkAWxcbC0OPQjW6Lalraps0yK3G5oGxWAPpUfCHQc+jg+12PqUf1FpG6q98VVBO/cEIEnomPeQdAe5RnrTxne7jS4eVPrtWBlsy5QtAcu/T03LIsKu2sRJKUIXe12wdVADZHO+kQFnQ5ikSbbL54jbxnS9tvT5W4vNBe/WJCdAICSGj4vtFmHWAs5seJAmgIOvaS+DaDsaButGnl2MeYEV9OVwR/EW/npGF7zoYbzz5cU6v3BqVa/EgGLXV3HrPKogU818Y7NENlq8rmSZ++4b8Xq0Y7Y5SuXGmUWRolhzCQ3jMapN1IrugkVg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000070, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Diagnose 224 stores 4k bytes, which currently cannot be deduced from the inline assembly constraints. This leads to KMSAN false positives. Fix the constraints by using a 4k-sized struct instead of a raw pointer. While at it, prettify them too. Suggested-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- arch/s390/kernel/diag.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/diag.c b/arch/s390/kernel/diag.c index 8dee9aa0ec95..8a7009618ba7 100644 --- a/arch/s390/kernel/diag.c +++ b/arch/s390/kernel/diag.c @@ -278,12 +278,14 @@ int diag224(void *ptr) int rc = -EOPNOTSUPP; diag_stat_inc(DIAG_STAT_X224); - asm volatile( - " diag %1,%2,0x224\n" - "0: lhi %0,0x0\n" + asm volatile("\n" + " diag %[type],%[addr],0x224\n" + "0: lhi %[rc],0\n" "1:\n" EX_TABLE(0b,1b) - : "+d" (rc) :"d" (0), "d" (addr) : "memory"); + : [rc] "+d" (rc) + , "=m" (*(struct { char buf[PAGE_SIZE]; } *)ptr) + : [type] "d" (0), [addr] "d" (addr)); return rc; } EXPORT_SYMBOL(diag224); From patchwork Thu Jun 13 15:34:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697011 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 B2B25C27C6E for ; Thu, 13 Jun 2024 15:40:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B15966B00BA; Thu, 13 Jun 2024 11:40:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A73326B00BB; Thu, 13 Jun 2024 11:40:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89FBB6B00BC; Thu, 13 Jun 2024 11:40:05 -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 671296B00BA for ; Thu, 13 Jun 2024 11:40:05 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 234371601B5 for ; Thu, 13 Jun 2024 15:40:05 +0000 (UTC) X-FDA: 82226276370.04.7942DFB Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf07.hostedemail.com (Postfix) with ESMTP id C1C054001A for ; Thu, 13 Jun 2024 15:40:02 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=UNq2L3ci; spf=pass (imf07.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=1718293201; 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=lwqEGphQg9/N4AE+qTFRbf/COwqV90p8RxwOJfRaDvM=; b=dkcfzLWEcZEB44QfXCz6M7cDL6p/hmAXpTGzFPHYuXDJMXDYRpKJGP+9PH9ynNOUoCtX5Y F8SQycMGRy/PFHacHRBqv8RS+TLwyHDbpgSXfxD3mcSm8MOMQFJseRB6jd9IuvMLuL7gbF enGs/Ig/W56++O8+x6iqCW4bHSw1RPY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293201; a=rsa-sha256; cv=none; b=LkdwBsZ0yj6o+i/xtpl0vF+sAhaHdOsX5Kx5vSYtUIA7zc4+f/N4YuLbS/rUHxizNcDTLz lZKgEGwWUZS4Dg3hnoi9keJ7b3JZhLjzSolLG1YQGdo/Heo7IgYNUtMHosOMdDt+5Hrjun Ul93krGx2Y9mpKFexhcmk22LXtWhJCI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=UNq2L3ci; spf=pass (imf07.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 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 45DDPs1w029160; Thu, 13 Jun 2024 15:39:56 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=lwqEGphQg9/N4 AE+qTFRbf/COwqV90p8RxwOJfRaDvM=; b=UNq2L3ciAeXeg+Kl5XrEnosDMTAs8 Fo0GmDd0p2UK4sKNA+8i22Z8U/Dtg8kijuN9KTRbaw7Onv3/SzsxFjcX8m9szLB9 k2Djo/VBBYJIKWkLW8HNMFMz2b3mt/mhnRiTwtdqipTrQ+CjALv9hB9Da/8mVwSC ond/9p61WCawUt2YtMJPw3EW0SbA+5kxbGVdLvnSE3NyrNainusnb4tf5ycXcIWy 7qMIEUhdiGKj2xB5XJ+3lJgwZtP3+rKwTq2nT9lbIgkk4Z0uyDouP9RGbFq5zoNI apQbgPmsZ+J8hgHp+LPiNO59yOAMgMlkJ8Ouu7nMw/dY8imTQ5EE05BvA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt37b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:56 +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 45DFdt6d026856; Thu, 13 Jun 2024 15:39:55 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt377-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:55 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF54oG020086; Thu, 13 Jun 2024 15:39:54 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn34nh0d0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:53 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdl5E31982318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:50 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC8BB20063; Thu, 13 Jun 2024 15:39:47 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 49DC72005A; Thu, 13 Jun 2024 15:39:47 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:47 +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 v4 27/35] s390/ftrace: Unpoison ftrace_regs in kprobe_ftrace_handler() Date: Thu, 13 Jun 2024 17:34:29 +0200 Message-ID: <20240613153924.961511-28-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 2CzzALgI92z2xp9DoNxArLwRD-45DbUj X-Proofpoint-GUID: vaNzi9dxYUytn-myd3xb7t8cTOvep84K 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-13_08,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130109 X-Stat-Signature: yp7bboiho4p5i378tco34mkdxdjinc3k X-Rspamd-Queue-Id: C1C054001A X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718293202-873320 X-HE-Meta: U2FsdGVkX183iwY4KqJC8iFy1tqEhbbZpS4YFlQsJ7b8DpLUesCbOE2MoiUuMA9WyaXmz72m0xC1C6nUxFftkvlUewj6UZX1q3mOtHhUePaefsgJUKdQPmTA6FGQerV94tTgyKJ7b+mhpQlQCpNOt8MhIRyr6UM4yW4gMQWlPveE26JrAhotHS25wcqk65/w2XyKhTmCiFOOy0C3gUCgpvIH+o1cwsttBJsFPpFOKE2SHojUCVsKsim20PyFz8e2C6c1L4bwOMToglHXlwW3G03eCYTg66px49+t4jbA1eu3XVEi4Z3bfJvQZzZ307H72sAnSvtm3ErBr0+nhWcmKzcNMlR/3GqbSqyyfDTkolifuuOCqOr+7h3fsg21K0eHWiCEcyDgffKWAwN9he4KTv+zbQ3pQkVhwB1oawpu7wr7KABibbEGuBMvhLz9Iriw8perOriNNIjiShlGNVtVQhWOs8OOaNE8Se+ksc4g/z9fVerwb7dCNPhdeh653xRtzz0u+8RTPx7DpvmY1xObvcCE7i4P0VZ8naxhdwX5soKFvsqmgqc6M5v3bK3j06qruIRN/rPU5i1fOI1ayVcVvemrz9TvH/MVFMx6yVwzNVAQKt0THueZOUujSU6ERBxlM6KpaasEjgiatZaDDj1VPXOWYMcCKXA7bs+Xw9LCXttxVG7C/uAmil/W/+/WfwEVuROUNZlGlkcRVAZSx1Fxd8qPf7crq1kaEVejXFPPziObKGcinyPnnR900JzBioK5WWezQf2ieOqGbPnqFKjivhB2yiZDd53eLeYkgQV7CV+ZXrRmANGsUiPfzjdaMNhNNUvKOoAjkmKJ4Y/DdHIhzr/qNQnayA0I9QxIdsXmFBvPTcJENLg+wABcWjICjrVQ2vFO74AwVQX6L9S/Ph58bDupYXgxtFrwcy+0ZXZTkrxLE+d0UQ3I3ngXr3SA0IWlAiAPsmsFYLP96Bdb/ZO NJO/+/vE RdTOAhJ2ueoXTK786cEDjgtNx41NTwB3RWeXj54yzldjS0KXn7MTGKOK10ML123f7vyKciczGXRJjFiKsN++lk67gJfXAgEdFEo1KtbEUNUA1fln3x6yOjavFVDMHyE1xTXViDJi1alw/6OiPgBPvmmmR2LWUBBkLAzMSkLgKWgCfsngCGJ12zKtbqFCu4OIo89NflyR16ltAUJQmv81lgmJfQfvyWVGn9y5Y8SVqVRod1QF61RUclFMo+CDB5vVtfwNiE++rTFwqnBFC0smw5ev/4fGRcKZ04tQmXubJVdxJMd9KiUxgzNe1CPSIj8FG3ag0 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: s390 uses assembly code to initialize ftrace_regs and call kprobe_ftrace_handler(). Therefore, from the KMSAN's point of view, ftrace_regs is poisoned on kprobe_ftrace_handler() entry. This causes KMSAN warnings when running the ftrace testsuite. Fix by trusting the assembly code and always unpoisoning ftrace_regs in kprobe_ftrace_handler(). Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/kernel/ftrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index ddf2ee47cb87..0bd6adc40a34 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -303,6 +304,7 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, if (bit < 0) return; + kmsan_unpoison_memory(fregs, sizeof(*fregs)); regs = ftrace_get_regs(fregs); p = get_kprobe((kprobe_opcode_t *)ip); if (!regs || unlikely(!p) || kprobe_disabled(p)) From patchwork Thu Jun 13 15:34:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697166 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 81C0FC27C4F for ; Thu, 13 Jun 2024 17:05:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E133B6B00CE; Thu, 13 Jun 2024 13:04:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D9B686B00CF; Thu, 13 Jun 2024 13:04:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C14AE6B00D0; Thu, 13 Jun 2024 13:04:59 -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 9F4676B00CE for ; Thu, 13 Jun 2024 13:04:59 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 57D7FA025A for ; Thu, 13 Jun 2024 17:04:59 +0000 (UTC) X-FDA: 82226490318.21.020CE45 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf09.hostedemail.com (Postfix) with ESMTP id E20EC14001C for ; Thu, 13 Jun 2024 17:04:56 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=oNvZmbF4; spf=pass (imf09.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=1718298295; 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=+zoFJVlk37wQaOMfwbNCgteXo249s6T95ikp3xQJB1k=; b=cXLlUUr1Km8Yv8jaqJBVt7aOdq2hJduPJx/DhiPHrlypANOANaJXYzIVDsWR9mtZ/pE504 X8sKGk75f98C608Lab20ValAZ2C5yo6lCE9oFugNoCE8xYICnqxSNbYwtaqUl2OOZbOmry YWltZNaxB8GcaHkctDuwu7lyk8thX/A= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=oNvZmbF4; spf=pass (imf09.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=1718298295; a=rsa-sha256; cv=none; b=TPNebnerkayPtSXqiuQt9j0zLwzA1BKxOIK6fpZIzBJl3gnrRCzwHKYNezRTk/AJIdhLiY B3ZrS/W5lDZfsos8H5u4SNDMEqHhLgIJ4fJ85uyui0oJqyYtSJpd2/z/+bKse8WoaOO7O4 WeYKUKGCRcv1kiXKGbPLz9X0ymuyUwU= Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DFL9hI017855; Thu, 13 Jun 2024 15:39:56 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=+zoFJVlk37wQa OMfwbNCgteXo249s6T95ikp3xQJB1k=; b=oNvZmbF4K+Py1jf/5icbM1AudoXW6 51g5mW81oXPABJVfl8cQQxY3isYOHx+0CtD91DheqYBN1CvQdqdnq1/qYi/huM17 qJ7rNH3AIB2rwIvQ2syI5/tT119S5UFHqCa7KPrKf4WG6zWhs6nIxwuOY+esRb4d +WALCQPp12bTjFWplrH+wwfiJf0y+eOYLubrXjMiZrjMnlsg36LecYlRuy7szI77 IXTbPjlwSqvAZ+HeuuFiDUBy8o1qyqEsW+LzKCg99vjB14Mefn3jyeDIHERevoUT u/ZLR9cl/KRaMelg0dT1w8/AaJs+wV1bp14CC60HlsFLfQuKV4+EV/EKA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqy258xxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:56 +0000 (GMT) Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdt94021165; Thu, 13 Jun 2024 15:39:55 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqy258xxn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:55 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DFBb7N020069; Thu, 13 Jun 2024 15:39:54 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn34nh0d1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:54 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdmkh52494780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:50 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E2152006C; Thu, 13 Jun 2024 15:39:48 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF64920065; Thu, 13 Jun 2024 15:39:47 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:47 +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 v4 28/35] s390/irqflags: Do not instrument arch_local_irq_*() with KMSAN Date: Thu, 13 Jun 2024 17:34:30 +0200 Message-ID: <20240613153924.961511-29-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3YJV7_fgCmflF5r_am0hLna8GcLzFF1F X-Proofpoint-GUID: _271Y5yjDhi0fa7CjP4Omqz2uyCbtCUn 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: E20EC14001C X-Stat-Signature: ethrc8bbw7trzjuk6ngxcui8zkqgxpet X-Rspam-User: X-HE-Tag: 1718298296-851660 X-HE-Meta: U2FsdGVkX19rFwqJStqmY5uHmE6NGxIJ4qa6phU0QJjqMQO/F/pbJzcWGBNhViY0yWaHyTEq1JgiYn0ZmkBSjY/CR4WGFehvt+NPFO1ZnxmF4vbL2xEZ4M3G7fj8Tyr6KFA9hKRCcD1UAtZrB8w48YAm6zWZMrKSSmbzHVbVsst4feCixN6WwxP+ekWgPQiVsHTp2yAM2QPR58+OCf8go8f4KayxJmwkJcDAZIh6HYsHQ48trcxzo1JeED52G0SL4J6T3Xgg5Xjj63YYSS//scdU9ZWXtUXrjrMPksM5ksCBvhqUSb5crnng36l8l1fK0wWYZztx4TZuF7n5RSPD35UyGo+E9Likwnb/JPPUmlAN/C3e+Cg4kga8Z5auAjyUjxKcoT+HOpfPz/a4wowPk7t49MRX1IFFjDQziP8Sy8NSXrkYu7gH4z0Qi++e7HeBWoIwOtRHW7KXBC6uLLAx+GbbkCkTQB49MX1NXgDLRJs1nEzqBwPB9g++CXjPLFNSLu1WoXxFPMwfxr+OHHVfyTQbYZ9IdGRz2gzfv0UZrcLb5zgVn81SeGhnBFNGgI92yV9jFAR4Bne02VMF+1dyEeE8C5IKsvcW70F2hgBccBO42WdOR3CLHrOJ/LegscyzP1CEHD6ogLv5BUvjmVfZF1tJpD24qUz4s7Yrt2FJJ0U1DdYT5Q0tRqPXSKnkVeSfUh5Q+HHXEbvKHLNt1Scv2h91zkr+kMmUXhpvMCnF6X/UH8MvX16H4Jkes+Yq8cGRsN//wWwzPmffGF8H84jR5Uy78NpMw4WY03UriR/jZ1PFWqBaUu78sPhnCC4fo3NFWzdhU/T1VPhDKx8kaRa79P8Aioj2NXCBipiVUV3NBLg/dj5RJUgX+A2YvzHsiIlZ8R/idDg1ERGxsQRt4MMVgz6ne8ZgNRFwTWaZLLjtCeIW4vjhqGrmEHRyt5qDTNo38WDeQ2dLsogadkRRz3u RMWSFaH3 vBeZxAiDMqPC5J0XoFOjX3n69+zSUnlarano1szo4CCOE6Tt+J+OQ7ByXJx10K54SoRmvwbnr2Nu3hDy3NfWYIG61eW9yt11vyddWFCpdIB8xOkJm10GDmmzI2By+6AXAm9aEwvkjmhF4ccZMuyDzKkG558i9JcnSMJQYuX5xujjxft7uG+RtXKqUVylXLsHornnqTVLSSRm7yQeqjQ6jiZ4KnpPofDpwwoVlZofImEoVdlG1Orv7VPqc1131GGqFYx7KP92kpCS/lYdeZlJKDy1fTDoYWNVWvcRzTZ+oJ47VMsVa8h5k32cg5iNS8n7Byafd X-Bogosity: Ham, tests=bogofilter, spamicity=0.000010, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Lockdep generates the following false positives with KMSAN on s390x: [ 6.063666] DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled()) [ ...] [ 6.577050] Call Trace: [ 6.619637] [<000000000690d2de>] check_flags+0x1fe/0x210 [ 6.665411] ([<000000000690d2da>] check_flags+0x1fa/0x210) [ 6.707478] [<00000000006cec1a>] lock_acquire+0x2ca/0xce0 [ 6.749959] [<00000000069820ea>] _raw_spin_lock_irqsave+0xea/0x190 [ 6.794912] [<00000000041fc988>] __stack_depot_save+0x218/0x5b0 [ 6.838420] [<000000000197affe>] __msan_poison_alloca+0xfe/0x1a0 [ 6.882985] [<0000000007c5827c>] start_kernel+0x70c/0xd50 [ 6.927454] [<0000000000100036>] startup_continue+0x36/0x40 Between trace_hardirqs_on() and `stosm __mask, 3` lockdep thinks that interrupts are on, but on the CPU they are still off. KMSAN instrumentation takes spinlocks, giving lockdep a chance to see and complain about this discrepancy. KMSAN instrumentation is inserted in order to poison the __mask variable. Disable instrumentation in the respective functions. They are very small and it's easy to see that no important metadata updates are lost because of this. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/irqflags.h | 17 ++++++++++++++--- drivers/s390/char/sclp.c | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/s390/include/asm/irqflags.h b/arch/s390/include/asm/irqflags.h index 02427b205c11..bcab456dfb80 100644 --- a/arch/s390/include/asm/irqflags.h +++ b/arch/s390/include/asm/irqflags.h @@ -37,12 +37,18 @@ static __always_inline void __arch_local_irq_ssm(unsigned long flags) asm volatile("ssm %0" : : "Q" (flags) : "memory"); } -static __always_inline unsigned long arch_local_save_flags(void) +#ifdef CONFIG_KMSAN +#define arch_local_irq_attributes noinline notrace __no_sanitize_memory __maybe_unused +#else +#define arch_local_irq_attributes __always_inline +#endif + +static arch_local_irq_attributes unsigned long arch_local_save_flags(void) { return __arch_local_irq_stnsm(0xff); } -static __always_inline unsigned long arch_local_irq_save(void) +static arch_local_irq_attributes unsigned long arch_local_irq_save(void) { return __arch_local_irq_stnsm(0xfc); } @@ -52,7 +58,12 @@ static __always_inline void arch_local_irq_disable(void) arch_local_irq_save(); } -static __always_inline void arch_local_irq_enable(void) +static arch_local_irq_attributes void arch_local_irq_enable_external(void) +{ + __arch_local_irq_stosm(0x01); +} + +static arch_local_irq_attributes void arch_local_irq_enable(void) { __arch_local_irq_stosm(0x03); } diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c index d53ee34d398f..fb1d9949adca 100644 --- a/drivers/s390/char/sclp.c +++ b/drivers/s390/char/sclp.c @@ -736,7 +736,7 @@ sclp_sync_wait(void) cr0_sync.val = cr0.val & ~CR0_IRQ_SUBCLASS_MASK; cr0_sync.val |= 1UL << (63 - 54); local_ctl_load(0, &cr0_sync); - __arch_local_irq_stosm(0x01); + arch_local_irq_enable_external(); /* Loop until driver state indicates finished request */ while (sclp_running_state != sclp_running_state_idle) { /* Check for expired request timer */ From patchwork Thu Jun 13 15:34:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697126 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 3C602C27C4F for ; Thu, 13 Jun 2024 16:33:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA4E36B009D; Thu, 13 Jun 2024 12:32:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A51626B00C3; Thu, 13 Jun 2024 12:32:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A3CA6B00C4; Thu, 13 Jun 2024 12:32:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6287D6B009D for ; Thu, 13 Jun 2024 12:32:59 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 004E6A0260 for ; Thu, 13 Jun 2024 16:32:58 +0000 (UTC) X-FDA: 82226409636.18.E48A17D Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf02.hostedemail.com (Postfix) with ESMTP id 6A56080002 for ; Thu, 13 Jun 2024 16:32:53 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=HmIS1qUj; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf02.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718296375; a=rsa-sha256; cv=none; b=OYjkw5V9r8TCswcWs7tqZq1TUL8XC+pOrgmdlXrfQ+WJljrDfEm+PNGmBELND8+n9Vpaxb F+WU/9YUCYGFvJH8+ze0vwUKlC0VWXajMC6Mh81St7INcMPt32gUsTIgj2/TdB6ExBweNp RZdW3/x68qWUJFKwjkig/ferDa/ivi4= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=HmIS1qUj; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf02.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718296375; 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=Lf8JDXEAibfeu4y+WuUMeyCObr8U6xtLlRth+wjWPFs=; b=bvSZFIHtrKyCAqDnUeUGQGS1279iBBMmHk7EN7Vp/p1nv36FClc3F8r9b4xjmsJBU1geJ2 d14prPYvkh/tAXizPse86e5HQAdtHzTTD2Q6/RgbETkvPsIefBr6bH0UmGfIVnsnh3RtqD 7yPl7TL3i4jMhufkiOny6drnVaprj8c= 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 45DFMPaL026307; Thu, 13 Jun 2024 15:39:58 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=Lf8JDXEAibfeu 4y+WuUMeyCObr8U6xtLlRth+wjWPFs=; b=HmIS1qUjW/tRR+bUEdy5btx3OQgyr umdrhVFIfANsPUb/RDv6yccWECWCTg3jiyd0kfqnSYGkFpfFsv9s4V2u7i56WcST tSTHcTxYUP89Q7DgnXmqxZtDuB0Vrz0ATe6cgaHmz/mtHOxqruuYSB1ifx+tOnPX YUFpJfpCQPQDMPBPwS8D4bTmvKYt+oFhgkZh1/W/PxETnGsSWeOv7EGGlOUtpXVJ L9XYev+jgYLk0OqDqf3goL0ed0TtkcGlvuDRWpg4sNdfkpZc7mcFIOJguQLhj7F6 8qI6n1IcvXQdSHeNvdKBKYnr3b0gTZ9S0TYiOWdev5LpqOBFNwgxFK5+Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt37g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:57 +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 45DFdvZk026874; Thu, 13 Jun 2024 15:39:57 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 3yqq4rt37c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:56 +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 45DEjjfs028690; Thu, 13 Jun 2024 15:39:55 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn1mus9ga-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:55 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdo1k49086754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:52 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D49042004E; Thu, 13 Jun 2024 15:39:48 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 614DE2006E; Thu, 13 Jun 2024 15:39:48 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:48 +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 v4 29/35] s390/mm: Define KMSAN metadata for vmalloc and modules Date: Thu, 13 Jun 2024 17:34:31 +0200 Message-ID: <20240613153924.961511-30-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: pD6uyOhh-bdrq5oWD9AJUmqZbuVWYtd9 X-Proofpoint-GUID: hE3He5xumiJgo0Zbuv3p-52CPM54okmR 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-13_08,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=697 adultscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130109 X-Rspamd-Queue-Id: 6A56080002 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ztkmgrozgjpb44n5wue4fwi784qzcdru X-HE-Tag: 1718296373-448366 X-HE-Meta: U2FsdGVkX1+SzPKAzi5w0JSlQmgV3XygKRxMqarOzq9v46TAGOd8XkHFpxDBoWDCGkFmluUYBPY2JGBuXYH4tRYeSNbo2BrTKo3tLAU36nYMGxkzeC0F7/AJ8pcnoZpgBxI4Qp7Xgrvdk8Eu1nwAgqr9tpAEzJxAUhdfA85oGu+GdQvImRkt/soytT1uPdzhiLWdeKdZNZ++md7z3JZKFpE27poo0mKLmfnkkQZhMojB9DiIRgdtyFgrerA6HsXsAvzYj3Z2ti+6otVPL2NiahrO2cIpa6BmT1H0QIwcpJ9XqXze8ce46DfD1Dq1cFSJkoiaUyGPhgDt3gj48ncl/YKm3VoGG+fQunutPkfkIQNDtLVOLXeG2mtYnXV9WFL0g1R2G4M5aQdkAaOal0OMZNJt/eo7zsV/eGZkuoSsUdlLJwZacchdQavL9JrqzhnCpZKM/BVIzDXpVPf55MQT3chY1pf46Tw9hUUSKyoIFclGgcHaG/IIP2K1nk2cpSkLoyDx+X2jjYekJoaU/UXj7/ojMJf8Rn9ACMac90IUYBM/6lIbYn9K/6kYepNMFcSw4gWyd5WXTywQHjISOXZi5Zxn3bbwGzbWm7LHbBrgbLXOQvzxq0GLJx0n7CIOir/3KC1Os6tua09GxRtURdJpa+o1eqgl7FPGJW8875Lxio9Qa6LL1wRifsInNaGrbzGfgLb+ikW3YPQxDi3fD1yUQRZJwkY6nOWc1H0aBetoGVuCEPS+PozYkVmFb+ihtpBR76PeDsGcmBHjZfmtuuSUW9BbgnDRvIGVEZtTqDgqQBdbsX4CUXCtf0cJcWElPiSWB2hpgICHHAYdMJUuuGKfdEdIUOqo0wrTGGzOQZDNudlvOi1ypkV5S5Z9tiVIBiNDMyL69JKwF2TwWe9eRrA+w9kOV0etDTNs/BNwqc7OkaQytTw8mdGQ0ndxvzX+TjFu8Iq47Lq8atxcIHfoPU0 qpAQMrwG OmYQHDm9aXa1cOIT34EH7XSM+Of5KR1O+kJ3juOSnH70QQ5F3m2w+00/7iwr3FiL/Z3Twke2g8tfPsQhnS1QQ7gVRaXfanguoOm5ocoaPKkdg31LYJw+7QQpRnWjBuLk5uMwespLbUZSzQd7cUXm++ih6gSbHMy6ODh0SENVPppCjof14jOjDbp5t75cVViLn4AtGg0KLj1DM3xGm/RqyNgzWSywgB02g2IBtrpAVMBv4F3OwfWpIKN8cQjjRrbSvZRRHQoQKJHlbVDlSt2xdHGeWdVgjMktLVs0HYBp5+JeSjsmnfH/y/NzQQuUqcrBk8GB4Ho6ZgfAaQhcjL1eNh4HxqlI76drAhrN9LSsTS5vWOjQ= 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: The pages for the KMSAN metadata associated with most kernel mappings are taken from memblock by the common code. However, vmalloc and module metadata needs to be defined by the architectures. Be a little bit more careful than x86: allocate exactly MODULES_LEN for the module shadow and origins, and then take 2/3 of vmalloc for the vmalloc shadow and origins. This ensures that users passing small vmalloc= values on the command line do not cause module metadata collisions. Reviewed-by: Alexander Potapenko Acked-by: Alexander Gordeev Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/boot/startup.c | 7 +++++++ arch/s390/include/asm/pgtable.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index 182aac6a0f77..93775142322d 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -301,11 +301,18 @@ static unsigned long setup_kernel_memory_layout(unsigned long kernel_size) MODULES_END = round_down(kernel_start, _SEGMENT_SIZE); MODULES_VADDR = MODULES_END - MODULES_LEN; VMALLOC_END = MODULES_VADDR; + if (IS_ENABLED(CONFIG_KMSAN)) + VMALLOC_END -= MODULES_LEN * 2; /* allow vmalloc area to occupy up to about 1/2 of the rest virtual space left */ vsize = (VMALLOC_END - FIXMAP_SIZE) / 2; vsize = round_down(vsize, _SEGMENT_SIZE); vmalloc_size = min(vmalloc_size, vsize); + if (IS_ENABLED(CONFIG_KMSAN)) { + /* take 2/3 of vmalloc area for KMSAN shadow and origins */ + vmalloc_size = round_down(vmalloc_size / 3, _SEGMENT_SIZE); + VMALLOC_END -= vmalloc_size * 2; + } VMALLOC_START = VMALLOC_END - vmalloc_size; __memcpy_real_area = round_down(VMALLOC_START - MEMCPY_REAL_SIZE, PAGE_SIZE); diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 70b6ee557eb2..2f44c23efec0 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -107,6 +107,14 @@ static inline int is_module_addr(void *addr) return 1; } +#ifdef CONFIG_KMSAN +#define KMSAN_VMALLOC_SIZE (VMALLOC_END - VMALLOC_START) +#define KMSAN_VMALLOC_SHADOW_START VMALLOC_END +#define KMSAN_VMALLOC_ORIGIN_START (KMSAN_VMALLOC_SHADOW_START + KMSAN_VMALLOC_SIZE) +#define KMSAN_MODULES_SHADOW_START (KMSAN_VMALLOC_ORIGIN_START + KMSAN_VMALLOC_SIZE) +#define KMSAN_MODULES_ORIGIN_START (KMSAN_MODULES_SHADOW_START + MODULES_LEN) +#endif + #ifdef CONFIG_RANDOMIZE_BASE #define KASLR_LEN (1UL << 31) #else From patchwork Thu Jun 13 15:34:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697012 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 44246C27C75 for ; Thu, 13 Jun 2024 15:40:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B50D6B00BB; Thu, 13 Jun 2024 11:40:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 061A26B00BC; Thu, 13 Jun 2024 11:40:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8B766B00BF; Thu, 13 Jun 2024 11:40:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AC85E6B00BC for ; Thu, 13 Jun 2024 11:40:05 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5DA23801BB for ; Thu, 13 Jun 2024 15:40:05 +0000 (UTC) X-FDA: 82226276370.16.7BAA3D6 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf07.hostedemail.com (Postfix) with ESMTP id 212564000E for ; Thu, 13 Jun 2024 15:40:02 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="O8U/ryfl"; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf07.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718293201; 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=twgTpfHCjImRnKDbwT1fFnn3UXy6li/j6Qe1IMbE5zU=; b=2CsJwMddswmKV/dr4gAO18IEtq/eeDO8CE6mABhPdddUBgUDH17MTHGrfQCZgSAyfRewk8 1UxmOsDk6/e3EtuWklPK+M3O72MDry7nMnN0tpF2uO+IrATkOqH+xW2kduUe1iLrMC34Os qGC2kt5j7p1QVDK7XxeeR/zWh/lzkDg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293201; a=rsa-sha256; cv=none; b=6y1C6EEfHkwqbYmRovRnZ4yxLoSNBiFKNb4ZJGDNDSHFYKdcWl2+X0Wvb2cL18ZiwnN68B oJsfqMQvv084NMAeow4M7xUpCBl9Pbq54X6A9LBWU747lN+PdWkkz70sAT4YwILhsuuDu5 dUj2RyGXMaPAb0kUOYnfdQOiyo5cdLU= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="O8U/ryfl"; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf07.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com 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 45DFPTbc021282; Thu, 13 Jun 2024 15:39:56 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=twgTpfHCjImRn KDbwT1fFnn3UXy6li/j6Qe1IMbE5zU=; b=O8U/ryflh4XWF30+8J0B2o+utq2tv vrs3C+WScs89/2hGzajtpUAI8qjrWtzyaagsm2aScE1t8JELYED9WBnmuFPu7Zh6 Ugv/r/at9a21r/P2cw1loDPMuHEtirmZX2gAlqcoub5qcD2TjMN7J0QilelLvw81 6XrzrLyuhgIqkdJqHlFDkvGJTVoj3857JlseD5MGyPLpBm5yBnszIBkqD3XlJVt/ le4B/2fDhqDn68gqeq8Jt3xRE7RGiNcXzxlm8yxPERKL+mCmaG4DybYcoe84n9TL mevipRa0JFubbHH3GH08lwGI9YzhkARrqsnKOIYZP+lgyxuPDlmj4H/qQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1rbgdf0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:56 +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 45DFdtcx014929; Thu, 13 Jun 2024 15:39:55 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 3yr1rbgdew-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:55 +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 45DEZQIF028710; Thu, 13 Jun 2024 15:39:55 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn1mus9g6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:54 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdn7944433780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:51 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 65FBC20065; Thu, 13 Jun 2024 15:39:49 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E78F42004D; Thu, 13 Jun 2024 15:39:48 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:48 +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 v4 30/35] s390/string: Add KMSAN support Date: Thu, 13 Jun 2024 17:34:32 +0200 Message-ID: <20240613153924.961511-31-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: xAt3sBIWGlvAE8P-bHZ7h7aJJYjlYuY5 X-Proofpoint-GUID: 3bn059eewfkw9Fedtd0GxZ69YNCOvbgM 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 212564000E X-Stat-Signature: ej5drchd8d35kon4mr3zmckj7q7d6un6 X-Rspam-User: X-HE-Tag: 1718293202-486659 X-HE-Meta: U2FsdGVkX1/Ux4m1h8WVhtCu4JXlY5xg7aL0emR1GU69thYyyHyb28w1ixil06izlMIdqvsPWwK6DzCl1kAEkWd38uuneoMLIQw8rH1+bH2hCqXl22+rkdVvARE1NViY6kT/83ZzvYSPzD0Oq7Akl5ZamomaLG/70+GK8cxcY32p4ZrGkpG/mtzEZR/Eh2EJZUAzA23rjJ47klT3IERuYUW4IV+x1E01gf8RyV7l/Hl+nZ+0Zl2v0tZS362slYC2F0IVXAIMnvxEC+6uhvGZnosbmQypp8mtkWXPN20qM93SjCMXTRRuZ86C9oMEM1/cvI++kJQwbn2cY37E4ciHj5D+pXvFsdOugpPzk5NzzcgQIfMjXz7V4jtowavy1DzJmsI2ZEZ/prFNkZoheoex7A49yhFnulBkhA/p9RitVEaWSsWLRSW4yXjiCtIbfjgZH+/Qpp/4XEeV4Zvv8vv4PMURV4RKyQ7edHUngykxUUjjeZudhGpk862dWDQWbR3SXuCKiEql+wHIsqd5iYc3K+EpCZwOvZULBJM45RUnX5giHd3VyADMgi5eG7Sobwd0LowhVe4VhvO+DGyc38o3leaqU8j4C8Dnp6zMf/w7Bnzes2TpFoiVjini0EqmSATCLglzeyttWCJXA8MURN2AnZtoy7ChFpoPcAaY2oVLmNMbLTnoKhMl4cSBOPDaSFD/gAtxNOGqiubCOB6u80k0xCPbB927YPEGerU/aOMoAQSscxpCQHS9l4Xy4tn04tHduFEEy9lelouyoypjnAmd0okNBzXCzEu/XHDp4Pqaxc7WJ5P1SWstR1vTEaay1es3vmKVb/xJbpzEoT4n9DVwZU/fLnGG4KimyP4I71BYJzW6u2xfH1+e85w3NkNns2/13w+059atoiYAjvRr1J5/mvVpUG3KrhX4wD8rPsxGrHZ4qkt6XMKWAzhWpB3/HQQ4UvnalaS3Q0Th0gAgeXo gqFFMb+k YL7264SZcwvgr55I+v8fLxK/mHtRPRj9s24Ymwca3zQ0iACexLP0Yuxh+X1RxWe7qK98j16oQglAQyKxVO3ytjDqxAI1WUca/cTUNb6HUOxW/4uxt9xjWpVgqOcvbQhw7y0KP2msinkuv5f/ZC0U2RhnkiX5lRa3ZAalExjUw+eBtm//o27/o9fdjZZn9Lb0MMVQTkPwkeIalJE7WU8tNmq7B+36hu1dyWowGTWpzLiqAFL3xmpdsPI39ZmekTDuflG1gh0kyl7iI39eJYB4fw9St1etiTqLj3kkH+HNSNsyeWyBo0y4ZJQi6DH+Bg6ysVQ2CeIEk8PxL3Z1ocr60AKNKlR/wmSZbdfh4JEV1nTzoOvc= 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: Add KMSAN support for the s390 implementations of the string functions. Do this similar to how it's already done for KASAN, except that the optimized memset{16,32,64}() functions need to be disabled: it's important for KMSAN to know that they initialized something. The way boot code is built with regard to string functions is problematic, since most files think it's configured with sanitizers, but boot/string.c doesn't. This creates various problems with the memset64() definitions, depending on whether the code is built with sanitizers or fortify. This should probably be streamlined, but in the meantime resolve the issues by introducing the IN_BOOT_STRING_C macro, similar to the existing IN_ARCH_STRING_C macro. Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/boot/string.c | 16 ++++++++++++++++ arch/s390/include/asm/string.h | 20 +++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/arch/s390/boot/string.c b/arch/s390/boot/string.c index faccb33b462c..f6b9b1df48a8 100644 --- a/arch/s390/boot/string.c +++ b/arch/s390/boot/string.c @@ -1,11 +1,18 @@ // SPDX-License-Identifier: GPL-2.0 +#define IN_BOOT_STRING_C 1 #include #include #include #undef CONFIG_KASAN #undef CONFIG_KASAN_GENERIC +#undef CONFIG_KMSAN #include "../lib/string.c" +/* + * Duplicate some functions from the common lib/string.c + * instead of fully including it. + */ + int strncmp(const char *cs, const char *ct, size_t count) { unsigned char c1, c2; @@ -22,6 +29,15 @@ int strncmp(const char *cs, const char *ct, size_t count) return 0; } +void *memset64(uint64_t *s, uint64_t v, size_t count) +{ + uint64_t *xs = s; + + while (count--) + *xs++ = v; + return s; +} + char *skip_spaces(const char *str) { while (isspace(*str)) diff --git a/arch/s390/include/asm/string.h b/arch/s390/include/asm/string.h index 351685de53d2..2ab868cbae6c 100644 --- a/arch/s390/include/asm/string.h +++ b/arch/s390/include/asm/string.h @@ -15,15 +15,12 @@ #define __HAVE_ARCH_MEMCPY /* gcc builtin & arch function */ #define __HAVE_ARCH_MEMMOVE /* gcc builtin & arch function */ #define __HAVE_ARCH_MEMSET /* gcc builtin & arch function */ -#define __HAVE_ARCH_MEMSET16 /* arch function */ -#define __HAVE_ARCH_MEMSET32 /* arch function */ -#define __HAVE_ARCH_MEMSET64 /* arch function */ void *memcpy(void *dest, const void *src, size_t n); void *memset(void *s, int c, size_t n); void *memmove(void *dest, const void *src, size_t n); -#ifndef CONFIG_KASAN +#if !defined(CONFIG_KASAN) && !defined(CONFIG_KMSAN) #define __HAVE_ARCH_MEMCHR /* inline & arch function */ #define __HAVE_ARCH_MEMCMP /* arch function */ #define __HAVE_ARCH_MEMSCAN /* inline & arch function */ @@ -36,6 +33,9 @@ void *memmove(void *dest, const void *src, size_t n); #define __HAVE_ARCH_STRNCPY /* arch function */ #define __HAVE_ARCH_STRNLEN /* inline & arch function */ #define __HAVE_ARCH_STRSTR /* arch function */ +#define __HAVE_ARCH_MEMSET16 /* arch function */ +#define __HAVE_ARCH_MEMSET32 /* arch function */ +#define __HAVE_ARCH_MEMSET64 /* arch function */ /* Prototypes for non-inlined arch strings functions. */ int memcmp(const void *s1, const void *s2, size_t n); @@ -44,7 +44,7 @@ size_t strlcat(char *dest, const char *src, size_t n); char *strncat(char *dest, const char *src, size_t n); char *strncpy(char *dest, const char *src, size_t n); char *strstr(const char *s1, const char *s2); -#endif /* !CONFIG_KASAN */ +#endif /* !defined(CONFIG_KASAN) && !defined(CONFIG_KMSAN) */ #undef __HAVE_ARCH_STRCHR #undef __HAVE_ARCH_STRNCHR @@ -74,20 +74,30 @@ void *__memset16(uint16_t *s, uint16_t v, size_t count); void *__memset32(uint32_t *s, uint32_t v, size_t count); void *__memset64(uint64_t *s, uint64_t v, size_t count); +#ifdef __HAVE_ARCH_MEMSET16 static inline void *memset16(uint16_t *s, uint16_t v, size_t count) { return __memset16(s, v, count * sizeof(v)); } +#endif +#ifdef __HAVE_ARCH_MEMSET32 static inline void *memset32(uint32_t *s, uint32_t v, size_t count) { return __memset32(s, v, count * sizeof(v)); } +#endif +#ifdef __HAVE_ARCH_MEMSET64 +#ifdef IN_BOOT_STRING_C +void *memset64(uint64_t *s, uint64_t v, size_t count); +#else static inline void *memset64(uint64_t *s, uint64_t v, size_t count) { return __memset64(s, v, count * sizeof(v)); } +#endif +#endif #if !defined(IN_ARCH_STRING_C) && (!defined(CONFIG_FORTIFY_SOURCE) || defined(__NO_FORTIFY)) From patchwork Thu Jun 13 15:34:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697080 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 9E0C6C27C4F for ; Thu, 13 Jun 2024 15:52:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F49C6B00AA; Thu, 13 Jun 2024 11:52:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A45C6B00CE; Thu, 13 Jun 2024 11:52:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 045816B00CF; Thu, 13 Jun 2024 11:52:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DAA0B6B00AA for ; Thu, 13 Jun 2024 11:52:38 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E4B47160213 for ; Thu, 13 Jun 2024 15:52:37 +0000 (UTC) X-FDA: 82226307954.26.5D82F4A Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf03.hostedemail.com (Postfix) with ESMTP id 1561120007 for ; Thu, 13 Jun 2024 15:52:33 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=RsI2daEi; spf=pass (imf03.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=1718293953; 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=7JeBzaeHcq491tpoSsSSp7r/Korv/EUFDTbEVwfZL58=; b=T8yecchFMSQ1KRSXWHyOhrEl00DM05qeFywMt2zj7C0BUYwkiQe3pxPkdD225u5QobZSq1 bA7Nzs/iNBHUqG2igkd1pxMCuI/a1nfs6POnrCy19FteXsOxkdqosaZeitPDFHSMvNHcSe TqGaczTjvIx60gbjdq6d5gOiKBxFvac= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=RsI2daEi; spf=pass (imf03.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=1718293953; a=rsa-sha256; cv=none; b=0b/rIrfqc0VK1bHZZy+yW7sS5X2twNLpbj7ikjc0OJfDYnI9NVLyXAtzE0y8Zkpw7helKW cvQ7rVdNS/tk68xeyDvAejLhHwXv/g9G9lWFsIcQSUv2nVs506cIVGGTRH49AINquJjqFq tftEenOijNMes6bRSC8k/QzMTeq4pEQ= 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 45DCR4sF031250; Thu, 13 Jun 2024 15:40:02 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=7JeBzaeHcq491 tpoSsSSp7r/Korv/EUFDTbEVwfZL58=; b=RsI2daEiF9ND3bNcAH0qXOGCmYhas LCtgBfZijDXKU00NNeiTkSbgQ34bBCfj9oopPoOSmu9bJ6QMiy9HzNzidmNIveJ3 MQkK0TCpzk2EU4Bf8DGL6vLnEapa51pVXH8tUdujAr8k+mT5hNF/eDBjMo2b50Qo s4455qCrnxey33CVjAlKgtSMS4Za425EG9cESZr9TuaIwcL/6QU7YYeZMnH7CRgm YxFUslJ5ec70Dh0uatBhqYMJwFE6BeYxbaD3lunKsO7VMlZvarForJ68LE8GPmKm Rx7ElcvsW+AEDCLuxFxUWWy0gxvbYPeRKj45DpBG+6qecSsnFUzVICm3A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt37v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:40:01 +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 45DFe11d026967; Thu, 13 Jun 2024 15:40:01 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqq4rt37p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:40:01 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF399g003886; Thu, 13 Jun 2024 15:39:59 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn2mq918f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:57 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdpLh56754580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:53 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 184A920063; Thu, 13 Jun 2024 15:39:51 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 99B2E2005A; Thu, 13 Jun 2024 15:39:50 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:50 +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 v4 33/35] s390/unwind: Disable KMSAN checks Date: Thu, 13 Jun 2024 17:34:35 +0200 Message-ID: <20240613153924.961511-34-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: MBiMewjTh2VDm9je00K5k1pmxCgmdgTt X-Proofpoint-GUID: cnW0ACph4WoIlEz2MYjl9fcGbGh72JK_ 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-13_08,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=896 adultscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130109 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 1561120007 X-Stat-Signature: tenbg84nutgd7xwjk1973h6ynrxxwcsq X-HE-Tag: 1718293953-127859 X-HE-Meta: U2FsdGVkX18yQBMzeDpMV8dHRjCB0FT2uKB1GX0FK1gKUZaIb8aSHMYQuAxqkd4ZWZY000BrkXlOnK0lz68i0vUgDazCPuadGmH8yWyHHvkhoAiOK3svP3Ln72bRkeo9xyig1k2qLAgh6pAYx31yWkzq9YvEVBvIawoJMH9AU9688hr5ctZC7gb52bh9Q7radyCEQADs6PmNXALBdJdbytM1NPjDtzxh7F6QeLIsuXYiO+ygcarfiv6wdo+3NigN6JwfVLMwj76iF01PT587UIibZNGYjhX17qxvTd5tGhrEbuVWWNA225xE9ZaRn8OMeo0hCgmD9DOpqkfrUzqZjsZq3dI0ntn8WHoOCSU7pR2aDkw2Yzu+EQKe2dqLZNO54xKGtSkVGiVDnCDPh4SAnOx129iW+HORQOzg6hYccUon3GlBcjLcPC983c1xsVlzR6nYr08iF1YWjUxSqFuIruJpMrazPXBo10sP51vnQj+fpokE3js4NMkhliyYhSUfp5mWmAseozYxRayICN86WQ4aIOwWkJqfcOc8fKOcI703qsaPhmqt5ANJ07cZQ+kHKO5zpnttyP0Lps3r3h5txpAnedvbr5xyXuoJjFUWVnZYikNlhwcoRYjD9voyLHeEge504QdWe9furuB26goEWwlZwsOXzLQgIUynGHZhbZusTmMK9VisEiGfOG8Gs4YpsnIhpYqrp3D4VfxlTfbOtvH1gpT8E5ygl6hzHdTZL3kV0GtXTP54Rd1/dR7IrRNJta5YVLQJn1/NOBilYJ6n13ff+bZT1aXgog230yCL1mDEKqbSVTkMApiZTdxs1gEW7yqtlpVxpJrDVNCAyigdAhSTADSeEoz0MDEYDLw2Fir2ZY5/kd0ueyzXQRAKqlAdoGJDNkIFuxbr8/UwqgnvOZf0sVknupj5JoQkzlimodluWvMOjepOlYYeZl3ojCDZFFrtZhJQfmzVJqm6jkt 0QWzGkD1 4gLgLEkh57Bd29n52+tIWPdUdPpSt7e+XzLdX+uaZGAU6l6IIYEqUip8BMYFZ8s4DKCHEdLWQoMxHSrenDCSVOR7EZsbGTB/yzzGgTQ+Eauoec9h5FspogDs9n1WpcSiV4nf4akTxaanJzwVR9CmE6RalidmyqLg5XKjXwiTOfLK6lrpIWrgmF1kpWoEg8oi9d4JLxIQMOLr1hFyzza9mBsbYpRUBko8SSW2ktypXx/yQ+HpoTgX7dj3UeRqJbcOzLZIzlhORMzMU5ljC7xyAzA7UHQ== 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: The unwind code can read uninitialized frames. Furthermore, even in the good case, KMSAN does not emit shadow for backchains. Therefore disable it for the unwinding functions. Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/kernel/unwind_bc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/s390/kernel/unwind_bc.c b/arch/s390/kernel/unwind_bc.c index 0ece156fdd7c..cd44be2b6ce8 100644 --- a/arch/s390/kernel/unwind_bc.c +++ b/arch/s390/kernel/unwind_bc.c @@ -49,6 +49,8 @@ static inline bool is_final_pt_regs(struct unwind_state *state, READ_ONCE_NOCHECK(regs->psw.mask) & PSW_MASK_PSTATE; } +/* Avoid KMSAN false positives from touching uninitialized frames. */ +__no_kmsan_checks bool unwind_next_frame(struct unwind_state *state) { struct stack_info *info = &state->stack_info; @@ -118,6 +120,8 @@ bool unwind_next_frame(struct unwind_state *state) } EXPORT_SYMBOL_GPL(unwind_next_frame); +/* Avoid KMSAN false positives from touching uninitialized frames. */ +__no_kmsan_checks void __unwind_start(struct unwind_state *state, struct task_struct *task, struct pt_regs *regs, unsigned long first_frame) { From patchwork Thu Jun 13 15:34:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697014 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 1A757C27C78 for ; Thu, 13 Jun 2024 15:40:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC0346B00BF; Thu, 13 Jun 2024 11:40:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C70FE6B00C0; Thu, 13 Jun 2024 11:40:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9CBE6B00C1; Thu, 13 Jun 2024 11:40:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 88A2C6B00BF for ; Thu, 13 Jun 2024 11:40:09 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3AA651401F5 for ; Thu, 13 Jun 2024 15:40:09 +0000 (UTC) X-FDA: 82226276538.29.6951E11 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf04.hostedemail.com (Postfix) with ESMTP id C7ECB40017 for ; Thu, 13 Jun 2024 15:40:06 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=IRh013pY; spf=pass (imf04.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=1718293205; 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=SGtqtZLhmZTpZhOs7cGVRXCfbxWX39hF+gqk+Qx83+U=; b=ky0AgWcfS8fo0HjdSug5SgXJD7RGzi7jmaVRO8tjXQRQB5DcF7QcA9+bmadYcikddnydF9 SbGQE46YivpkQREwuGb9ZlIhVrUEQIivtAlrWPCt/CzK7CnIFkiK7FJYYmPYlVq+5y/luO Y1bduq6ol7ScLlMF8NwA19A3fbDuTJ8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293205; a=rsa-sha256; cv=none; b=aM0e4hEWaXNMSr/8HGYHo83MKCk+Un4Oxl/Ii5Gj7X2xGeEO8Qokj2eUzZzZ6o3dTbjEeD 7M48IN1CeURM/mOSx0ASSyUXOSoo1ngtg+z31eRiekshmLBRBbfCV7yKLRgGXR32d3qSKn 2gZDVe4ZLfpD7fbJfkAuA22iu1+UHDA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=IRh013pY; spf=pass (imf04.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 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DFRpXY006834; Thu, 13 Jun 2024 15:39:59 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=SGtqtZLhmZTpZ hOs7cGVRXCfbxWX39hF+gqk+Qx83+U=; b=IRh013pYTuUHW/NKXqynYSO+MHC0K eCs3RfsOQP4rIRmQcWWClReFpk2dA9WZqYD/OyQVUoS7iXmQzHEG6GNLSbpcLojr J9IcDXyNMrmu+5cHvUr1rsqPwVn/mnkpVPXQ1X1b/YdBZEr+L4VxHK1CBvG2x85n EbMLcHYYUaTd2agI11o99DVKLnC9na2QYWVi/LxoST90RPo+YdCm288i+SJ18aw5 6BFz94Y8RwUatNGckTnbPk6XzwZm5CzsbIcYoNEzWy4pUYM2XoxB7+5HHEWL7OXQ Z2sJc1POfOcU6h5wfZfb8LkO9s9acsG29dwyiCNUIXJwSh2PdsqnpCRIQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrext12f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:59 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdwis029870; Thu, 13 Jun 2024 15:39:58 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrext12c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:58 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEAxec023597; Thu, 13 Jun 2024 15:39:57 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn3un0qhr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:57 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdpMb55705908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:54 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A321720065; Thu, 13 Jun 2024 15:39:51 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DC672006A; Thu, 13 Jun 2024 15:39:51 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:51 +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 v4 34/35] s390: Implement the architecture-specific KMSAN functions Date: Thu, 13 Jun 2024 17:34:36 +0200 Message-ID: <20240613153924.961511-35-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: EyA2kbsVp8WqCccHu6SjxoBNfiDsWCum X-Proofpoint-ORIG-GUID: GZ2-WR2_gP5V6QUvEBJcKL9zIIoL9Eok 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 malwarescore=0 mlxlogscore=747 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C7ECB40017 X-Stat-Signature: 3acstpwh4knnubiwno7f6izzgo9kkkcw X-HE-Tag: 1718293206-299445 X-HE-Meta: U2FsdGVkX195ADu/gzeH936Rt9KzID+3HsAxBa+hd5fsvxfe9Ds1Yar1oFvy/2XHA8gk2mOP697+hyF4/BjWWznJD8YfCW3LIzuxnC1JB+tmeQePNTO09UzlisSIerXvYC+vkzIDVYxeDFHOEaenotuIQPuB3Bg9ujj4KNmHGnllDP0aaTrMJ1bww1XiCsi+ysg++ANDbLZELFXpwWzU17ZJWcr0drGI7pYDu1MBqASvu1Gqm0iUgOkJkYe9Z/+8AujKj6Wa+lP9VBqLjkbKLTl+3KmdEPDsnYidp8ii2XTAVRg8owchNPG95WVCADrHuFOLto0SjyE79ILq9QmR3i8ohprAE/6pTcSrKWL3jVpBuhHs1fxC5ZpY94CWyTvBi4Jgiksk8Adc7sBoq5bPjSBrIcRrdYU6wuFInB01S5I/kQEE5kPvNJGF9OoX0rvROz2SQTYiYT48B4XUGgb7jcwd9uFggE0RNZYK6z678y1h1kINa+srNKGG1jeAVDuPNBJgeBQVmrf3H7M22PS1VD/S5AbU7EinV7w5oxlyN7SW1SfSgcKgCftYZoEZYySkkIGF7I5LUcRdQEbG3TMtm/U/3LzM1LFPRVDb3oFUGw28EBpE6Q1nEFjl0gZfbMYT6C0ITylwQbKe6ydOohk1d/a2GbDqvI/uKoGtXifAL94REEw/nJM9a2hnCwoH/OloXvnqr6erZm9Wq3O7QsmO11HuUYXMll1URyLEyeCob0GLHLc12o0c/KmtjL2P0RUAucWuSG9QT7+nrirpJRPgKcSinZECM5CkUS780L9mcD026Rckg1s2n5mTd5cD3Ku37JNJVrY42dt8byHfUUdKQ4pvSicqa9bJer1ewcE8yLsZ0tkZjeV0HjEvgvG3VLZu0loIKoyjWpl73JzbmruKwtD6VHfMf8EJbayrn5LjZ5q56s2s4aQ1EPoEr3klENWx25M+8jcWrFCNKygVnjg sewvi5vU 61z4GYjavt3F1QvV3cFq5VNVj+JaSjhEeFeeitIODA31Ic0uKNP8OX5eghUn7tzdz91sU0etZVAP/tDr3NR8+wxwyk63N7ZFZPkrTZKfLMyQD2+LsGZ7C7euD4x7qnLBgOwUdqRieT1oCFpXsDB+Bnciq/1zo6FLcdedGnkHCk78uIPaB+easwZfQAqNCMIH/vMLukSo9n41Id9xrsyKBHDyIk/OpwXxn2KY8Ys9W50esIMEmRrU6P4OeD7O5db0RlAFSXUjsCGIdpiTmJsuhgN2PWg6jSQQ7I4Nt+nTFSI3Zg8mevtd2LeMOE74UUYz39GV3RIvH9erkyTWH8lEIVQLw8Hx+05d+HFxj2q5eRKH70EU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: arch_kmsan_get_meta_or_null() finds the lowcore shadow by querying the prefix and calling kmsan_get_metadata() again. kmsan_virt_addr_valid() delegates to virt_addr_valid(). Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/kmsan.h | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 arch/s390/include/asm/kmsan.h diff --git a/arch/s390/include/asm/kmsan.h b/arch/s390/include/asm/kmsan.h new file mode 100644 index 000000000000..e572686d340c --- /dev/null +++ b/arch/s390/include/asm/kmsan.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_S390_KMSAN_H +#define _ASM_S390_KMSAN_H + +#include +#include +#include +#include +#include + +#ifndef MODULE + +static inline bool is_lowcore_addr(void *addr) +{ + return addr >= (void *)&S390_lowcore && + addr < (void *)(&S390_lowcore + 1); +} + +static inline void *arch_kmsan_get_meta_or_null(void *addr, bool is_origin) +{ + if (is_lowcore_addr(addr)) { + /* + * Different lowcores accessed via S390_lowcore are described + * by the same struct page. Resolve the prefix manually in + * order to get a distinct struct page. + */ + addr += (void *)lowcore_ptr[raw_smp_processor_id()] - + (void *)&S390_lowcore; + if (WARN_ON_ONCE(is_lowcore_addr(addr))) + return NULL; + return kmsan_get_metadata(addr, is_origin); + } + return NULL; +} + +static inline bool kmsan_virt_addr_valid(void *addr) +{ + return virt_addr_valid(addr); +} + +#endif /* !MODULE */ + +#endif /* _ASM_S390_KMSAN_H */ From patchwork Thu Jun 13 15:34:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13697013 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 3F8F9C27C4F for ; Thu, 13 Jun 2024 15:40:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0B9E6B00BC; Thu, 13 Jun 2024 11:40:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E93DB6B00BD; Thu, 13 Jun 2024 11:40:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C98176B00BF; Thu, 13 Jun 2024 11:40:07 -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 A7EA06B00BC for ; Thu, 13 Jun 2024 11:40:07 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 677DF80249 for ; Thu, 13 Jun 2024 15:40:07 +0000 (UTC) X-FDA: 82226276454.15.418194B Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf28.hostedemail.com (Postfix) with ESMTP id 2B57AC0017 for ; Thu, 13 Jun 2024 15:40:04 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=cgRR9XDQ; spf=pass (imf28.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=1718293204; 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=FaH0SIlcAdxNd0AxCUElyzwSaf+9XT3DwQzTJtkbdgk=; b=DgQzUbXQA5GaaSMRQdPlxzXuI1uOxHhMIpOqFvdOID683QKiuTAVq64QG16+nRezM2xouZ wpvc5dQxuwEbLsfdvBJQ6AzHXi07frUKXg9D47VUC+pKpUTPfWJWwD8ZsxEerbSLrzU3LT jdYjtr6OLGdoxukxhGDLHQ400nKp8tM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718293204; a=rsa-sha256; cv=none; b=Sn8K5VrjmVPljhkDy6NYxAZu4tKEWNuPLQ60sBAPPexScJfG0RveaFPRTjSpc2kVSoDnx6 kDtkVZyqZhqPR3jnk88TK82kAoH0kCe01dkj2JgsEduaq7UEy+Fz2jgcCYZGRQx/UszrOP 77nTKYU+7hoZONzwwWWeLBVDXx2sfsk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=cgRR9XDQ; spf=pass (imf28.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 Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DC85R0027559; Thu, 13 Jun 2024 15:40:00 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=FaH0SIlcAdxNd 0AxCUElyzwSaf+9XT3DwQzTJtkbdgk=; b=cgRR9XDQQMAcQLutpt0EKOKVe2c6B piQ3RxKFM2zsiIKTQZPj1L+CbJp6/vzCpjrn1rii0LdgUHVnJNx3QvT8eFspzVNI RdIBLWr7DWqAEK/S6D27rHs7UHlf2OTOFziGQ7K3cszw9zKjtwCo6dwfZ7odrDww 0k0PoEuKqmJgeAFLW9Fe/rLp9Qbv/qf4NpjtBg0FKz0guBTv4GELNWmrogP/S1Gm B96apzfvHTf4NX1lpQ4XwlTegUHPxY/nVOM5bjvQOJ6Pag2s8m/r2XV/q/Nz1Lhm ysdM/aPKWcQhGKm85Yydh1MOZMGbk9t7wFLBK6EaNpVhhd60rXOL4q0BA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrw7hv3r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:59 +0000 (GMT) Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdxlf022275; Thu, 13 Jun 2024 15:39:59 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 3yqrw7hv3m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:59 +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 45DEbYAC028651; Thu, 13 Jun 2024 15:39:58 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn1mus9gp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:58 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdq4w17760576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:54 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48DA12004D; Thu, 13 Jun 2024 15:39:52 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B5F1220067; Thu, 13 Jun 2024 15:39:51 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:51 +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 v4 35/35] kmsan: Enable on s390 Date: Thu, 13 Jun 2024 17:34:37 +0200 Message-ID: <20240613153924.961511-36-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3APcB-1vlHNVWzvKRh0bQQx2ADopofn7 X-Proofpoint-GUID: tPAGx4cvGA2kBxCO71xRcrOJzxrpCF72 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-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=756 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 mlxscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2B57AC0017 X-Stat-Signature: 5cqjn4edyxetu5rsiwxcg4tzmksi986w X-HE-Tag: 1718293204-227247 X-HE-Meta: U2FsdGVkX18cwnlBvKwg6mSeN7MVS3Y65jpeZwVY1NnBhQg54SqGjZzOQbsFp2T08KIi8ejfiFf4WtOLnuxbvHKq4nwYUmKrjpql59cDMAsG8aNia+Qtsj4wVbFvQU2v4+eNb1XftSj133MzvrSlPwLnaIpvvThkA4oo9UVj35nqdUT6y47ol83w1Vp2RWpsDEZOlX2X/wh+vi4a1mqYZlS5LXZqPjCmfO6NMTX13YQiFZ9Ciw96DZ77cuE0CPbzvS7dTPRTZ5z/Eri5qDmpdWAqKGwen5JqzfVXl0qOADvKOn6HKXCQMIVWbGb1oKuQI4l8aTNU0L5ab758TBKPvO954xXTyLN04i9HJ2s60boBBUCgvxu33e8+3806Ks7Cct4IbCra7HiMm25/W3VXe7xaQSZ/nLZc7OJ2WPbB+6LlBgBC60Xv/dOub6z7P5DNPwVaHb/LtQi+DhGat0uYJqXPtftNq3Rt+D4QD115PDnL1jfTg9RpYV/5CyXEG+p0ezRHaOkiKgWx3JcSOnW6I8cvtlwpg1XpqWRGbNnpQHVLX5ldwMd0a+uMn7rvy9N8wWI1ASJo8dDGuo9tKsa0HfOXgz2+nS9IAt7m+KheNYePTtUWX5NBVAGQb8u9rMmLyUrdrogEjvptv4Jn5CrnaZmw5xHfm83eqRZAVMwp0IEuzhQSugx5eM4mJ5/hhtmGbU4Kb8T8mzYOX2PptdaBUfq2+aBlHUDtlBja4xoeIVzqFVz4vEBTEc7GjOpEWB0rSrNmRg4j4TB0ulJ+++pazUsIONWhJ36Atb/qcNYxCPOl2WUgwjqW2MS5haBsQaE0BBlnUwybxD1i5+4OVH3RcSZrMeApCB8G12SZmyU5hWWkWmvzvlk/ExznJlCH+GO2Zj8HtSmQ5rKX4lGB9wntAu2byrxqp4M6JapL72OvjOasONh5U8rGsIrajFp1mhwy7acCCWuQQ8CCDsiaehq YBCTfNhy 1T3biLn4wpaM/wfvV4Rgxb3VnSsnABHdUkGI9yrzg7liF2AHnXcmTOg1K05HtAYd14+GrvAWKi9UzSxPdL6+oee4P2Ai5rTiLP3OVg9LrYlPkVSKvULzCloL7ziLoT0D2VgZlyUushYLmRhb3sJbxA4zjDKFxDnNMu8PsGiMU4tOpliJu5kg6oKoCyO0z8fCvPebOgtfKGu7QUbu0JOQcb8Kro03bcpf+iyHPuQ1tDK6qYegCzMSI48L3oGNwBnbd/RwOX69chmZKqkus2wg5F34n0AjGnz4VMy2Y7ToCnKmtlsOWKcaLgtRDWPkQwLWrTZ7sBo/hKuTA799XFyWfDJKrOQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000315, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Now that everything else is in place, enable KMSAN in Kconfig. Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- arch/s390/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index c59d2b54df49..3cba4993d7c7 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -158,6 +158,7 @@ config S390 select HAVE_ARCH_KASAN select HAVE_ARCH_KASAN_VMALLOC select HAVE_ARCH_KCSAN + select HAVE_ARCH_KMSAN select HAVE_ARCH_KFENCE select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET select HAVE_ARCH_SECCOMP_FILTER