From patchwork Fri Jun 21 00:24: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: 13706581 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 DD787C2BA18 for ; Fri, 21 Jun 2024 00:27:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A9558D0103; Thu, 20 Jun 2024 20:27:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA4588D00FF; Thu, 20 Jun 2024 20:27:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CE4C8D0101; Thu, 20 Jun 2024 20:27:05 -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 111578D0103 for ; Thu, 20 Jun 2024 20:27:05 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B84F7806A5 for ; Fri, 21 Jun 2024 00:27:04 +0000 (UTC) X-FDA: 82253005968.22.868EBB2 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf27.hostedemail.com (Postfix) with ESMTP id 6071940010 for ; Fri, 21 Jun 2024 00:27:02 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=AuMzDTLy; 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; 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=1718929612; 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=kU/N+IjLjtGivjpGyVY04YO0GR9T1vNZaCjuWWP4qac=; b=HEyEw+rp9bLKsksdLGa2wc6lPZGDdMEIf9huF2nZovEyC/dOyneMkHs8sRbr+zxGjDmU8E udo7vUzl/HZtfy6UdjtpSRExOQy3PVr3nI7tTgxrVjeCSbto6bEeWzq5NrgZqQiMAM6SvC XuKUnAwkWscoUucsafxIyYzi1wuhXTA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929612; a=rsa-sha256; cv=none; b=rDPbjIxdQIwIjo3R1xzEFmUawRgBLWJ+uwIF7kNer3ZkIEK+dFiNF1MfbP5pzb8az/rC29 EAtCbpFNqNnAehROzqrFFEpRiupDe2zOY6KZnzcyJDbkBSh5FNkEjdWbW/RNW4N4t4PQRs WhRlFZdiT88zV1FQrEsKGYtc6M4zKo0= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=AuMzDTLy; 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; 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 45L0NBTm016908; Fri, 21 Jun 2024 00:26:29 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=kU/N+IjLjtGiv jpGyVY04YO0GR9T1vNZaCjuWWP4qac=; b=AuMzDTLy/3A54qE2ADeLL2UYGU1wn a/QyESmytE/Idk4C+RRX2F1+bmBL2J51XQ2w3VbegEHI9Xh/+x7fIsJ/QRy3Obfa RyGhkd9itweYWHQBmX57vF0ALlMePUZzW5c1pCjI6XbfuUEqvyxop0OKvYRABLQM +TtFiipnaOLECsmo1LoJyPZNULrHRpNfwmL99Y0f3ukt8g+exLwPtYiYptUeo3X+ mPe8tIewf9AHZ7rVjRQ9ZCf9xgQNCH/uDNrW+QixZCKh0KLSJjEmIMAY7uNMkDws aVTc/6SRl+RhV8UsmXaFMR5lCaQ6stj9RlQf09zzUQtL/QHLWrX673rlA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c06yh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:29 +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 45L0QSYE022603; Fri, 21 Jun 2024 00:26:28 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 3yvw8c06yd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:28 +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 45L0QFe0031032; Fri, 21 Jun 2024 00:26:27 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrsstn0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:26 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QLRu22872500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:23 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3689720043; Fri, 21 Jun 2024 00:26:21 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 148152004D; Fri, 21 Jun 2024 00:26:20 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:20 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 01/39] ftrace: Unpoison ftrace_regs in ftrace_ops_list_func() Date: Fri, 21 Jun 2024 02:24:35 +0200 Message-ID: <20240621002616.40684-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: McwRRv8ORq2jBJVljLDOsf_BLReXo35e X-Proofpoint-GUID: w7z3E2lMoDfykspBMgYgM_bl-_IrxL0i 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-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Stat-Signature: kdiueawguuix3myh6sta3yoewbcw1rya X-Rspamd-Queue-Id: 6071940010 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718929622-329842 X-HE-Meta: U2FsdGVkX1/MRVvjMAIisEep0fpo+3IgVj2lSETxwMvPrBx3XielVWnx1yS87Go5Bqm6STMLMduIIzD5CaC0mgCE4IeCmx6f7DPnGppRWAUBfirezGl45qFfZUf1bcy/JG70TqQzVm/Cj6LL78RXQOmrSCAdlIcQr4HuNZ4GHihbhawy7Ous6UdHRWI79MJBw5ct/4zCh3aWDvBoKjkk0zI8M4+zs099U6Q9imy8G4g291ZOxIMAcVS+3ZWlMZ+smnUpziBj36UQbDBXPZEykQeptx182QW83VCoYRZBYDIE2N1aZw5Sx8j/UqBgwJ2kV5/Z5nA7WRAcHnAYfiy5H9DZ2pR3u9BxEHAkA5501Ryf8PZTQLea/MR1ZHvW6aYNmpDEN/+riCPrpJAn0NxJumbv3KGKAXvd91hIqKmn2wyZGlTRJ5xG/EygYd7md0WnRKIQmUK8RlxSWSS+/xXTbprpTK7xkbV51IPz3G2DwrQya8hDQOQtp6/1c3k8K6/+YNf3jhDub0BAbKT/HirRstCeZs1bNR6SqALjIahORWxxkGbJhVoo9XnoElfdTngLkOzVEzXRMhJ9knHBSXy0LXWVdMXwaPMnzo0T+/gnj33R19TztzXzmHdXquXdiuhkfOOct7LnxnuDfdSD5TRqy4n2vUwhZPgNfEm8/H0aN73FYz81bzkqjeuIw8H3vY5tWi1gJ5u2ZLJ/+bWbZ+wAp/vg3aFZbBnJTuhggtUaII0o3GsAVFDI1+t1F+Uub7QL5QCeZGhKE1X/fuJMao2Fh/lqQZ3nd5P1s00N1/+dFTWgcoU3tli5T5GXUmBsJsh+SsE0dho00Al8vcFxlS+6lMe34O5FDcqs9NaK8M3HJ6UbC8bkbDX+BBRQZs9yLoh1lJKHY5bRJe7E8pNfHSI4MedB9AUoJmh9WRJ8bwVMXD/ooVi8orwYr/4BgY8xc16pRdJQXcxAvsyZHCEaWDX JgYK+/mk JCLGzOq/luouCC1HhSnc0Xuoeu731Ecwqrv8xmStJEqYPdF4toYj0mHhR+TJSE8oqFoB8PbP5KquL4J5hXGJu/McCgG/TaY9boolFEbUrOjMUN0w3XPdDUi6BlayhU3v3sS7+X9ADqPe+Mf9WH0eNjSfFh/hUXEl8oKCLGDW5+f5nPvBKljg6g4CwTQhj46i25TMW4HVfoNOtoHWBTthvdosZDxNrkeKbyzpwANFR2+sEXyAOzJHuZcWhHc3PjIxGrE4goneRn2IxEG6eUP/RsWPchs2ETJa3jqiqfXnMb5XnSdkEuEKtVKnqhnP5qEZDuX3GJllm5u8GFsLn+hlYLxkaNlcMoLD+/cMhMDRUquM9juQcPpQtKV8lUfMec2dnSvNFfLl1NEDnSLMYKl1PSP9W8A== 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: 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 Acked-by: Steven Rostedt (Google) Signed-off-by: Ilya Leoshkevich --- 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 Fri Jun 21 00:24: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: 13706565 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 8EFDBC2BA18 for ; Fri, 21 Jun 2024 00:26:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 54B5C8D00F8; Thu, 20 Jun 2024 20:26:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F96D8D00EC; Thu, 20 Jun 2024 20:26:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 372BE8D00F8; Thu, 20 Jun 2024 20:26:48 -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 214688D00EC for ; Thu, 20 Jun 2024 20:26:48 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C65A41C0717 for ; Fri, 21 Jun 2024 00:26:47 +0000 (UTC) X-FDA: 82253005254.21.17BB079 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf17.hostedemail.com (Postfix) with ESMTP id 82EBF40016 for ; Fri, 21 Jun 2024 00:26:45 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=cp3Nojk1; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf17.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=1718929597; a=rsa-sha256; cv=none; b=4ZBQKTAPbBzKr8fZIrRQ9EsT7qLoJ7bTiwvuLEn6+F1ZEWAqA4xGu9MtcIKV3QuHWiA4Ih 09SRmWUfLE9zBwaqaLnjNpCSCMEIB11D3tDPJGugS0xFp1TGIAl8UTR5sKcBFwv6qnXI4g DIjyMCJ6Yd/1pu7a2x32R7UAIG7weV0= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=cp3Nojk1; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf17.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=1718929597; 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=kXSH7HTFHUNQhtqNRKyspjcgV33+/ZDljIDJYGO0K7jwnCXOlA7oe1Knesw5okektfFGWH +B0SDz3zrFzdbAZnI6PPgbqToWb8GSmXJS7E7myQu0Fhk1yr80GWcMs2Kq7cSaBPDt2bmb Vg8dy3yETUb2mPdogekjCVo9xL6g/zI= 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 45KNQmMG030138; Fri, 21 Jun 2024 00:26:30 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=cp3Nojk1uyr3q45Jorn3+mo7AmkBK xgsssvQ8/9waypfqg5z6JkN2pTEwH5EetvwvyhaQlEptRVmHru1UjRK8rlS8IuD5 CmnNUOKdSUD9f43mww/aZQEaMVXA0jQwz+SSgAtnHsBmm1VbwQAiCp1iGkoKyT60 seuk1dNYfqHVgusVyGL6vqiwBtQ9XPStCNRfeTuspNeVzGBekM4SFP3OgKbdHy3e tYu1lJHv/9RjD4i8sfpWATWoq3UoKVu8WiGcTvytE7zyNWza+x/sjyZX+hxmHdd9 RKQqEjy27YAmPC7VUGqFDOLLmP79AYzl+PrdDoTo8dS4BPKBd7wDe6tOw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c06yn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:29 +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 45L0QQwd022515; Fri, 21 Jun 2024 00:26:29 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 3yvw8c06ye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:29 +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 45KLdxwq007658; Fri, 21 Jun 2024 00:26:28 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspamn7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:27 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QMWn49742080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:24 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DBD22004B; Fri, 21 Jun 2024 00:26:22 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A5792004D; Fri, 21 Jun 2024 00:26:21 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:21 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 02/39] kmsan: Make the tests compatible with kmsan.panic=1 Date: Fri, 21 Jun 2024 02:24:36 +0200 Message-ID: <20240621002616.40684-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PiMadrv0_ZCFAt1YGkJeTR4kAUvMQsGB X-Proofpoint-GUID: FRW7TOOkANa6sIxj3Ucz5e72WDq6F4rz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 82EBF40016 X-Stat-Signature: y8qh9pjd8wr4ot9fzxnf33kddn7cuk5w X-Rspam-User: X-HE-Tag: 1718929605-344723 X-HE-Meta: U2FsdGVkX1/oDEunkLAcGAZjEXNaYYCj6I0TUFR3JuxU8xM8uj+PXLsZlePVJsOrsxbq8JbTk/6E65hFHDOGRKX4WJXFBytmVEVMw4s/h+0xQXRuymsZ3NgpNcZJ/odxfrysk1ncbhWqvlc06b2XA94vupjDbeQfMm57FojaqPcbV/9NSRME7bnQW/dnzlupFA+i7izDRW4CtoFrUGsM6aTePTt0cJHULIwoNs6/wu0WuQvsfSfA3dJLOOvhJQFeULlW1E1EKrHzsIkIpH3H99opyue6Rk/e8J9IApNFTTC5yvNjqPVTiUx7kXILL/QMfxyUp0kfj89+BixZCnFpf97zbPxdLfjPGSddCFaBH/SJ4/b1neA8VmoOkNIXlyS0Ne9LAEf1EIFRA5DJiR7j75Vj1P2ftSHYf9ScrRXBYnrjTgQXVIWlUnCfXj/j6VvR9YgaSIibC3mnH4uuexIvPOBBr415eGhShnFn5k+QWvJcWfSbn8iCr281C9JCAGMAVRbiDSn89DGUaoEWUoDi02+IfrjNpttQqs+XcSFsDEGTL7cZjKZwPC6E0fpL/bTEYsG0G3ym2eEIwTsjntDJKpZZcCq0ZNzVB/3EJSVKx+wUBuSJdzBVH5hPRm6LONiB+Sf3/knTKhpwIJ3Z7aCNzrWz0C16mUwMo8NEqbbWhZ9RtC5hXNyNbAv5XRVVNI19QtoZ5b7I7MbYealXx1kHW2ARqtiQOdPHGzC6+bG+aBQOD+oUOJDYfdVwZSN1Mhg4hrhlIOoVYcOivTcq0Hx0NG0T8NoAtSij/K7x1mvG/r2G+9tqYSvpiic27nmwVGGjcY1CeIUO8wjWHRNysKNPUj9B1I/FT8C4Du99ZYd1ojZ05TlxzjlDEEI47afaSPrOejc8bDkqFPsEWFfT/uz/54KRaEgJFtuaPN7QTmgXxkhglPKPdNQEthBeBp9VUTGXDcHzBRYw6SQGiqGemfo XBlZ3Rfy dqxsi3NTYwAofCB6cHT/0MoY3e/XlpANhqV89B2aCLLCkm0qYu2NEQNx9JxX/p85HYWsP8cjQkQdOQZres5TZnqgQq5X+bblvV2hFtOeqwHSOaFN4GvLuftJbjyn38OG5Y6atqrwqtKtP8Nc5rR4eTxS24Eop/6wWtGDlCCVs7si6IZ7Dz8NLRRHj/k3erSy4nRytLAfQxHyaXXaQxkFfxOYZAbJ02z/DLdvY2XX+y0I8jOeyGDrbA6piYnXBbPkPR1OE2BRCuc1rJt39DV2v2Y8szm0Bu7SP3/+JfqkanFlUijBCw1Nvcp8Jo0exiAMFFCRlw3p/2+bVut4xyRMY27G2am2wQ5PYPL1yoZnDC5AIiMwmhnT7NLwCnQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000026, 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 Fri Jun 21 00:24: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: 13706584 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 B4DA6C2BA18 for ; Fri, 21 Jun 2024 00:28:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4AF368D0107; Thu, 20 Jun 2024 20:27:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4379F8D0106; Thu, 20 Jun 2024 20:27:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C7DB8D0107; Thu, 20 Jun 2024 20:27:10 -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 E1C3D8D0104 for ; Thu, 20 Jun 2024 20:27:09 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6D26A140668 for ; Fri, 21 Jun 2024 00:27:09 +0000 (UTC) X-FDA: 82253006178.20.423A3FF Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf12.hostedemail.com (Postfix) with ESMTP id 0D92B4000E for ; Fri, 21 Jun 2024 00:27:06 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=MuA06LqS; spf=pass (imf12.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=1718929622; 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=DXm/8KlK4N921DfV+IBogkr8tQk+QLpe9vmu5KL+8TXr00+JqhDGgc9iN/Ma2klr+psN2F FW+66UCVwRcA9YsvEF4a3P+s+hdkc3M2QKmUQuPR33UPL4QqQuAWdCvqeaBO+D60OF5RAH mcqdk3OvPXYIXOCXirM8Tllhn8AHcJA= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=MuA06LqS; spf=pass (imf12.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=1718929622; a=rsa-sha256; cv=none; b=pR7Ct0y//D9PIsIkcAVDcQOIeIAtmBXHOjiQg7hHR9MQ26RGe+Ij1ajDWQVzwwM3jEt9oI 11Ew6jJpznyrhKeeD9/hm9X8/EzF9YX6pRkP7HVjLKtkTjp6ZEehc0Q36T0uq4IFwvhqAc AzsbdHJzqIiipHZtWbh9C3W+c73gkbQ= 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 45KNQc7l017321; Fri, 21 Jun 2024 00:26:32 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=MuA06LqSJ2nf+w2bOgaUPEvvxXxSd oFuCpFwi9JKoALiVkO4uqXaWq1FUll3Vr9teZ/4ZG/syHAFCv43AuZmo6YtZNGHQ Qmk4XDZ46N0o1kh+mQEWCzO7zbd3ZTh5UhaE7/SSVdGau7xLGF65lrHs7LJdpJS8 QJaYxUGDBGIhyBB5F047Cj1mLTeSmOx1AQ7zE7JRMbKS3dlTSH+EHIBfFBPVXywu 3VUI8rKS1LxN5IhY/rlQQmP1O91RsUZQXl2dgJKXdQEprirXUsDzsufXMgrZpGLt MRBko9+9TA1ojTVB+oaqpR1dzrDAPUbICQ4D8AWJH2wBrmTKS4kJpz6fw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrdr89y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:31 +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 45L0QU8u009337; Fri, 21 Jun 2024 00:26:30 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 3yvvrdr89r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:30 +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 45L0KnaS019946; Fri, 21 Jun 2024 00:26:29 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrqujnw1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:29 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QNa656361470 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:25 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A32F02004F; Fri, 21 Jun 2024 00:26:23 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81F572004D; Fri, 21 Jun 2024 00:26:22 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:22 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 03/39] kmsan: Disable KMSAN when DEFERRED_STRUCT_PAGE_INIT is enabled Date: Fri, 21 Jun 2024 02:24:37 +0200 Message-ID: <20240621002616.40684-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: UM8xOfNifosib3PyMS4PrVZSIaVvXwYa X-Proofpoint-ORIG-GUID: toQ6s0bg_q3_98lVFmOUcEXGd-YIb3ZT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0D92B4000E X-Stat-Signature: czas7r39yt7x8djiinfuhn9gpqge5jeb X-HE-Tag: 1718929626-619569 X-HE-Meta: U2FsdGVkX1/T75AOYIfHXYLEvD8e9c3PHEYSNIvrZSMJCiZd/0DDUEeNSmag71QSHf/6Cpl3UuHyRSDGOpWmLNB1DjlcY8MHjrueNrsfT3AaGdrXCurBWAFeU/7GtpiSOFvWlgC9qbSXcPHuYMFgg2J7E1GPX8HqueN6RFSMgsK5z3kYdz8yRPEvzViMkgePpXg/gNpuDMuDLhknWy+5iODLnPTTlMkdHVcf3fAEYyDar++Z7ZTR4L9VJMdta+KpMO1NJuic9JzteAK3dGllITK5FHjglJNYP+bUdkJJdYk6vw3ryXtlglj5bLhtZ3JXDDBzRr51YpUbHrAAnTdAkibKHrsbSElcAgQ4o0vtbwW4gusrSkotdfN//CwKN9WBoKUKuD3Ekje8cDHHJKiBTeOT8hpvdNamNH42dYVNZGlS+dgAo6e8jSA8VDCgHfC7XT+bund1pgEFd81yYU96FIV5L+xAm4cq0ZQRju8mJc7C5z/IoDrJbhTI/yP7pjUcBrz/BuaE1HXPLNbcTIWVF7OiBi5jYdQvNhNetdT9sObHWzohtFIPgGuQnPUAKdKMzmruyqSva62H+ZfNQm1RVIEVcA4jF/5w+LLCt00B8ZoWt3qAcG6xiLjCP8yHJEvEajI2oI1Y4xQG4VdI1HP2QJdPGdk/ctEGGtt2378iyv4Cs5qGdIA2vOH6fCNUuvDsG/A46jVHsyJ2Smrl+7FMVa4XOr9E6/9zumyRnhC/dAdDDTQjfvssN5VZyL/QCE/lWR6K4VYTPZJvVhzRqkFMLzEw61o/z+yWyQi2F8wXWJwKrbrgX2fpLt+vBwf7LmYrRu5QYPEIiZmCpc4PuniGU0J+53FiLPqAAjLHKTPAWPWINCSyZ/+LAiPgh5t+PHFUt4hOhQo1ZJEIo8g11i4dGR077HSJXUisES7nxm84yLmpJR3m3MPr8JrM3BQihuzzhVhQX46E2cfEggK8TPR +7gD9Tz1 k+LHjZkdL1xjmR+faAIf9yt+Ye3t1FdW1zVpApdXBKKNU8pR2hzA7gu3GOUIjk0v1HqJFBGMWe+546idgEnbco+TDaXSTBr7VR+p4w2OecYbPa3pDlqEn+vq0/j2EAssWRPFmniphoRvbbj64vbJoVvhxJZfZX41l3OFO0y2+z2cDleNxWo5tyeiCikK/zlRM6Vx1AHWf9J0wEa5luHQZKCfsfpNX+vlrBwzBpP8UUzFBewZQIHZ26XToTiYm8BSc5EV45A/mG2ohjISssUmWQqWX2sfnzTLptOMmKP5k66POio4qWyaeNBFptf4d8gcxqFNl 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 Fri Jun 21 00:24:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706578 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 091E4C2BA18 for ; Fri, 21 Jun 2024 00:27:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65E398D0100; Thu, 20 Jun 2024 20:27:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 599398D00FF; Thu, 20 Jun 2024 20:27:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B2678D0100; Thu, 20 Jun 2024 20:27:04 -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 0428B8D00FF for ; Thu, 20 Jun 2024 20:27:03 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BAEC4A06CC for ; Fri, 21 Jun 2024 00:27:03 +0000 (UTC) X-FDA: 82253005926.25.6A86525 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf28.hostedemail.com (Postfix) with ESMTP id 8BF80C0012 for ; Fri, 21 Jun 2024 00:27:01 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=bJH4+L17; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929613; a=rsa-sha256; cv=none; b=XFlgCG/CpHOTqFDOZafDbYThoExnCvvqNsHzHnH+rfV+aDYLlDdOil0UU67g4Ht1gJbQVL 2i+smnWO0Ot8dvhiRsSCCEHe8Y6GIZORkyRQ/O5XSWwlQbFLvPvRptDviLewdSp1K2oLM8 eLd3aylTaDl1X3+aS08EFle27C69kwg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=bJH4+L17; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718929613; 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=sSP/QZIZUuRcCraJ2KtS0fy3t+lFoSpDwKvBka3xwksXNiu6uclUZZyX6PG3dvof7MAdGI uRbI/JN13XzghK88pQBRlrN6rpliNmBb4WW/zXcItythiQ/kQ9Ik0l/GFS+UZUO4TsB2f+ ymeLsB5I1NE/qWF13xpYSomwfhUcPcU= 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 45L0P8rv001146; Fri, 21 Jun 2024 00:26:32 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=bJH4+L17u0DCqzEVBS1Fx79Nk2et4 UO5sg4E6PFAp9e/mlqximnx+ZJDq0X1Mu9EEwMmFCXR+PS82M5E0Kyx1d0sEU+Ue pFx/knoqPRPe1bCaLrB2/KYWQ6FCgSUeFRZPpZattSPyV4uDFqfaqE88ORfQYSrf nnyt4h3tpEQmzaMsoaj/Y+jXT5AEHmHr+d1l+ZetphHMNZhyAt3rGlIGX3OfFs1O aeMFLIUG+xlgzCzGfpUWimTfkU3CaKxUV/3GCmpVGym+eS1HGFaBow9ViPQQCLWo LPzjQxJkDcTJrki0cs+IRob1gfUQvVRmC6bUTWl5z21LFMrt3/W65vfig== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvxjjr1g0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:32 +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 45L0QVlA002823; Fri, 21 Jun 2024 00:26:31 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 3yvxjjr1ft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:31 +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 45KLcFvF030990; Fri, 21 Jun 2024 00:26:30 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrsstn0x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:30 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QPco41026042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:27 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC4942004B; Fri, 21 Jun 2024 00:26:24 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B73032004D; Fri, 21 Jun 2024 00:26:23 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:23 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 04/39] kmsan: Increase the maximum store size to 4096 Date: Fri, 21 Jun 2024 02:24:38 +0200 Message-ID: <20240621002616.40684-5-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: J1o-CJjYWKam0l2NJ9h0aJVuFgfwswrO X-Proofpoint-ORIG-GUID: kF08F-e28R6tb6coPiDjcwHsdnBay0lG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=0 impostorscore=0 malwarescore=0 mlxlogscore=742 bulkscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 8BF80C0012 X-Stat-Signature: ijbpwcjg63peu13i8xiiszw8y9i6k4cf X-Rspam-User: X-HE-Tag: 1718929621-554126 X-HE-Meta: U2FsdGVkX186LnYggZCDdIYdIxSmC7pjWBRJjNrFSHHpZu7C8/C3Avvs/ynb0udJNCKZXwkq2EmVYFno9ygYNdpFb0KQCXby3FqVEDadK9/dvdr0+ZjXARXpYH5yhVWesEbExBhaxlDHyh2+7SxflxjIPi1Qd9CB7CZ45YfLXWetXoV/EQheXrq0FCRUzq9d2XN/CzwPTbaypqiW17vR24VFgJ7DqsrL3KAr8qLkHC05PRx+wIgYG8JWJ0PhOMzI5S9NPD3+t5T9LqvBY+VbJzL/KlHhFbF8khkFqX2TH8hRJwvBa990VVtsY3NJ9tQ0vTAFN7Feb2wrmWoveCnJtqUkmGWCQGPwrT0Kk+A8Y6DMTtJtFGrvLqMpHrjjoZDaA67hIxAjmTuHIo/Zg9366TbrClzwvAqnPnZZaD9XAAO/Ro2AyeWze5iCvx3isp5ycLu5X0BC8qaYPRvz/mSFOu8aZEswNi9MabT79wMzl/7KHhcM26uYB/I/6PO6ZegWA8tfzaIGr+UMN9pN4ceLJfBHHzh72DRdA3dDwd3lHKuMPJY4LqsbqzxsgHzy61bO1bpSjeQvAxtRGjQMmfJZCzy6S7msdDf51/m6B99RGmFAQpptSkpDGpzI6J0oKQmr1wxwilW1OhQQRQP4sK//utg7ZRa12clRb+igevyqdaCpobKy14YXNYcqQkzf/tM/kOYgoS2KfpoUJ1O/RbJLcbXpWkyIYQ3djcz+QAhb2osLWWwBS5C42Ymsw6whWYceA5FU3cUyQyYFsZKdrFWNNBNtVD9slx6pm3BCdhaIMlTPZ1WygCcEV6HPKLuHTK9rRFpK+lCcBCwifNIFdUV816+5MVhpMf0XnxRicyeAbCBVEHhmZNvkTY0QSoW0Jgwx0aru/4EDojwkeFOlfyvSmW+WBsbDV1uq4A3oMmjJ2f5yWWWdrY/AuDro+JR8a/sMcXxuckWzEffzKYcMCXl ULZ9nf3o QAAmh1rPCflCVjvOa6oX4THkJYYaIcHPrdnpXqULHVCOjmRswka9JwbEnjjejQEBdv4RqeMQwKl49hnpXh6ROuktsFxzbYjxNXpJOQhzkj66rTHq1TqP1Ke/cpJr9vo7raQHL6MnYcPyFPnGGY1u01QtZrFvuHhxPuB03ZhMt9YA22Ytuu+gFKuYa/ldhA2HYVxEOr24J98IHuhvjcAXJ9d6Vms+nJd+RqD/U6mFvOQ/jaf0+2N0VZP+lk09ydESrX8tS5j4EEbm0oryFo8mBOCXEWA== 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: 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 Fri Jun 21 00:24:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706564 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 96719C2BBCA for ; Fri, 21 Jun 2024 00:26:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D604D8D00F7; Thu, 20 Jun 2024 20:26:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0FD18D00EC; Thu, 20 Jun 2024 20:26:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B89AE8D00F7; Thu, 20 Jun 2024 20:26:47 -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 9D2508D00EC for ; Thu, 20 Jun 2024 20:26:47 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id F126E1606E2 for ; Fri, 21 Jun 2024 00:26:46 +0000 (UTC) X-FDA: 82253005212.09.8C32B33 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf21.hostedemail.com (Postfix) with ESMTP id AEE971C0008 for ; Fri, 21 Jun 2024 00:26:44 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=h0Zvssk6; spf=pass (imf21.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=1718929595; 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=Fx/0bUJMMyUd9fzDdIcrfChiYrfDCnI4sU+BLkWfBMS2EmZIYuY34JXJzF1PFbN3+n7CYV tJFZ0mpQbzw1COIPJvKZ8pWGlexoa/CBnxo51UMQxPl8kMReIiHLUbLaZjYX37BERFza1+ EsQZWUjv95/6dHq7NzLIyNMwEpCCWig= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929595; a=rsa-sha256; cv=none; b=S5i3xAy4bNxo1rpf5vSThVItVNpr47MXqHmVp0dWo96V/q0tUA9rq+uYt/0qIwNcGAeZvl qvmi2Bu+Xz7GT4iOEQeieE7Wr/GaWxdw6yXy/fDgWCHFCjLsAyQt7czO0/IQog2krWe3Pn a0nPzvSYlwzOLcPSeoeLo+ukyaG/Rao= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=h0Zvssk6; spf=pass (imf21.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 45KNSUVn000458; Fri, 21 Jun 2024 00:26:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=3hDUyT9rvjh/u qttZeOy24s2Df+NNUjOmmqDaE5+6Vk=; b=h0Zvssk6U31qRBTvZ/Pep/F4zOG0K UMB+ltMG9SJ3UggEFvoAJ5AKPGn4mpzEhBQuM3OcoBV5mfxgW0+h6XdotimhQlqk +pELs0lzCnCQS2yvB46M5gVhI64pV53Rq71bjpy4OvrE4uAarl8+UOTG2EKdX7JI 0Zw2IW9a+UG1Ayn7x7zQyt7ZeexSF9Vbk9xcuMSyGwuoijUhKu+GkZh6rXN/LIkX W7ZaR8WhLDcweillMTLmQx7MsOx1fcg/nx7srbr0Av/UI1OejqBuB6HSa+z7438j I0VEw4cNTnnAaJnhT04NFnCgscpsJifpLcjlb3GFFqeXXRwkbAG3tUidQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c0704-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:37 +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 45L0QaeN022669; Fri, 21 Jun 2024 00:26:36 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 3yvw8c0700-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:36 +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 45L0G6WD031351; Fri, 21 Jun 2024 00:26:34 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrrq2na9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:34 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QSun21299646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:30 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A3E020043; Fri, 21 Jun 2024 00:26:28 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6ACD22004D; Fri, 21 Jun 2024 00:26:27 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:27 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 07/39] kmsan: Remove a useless assignment from kmsan_vmap_pages_range_noflush() Date: Fri, 21 Jun 2024 02:24:41 +0200 Message-ID: <20240621002616.40684-8-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9aqDnYqiZJrIWgkclNbtCMnokhICs_wR X-Proofpoint-GUID: M6kl4HuHEuc2TVbCgmc2mbFwZv4B5LNB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AEE971C0008 X-Stat-Signature: 9ntm3ghf88i836ma4sgjhoq9p8zbtemb X-HE-Tag: 1718929604-24761 X-HE-Meta: U2FsdGVkX1+HQsQJFP637HThC1aks6Wuy0DLJPB30RbCv9RwEWd6ui1xlHezRNq70MlEtied87b6ruAk6W3usm8hivKi42V7hUR6c8tkosylB+JpikgQi9eh0BFJuRpdxQpEzbAAiVJ4RHUVgb2IPTFb+GEQDFQ446OTdrj2h1vSYGw1u7NqZISqeseUfU+ushV+1gXeze8t03SsbZb6UQF+OA+WYl4VOADY+BjowHkPARdvz6BT0Mw3XoU1VyPqh9DXCtA23GFCAprifK1Cujx0b8KL2xANwrZIx0wm1AFloUmYUmSTIjQECANeLi9o1+/ZHANczI/A7wEEv0QZeomgyK+ht84oLarXijbJmv6BIPYK2fkJBNFe4Bfz7Q3GNJbYwF4e6Zsp+4cUmR2FqCvrTPDaGJf3eqAJd/VmWew5tC7vGTSAsQAUh0F2nI068A44sOCU0BNAGfWfw3f9x/LjZzcEPfQ+uC10TNSQ8tL1czOHBbJd5VSDVPNtb30s7NKlHFBPaTQyRFkzK+x2MzZpBafkfAB+hZoCtDS4ikyRBx4bDiHXsAq1jG2Moa0kX2ELQb7hmFA9WXgt7brwT3f/5g5gueYuVwb5PGvafJHN2XW2mYImqbroxDWDgLltzPkS3oI+osFgZvZS6Ziv0rGaADGaIN+cxggENeyB9zrd2HEQ9gskSqfuDGhAn/ZEnf5sCBA72Kj4UcLwtw1gInA0SwhbBA/ZVA8yTrTlp1sAmSlIL8Bjl1kdK7/F/qvedqHiEbzRIi1rIKDdA2lVSmI7fUWho7+lYQqGiaZTA93fObKYaWxV1OIJiPBdXWyw1Scy9dA/Oei59lFiR8zVVEWOQrFQI9Dm5MpVJynIvGAiCZc1FXKQ2a2o/nuIbBPEysoxApr/Nv1N5JdZupYucnKgfx98GZ6CdTupmGie3rufLgTa2SRkLLnI70mmVhrN6wSlmnxm/YkJk0cTK2Y ZerTjKZg me9OEDOqEjkhuLcAbUkTqx1u/5UdM3Ar4s0LK3zJeqqCMIX1CuCtY+3Xc55T20Vp4+YE5mawIkc54ux0NELYFCT91j07k9kSZTYDckfabxAGLJcJjiq3JMUA5Q3HdX81AxM4MCH/thcMBnTLCOwp/3lmFA7s8P427gpvAc66J6ILbmJ1sf0vQuD2bxsPc3lOnzbjDuDb8oPSH8yTzLPdsjlhoPiSSDW7UGzybcPq6EhBpeu5tewawC8bD84nN5exK69O1H72lYkNuWohzJBUpiQrWo2KPQIyw2bGi 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 Fri Jun 21 00:24:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706566 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 CA6A5C2BBCA for ; Fri, 21 Jun 2024 00:26:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8EA28D00F9; Thu, 20 Jun 2024 20:26:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B491F8D00FA; Thu, 20 Jun 2024 20:26:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F0BB8D00F9; Thu, 20 Jun 2024 20:26:48 -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 77BC98D00EC for ; Thu, 20 Jun 2024 20:26:48 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 41612806CC for ; Fri, 21 Jun 2024 00:26:48 +0000 (UTC) X-FDA: 82253005296.27.0D5CF17 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf14.hostedemail.com (Postfix) with ESMTP id F0D3C100003 for ; Fri, 21 Jun 2024 00:26:45 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=T1ae6wqR; spf=pass (imf14.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=1718929597; 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=SyPA3LZK4UIzxNbPYt4HsCxdnjQtJasTeCalULnlVtvNArGdruYbqqX2Ruo6r/IGOU20DP McDIX0y8laYrJAOVFgVDIIa93iwBHTZ+ZAF2oVuzQXLb/cPb2uSfkZNEAr41GNAtWs4T2L suBUi+puec1b676kNqG7EJDzmgCCDX8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929597; a=rsa-sha256; cv=none; b=n4isswnXiMGAz2xzT319uJ5bLNn8f9y7YMfCattV+5vnnBAhkL465J5DsiSubizWppuzwK WeWVqs+AX9gS37Jn/PhSmVhkmzuCHpb1EH8d8JGWlBTNlWxayqaAGTz3Le8QPyOypylb2e nMj0ebHl1pUA3fm2HT8rsi8zlXdOWbY= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=T1ae6wqR; spf=pass (imf14.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 45L0QM6r009279; Fri, 21 Jun 2024 00:26:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=YaTjcojmIIYPS V3AqgAoZ8tGeMyuD+KvoajbKIBgv5I=; b=T1ae6wqRK9YROa0u2XMwlJZr0wf+q qbKCliA1teQOiJTeX385c2/ycazx07W1gBD0PujYICDk46Y9H/jGHT3ypfUWCbkt 0FsRn7vtmSflslEqqXcJ8RgM5HpsLQ22eEw1n6/lsaNbLVwR+YU0moktH7LrFdtw j4x4HLfP66Res3msgylQYSp0MpHpos7sDIOGiVlxxEAsEJDjo8x+nj/tKstsPu/H fjl2MZq+lVoUPHDZlV8NzkHUTvU4Zn6Zu6oYmnQWciHl4f2K2vfwxmtpmFhzl94d cFKgmqWChUPn9ey10ldcTPleA3hfsTghU05RcwB99hw5uYZow4NzLLKOQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrdr8ab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:36 +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 45L0QaaB009416; Fri, 21 Jun 2024 00:26:36 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 3yvvrdr8a6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:36 +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 45L0GVsp025708; Fri, 21 Jun 2024 00:26:35 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrqv2nku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:35 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QTRt52101600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:31 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEEE02004F; Fri, 21 Jun 2024 00:26:29 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F4C92004D; Fri, 21 Jun 2024 00:26:28 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:28 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 08/39] kmsan: Remove an x86-specific #include from kmsan.h Date: Fri, 21 Jun 2024 02:24:42 +0200 Message-ID: <20240621002616.40684-9-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: vyxYbYMv0_NAWx6wam-6wBrYJn6RoEVq X-Proofpoint-ORIG-GUID: 5IOHAuWOwgEPcoqMkZyFmjoadwmxjUKH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Rspamd-Queue-Id: F0D3C100003 X-Stat-Signature: g6q8hqqdxtmhg85kh7dk6umzpcyg1bjj X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718929605-673349 X-HE-Meta: U2FsdGVkX19V8QqUnRGun8/lKJUcz8kzQ/61KSRxGZcB0fNpnmvcjAyo1p6CB+B8lL9Yy+LbrrWKMVYLhbJzD2CjlwLYuVgGt0H2pQAp4PXQH6oSlL0hgEYxEFTJ8KzOX1sxDdkon/9b5+y4mdG7YvNbVIudyDI/5wXbdaEqudUJ87t80BiONG0Q2KXjrVq4u7YJy6c94pXK8/LjeEO6ph/Z+28nBIeSgvw6v4m5WTiaiubwrlQiazzBQfsySkE2UY0/RST4/adJOdlP+EPwg4JffKgQRw1QRKdw8/ZgSJd4Fv5wTaGnfuVu3/jXz8swIfGD3BEIyBuGlfXUXc5wuPUcT4n0W9HGkdSkbNShUzjGR9vRYstfQeTdTxz6TJvkHv50y7mKIdxCC8YUV+dhjZ6tq1mVnM1h0q9GgZCDknqOG51XPNp9Ag45vP2n1Uv/U/9qSny5Yh973EpWdakt/AKeH9SumK5HQLlphG3geu94KY3APn8u3KsewXu5tjE3ukb7nWbXWvhIrXsA2+dU52pGqcPclSd9cDadbowc0cRB8Rl9GYbJD+/tC7/w2PgksR0X6u0GwGORBEPZMUKBwI0M6Z0VAPnSFpbDoIGY4Lyc+QAZdA1iy2SuE2N/ftZPhX9iSruIyulTbPxo+3WgbyVSkJN+f3OYF6PbUChsPHiv0/EDnFjG6yiAfnZ7h1ewl0Oq8YyPNH+pE2iMMt+2b/nwmsOyaZuypyY7lXpxe+WOlZKMB7huIu1oDgOpQjKfDZzXL3Yc5kNVO5DbmVfOZHfzlDnBzlqelBsYVFa7wwm2EVzuBKUvPUHX1Psyys//jsH6hE+kcS0QIJ0tW65Bje/7TyU/yR49mUGktiwS9bcoCQV6F37mCf3R0iVRmsa0M842n1BSqeHWkgUMhabBAqD2upyUypjNhbmdJN9QI4jfeszydIfZIQD/7s5fVLWNSHUB3vBFui8ceZq1SGn AaPB4vUe BdA2v+Waf1hLA/nt1Ca/Tzt/X1azXFEkdg6Say5TFD91pmRPa/8ISDdKqj0DggqQFUlwl9V72hc+mle711mFZuk0F1DxTDMKc5vMoCdbnLrpaihwFOneLB8ZtAQE1NS3fyJX2UC+STZnNG138dPqsTYR4TaDq6W7vazcVZm+Ct0KG46dpluqB2WezEj0Q0qYhFU9j4NX8l241cxppXHkmufnKOL7srseIFuhpX/7dNi9ayF0bBXu42tyxJKPnvD5ZzYqIeXnPAWa4Il0irmAf4ngyoLTniGOHAVamAAY/HCNDoUHA3RFH9h7gK8tu0enZp9mq8yxoRktnXke9q8ZcsCwLVBwXyKF9HGXoRV3d4KXOWTY= 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 Fri Jun 21 00:24:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706567 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 2202EC2BA18 for ; Fri, 21 Jun 2024 00:26:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B7608D00FA; Thu, 20 Jun 2024 20:26:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 040108D00EC; Thu, 20 Jun 2024 20:26:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB4618D00FB; Thu, 20 Jun 2024 20:26:48 -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 AD0498D00EC for ; Thu, 20 Jun 2024 20:26:48 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4C681140678 for ; Fri, 21 Jun 2024 00:26:48 +0000 (UTC) X-FDA: 82253005296.24.987273F Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf06.hostedemail.com (Postfix) with ESMTP id 0E417180003 for ; Fri, 21 Jun 2024 00:26:45 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ggoX2Pks; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf06.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=1718929598; a=rsa-sha256; cv=none; b=jnMXV9zbI/OA9sO1ogSPQJYbUcA7OqVwTaNq6M+tJAMw85tBvfs+7uvMC41t8D6evnT9gc ouou4Ca9lqZmr8GAi3r9dmiCgD72AlKO30SueExo5StWSeIaDlKzg/lw6+tAnjPd+eCQ4b mlEcscCr/EPPvIUsepgmU3t1XiAlvJc= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ggoX2Pks; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf06.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=1718929598; 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=ah4xfVCHNViASZu9OS8C5bCxAH6NMTO/t1qMSUm0DA8=; b=PyOQXjVP63YDHMM5ce2Lr+PB3B9LiOj7dtCCwrjZ5nS3loxtN9H7X6bjwyYlhqG0V75scH a7T+cUFWUyiiaNbZhi8tpdF90QZp3aoLJ6uDLZJjJ2wWFsNL8uCpwBy6saTXhpZeJPNuXu k3dnpMzrheuY/HJkCqdWxdeKZMHxrxo= 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 45KNufV2003803; Fri, 21 Jun 2024 00:26:39 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=ah4xfVCHNViAS Zu9OS8C5bCxAH6NMTO/t1qMSUm0DA8=; b=ggoX2Pksfiz39yEC7CqMLNdghd9Hn 9tk6/wM+ZTr+PWsNNhjk8GfhsFSoXmUNFgXY1Xy6bjwqkPRm+iEznu7EHCm6MB/p wrnUqOBjxcLWYR6WAGKk6J3IOywsQQHYcfS59dbF4QKvHybe+gB4SPJKOg5BfGeq fx9HIpiiw7TpOyGWn6n0KZjNHLDw74t0ndJ0f7VMZuQgIl2qQU/QGZ6i49oxdaQi lE1bBtPu/E5lvQdv6SBQjbjoh5B2QR7H81QsnrUkEGR8Tz76l8oWM568UOFpCIOG KFqMboyLbYmwQZbYkG/MmA2l9nVPvwkSHf2WdrLggThRRvrizJEiwO3Gw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrr07sx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:39 +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 45L0Qc7G016947; Fri, 21 Jun 2024 00:26:38 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 3yvvrr07st-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:38 +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 45L0FLa7019941; Fri, 21 Jun 2024 00:26:38 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrqujnwn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:37 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QWMu51053006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:34 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 32A8A2004B; Fri, 21 Jun 2024 00:26:32 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 144C620040; Fri, 21 Jun 2024 00:26:31 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:30 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 10/39] kmsan: Export panic_on_kmsan Date: Fri, 21 Jun 2024 02:24:44 +0200 Message-ID: <20240621002616.40684-11-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -Q14BQ2YT5_Te4RHh-dfpK1esFV--JR1 X-Proofpoint-ORIG-GUID: WQTMj1N_z0nQDf3HOEeVuLpEFkVxIMQc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 impostorscore=0 adultscore=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0E417180003 X-Stat-Signature: oagfaw3nbkqgh71hznzcib3eqhpm6t1h X-Rspam-User: X-HE-Tag: 1718929605-784200 X-HE-Meta: U2FsdGVkX18k0WMfLnbPpcH8JBPnLvo5g9mN6Q+X2jbfpWahVWv5FL7cnTb4QgFQIxZd35WcKrLCsKda98F8YsAiUExovrHT3oyIFeHUQtcBJ1w8oi+rNyGqSbpod5yvjxeXaDUX4NH57PE0CZ8Jx8K7ZP7KVFvz5nkcJb2E+tTDjmhZdKozr5KAOT9JWFQrFOHgHK0q87k0/LJZ34B/zMhCI6r8unYd6V0efAai5moNQh9tPU0vzfappjvL9Ninb/qUYbq0lPnLYlH5aYNQw3gd1XlcQji7Due/3ikhkEy5A4BuopSchw1iyjKbGuITwxsPVviiN1TA/o8pcmVzaV9qVcwRD6PWSFmPv5nNxlmOiFg54ec7S+t9fylQaXfG9Yfeqk44SPS8xpNugrykdXlHmn+sRkQF+BJquXN/+ALh4VPrs64G9VgCtQv8CqKI6J7DK+bbe6HT/3hLzuaAhQti+nNyuayG2dKm9T+ZExXnBCnCWPyn6oh5xCCX0TrFZIzOlQXsn+70u+QSRDcHSrtNTz8NCXWNlREQkIU8A778Pl4L+8yqj/jlXlralv4bpByNMMyS57DXo+XHdwvLCLjmpXOhTagH9iAjgkP6jdCZSt1V7Plx7yHI1lfq9YpyxT2nrcG76SEhxVBCtYCsT1qDgl/pqeyldy7IO86UWSulkuHWoJ9p6qk1H17rbPs+e07mW7VUBEZ8DgzAbyKasTQM7YWa8wyzbVsDzpdWQoeI9MS0bgUn76j98k+L/kbWQm+4bWdpR1l1zDlxhSxBJUBX5lwtjKahdbeturTnLjf7Ms65W3Xx/1IgWSXuHhercAog7HeMPDO50VnFfEUKZtNwKrURR6KUaEoyld30yFT2yfrGwfExAcvNIRvouwaZkqqUSSZQohZ6nkyjCLIPOAxhocoOkIY19NIuBuTLrH0B2li2fKJPhglfVAuoa/IaFth8QYb5g/IB2tWTRng 9pKkTBZ4 xKHWiqLuG9MUfl7FQO6tUDt8uvVk1iHB8hHl2oap8nx7cbw1LWXTC2LQrCsp//ywgZoWe35qTvLrUheGjuw1Iv8XQpyDZ06FbG5tE48FSMxdzTo5KLoI3h9anoEDrI8fTFbal2Fx2sCiKb8hcJ82BmZZeAqn7RSXsKuMmzpiZGqoQtwVq+jSrOyj+PSF06Y9vbs0Ok3X1ov2MG2mQ4rWZtiVwCyufxBxGEycvEvWHq/zIdhknIHZrPvO8bf98LzRZxFE9D8cyW16rTvh51WwfvAdb3TbQFJG1ci7lgPAADhpq2xADxZ/EfB6S/LqRUaNDmQXj X-Bogosity: Ham, tests=bogofilter, spamicity=0.000736, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: When building the kmsan test as a module, modpost fails with the following error message: ERROR: modpost: "panic_on_kmsan" [mm/kmsan/kmsan_test.ko] undefined! Export panic_on_kmsan in order to improve the KMSAN usability for modules. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/report.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/kmsan/report.c b/mm/kmsan/report.c index 02736ec757f2..c79d3b0d2d0d 100644 --- a/mm/kmsan/report.c +++ b/mm/kmsan/report.c @@ -20,6 +20,7 @@ static DEFINE_RAW_SPINLOCK(kmsan_report_lock); /* Protected by kmsan_report_lock */ static char report_local_descr[DESCR_SIZE]; int panic_on_kmsan __read_mostly; +EXPORT_SYMBOL_GPL(panic_on_kmsan); #ifdef MODULE_PARAM_PREFIX #undef MODULE_PARAM_PREFIX From patchwork Fri Jun 21 00:24:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706569 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 E2B2FC2BA18 for ; Fri, 21 Jun 2024 00:27:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60F136B0122; Thu, 20 Jun 2024 20:26:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BD6B6B0125; Thu, 20 Jun 2024 20:26:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 411AE6B0122; Thu, 20 Jun 2024 20:26: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 146626B00FF for ; Thu, 20 Jun 2024 20:26:52 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id CCDF3A06C3 for ; Fri, 21 Jun 2024 00:26:51 +0000 (UTC) X-FDA: 82253005422.27.C1297F4 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf25.hostedemail.com (Postfix) with ESMTP id 83564A000E for ; Fri, 21 Jun 2024 00:26:49 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=MJukNpgb; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf25.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=1718929602; a=rsa-sha256; cv=none; b=b6+Fdz1ZFDrmRfFKAfwkFVi6kHmKZkOR9NIXDMGqHxKNGIJ/VmhB1jVJ0RK/ePsbLncjlR 3901Jvff/gydjRxkhBaliIrOhfEegbRJSfBmd++V/71gR6bJZyZ5BBRN/4nWegalC0aw8U npUTen2G/0FZAGUznRzH1VaAcEsQBow= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=MJukNpgb; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf25.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=1718929602; 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=JyCixd63UT10LcLHBLxXvC3vYkg4ad8S/LeVZYMb+Kc=; b=O0+GFpCi4QTG1eMnTj3EpCJgQ9bxxMPBmpgOvOEG4/71JlUMw5DiTqOhsWMZjme4+/JPzv qzSck+N9qRmv+1gAudJNa4ElDlL9IQvmaSi5BeSiSFb8+7Pvrj9LBDGGQox8wr0quZ+tG0 36jcfK/iXXo2t2lGnHSlRtnWfl5T+lE= 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 45KN6ts3030154; Fri, 21 Jun 2024 00:26: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=JyCixd63UT10L cLHBLxXvC3vYkg4ad8S/LeVZYMb+Kc=; b=MJukNpgbMpWrVF59W4IW8brxQK6N/ BwwR05DugY4rSzfxJ0cm2odtgmDFVmO93seeGwj5PpnHTJOAdpRZqw76JlJePl+c TktrXlYUnkhQuSqsVWJGS8N1rcrY1UAGuxSh5YQjZ+SAfu0KJkgTnFmB5t/so+ji fZAxt4t8Z6/4UyC7jHtt5XO6OCks1SzIp17knHbxcY3Tzvybv97LGc7okU4zTqec 30Wjz4XHmMT30OgX4wJNkLItoFzKrOsz6iZdd1aY3jeSSV1SsAcKwlKlk86hj/Xp E+2BSlEArJcglqb8rtvvuoTokvytHKZiPqH5JAw9qUr96hQ/lXoSkoYRQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c070d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:41 +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 45L0Qepq022701; Fri, 21 Jun 2024 00:26:40 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 3yvw8c0707-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:40 +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 45L0PCOc019980; Fri, 21 Jun 2024 00:26:39 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrqujnws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:39 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QX1N16253262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:35 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74F5B2004D; Fri, 21 Jun 2024 00:26:33 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4673E20040; Fri, 21 Jun 2024 00:26:32 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 11/39] kmsan: Allow disabling KMSAN checks for the current task Date: Fri, 21 Jun 2024 02:24:45 +0200 Message-ID: <20240621002616.40684-12-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: clVUn1IDbtacwO_0GWY7U5sOyrimaMLk X-Proofpoint-GUID: X4_a9bjV2cmY5PTGlnJ8u_RDQjykc-B4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Queue-Id: 83564A000E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: u5o743rmw616pj1ckwwpwpyz8tiztcze X-HE-Tag: 1718929609-77092 X-HE-Meta: U2FsdGVkX19HFF6Ha0ud9HydVi1eNQJLuEiOXSeCLllKjzRTWWUKjw1J2xXy6yX+pHfzvh/CYDCVxfn7xumgX4dNuLsGkL3wyzs9pn+8QmjHbO7Wou6g+YygZU+jaMLjwpsJZbfE4yXILIfTn+kA4LLQCw57UJr5oxasLMW6gUZ/crRe50NhFokUdbUCh8Mlg3yZLmVgJfbppSx3iskFJcUzmFZoaJ0YwUlpyX8HNMuad30mHWDb0MMzUhjbmipPJtKwnAcP5GbXmXymy0lJk01rdTwLY/JMi2BiKPA2WROqcNo2IN7R/70CWVCd0s5cLl76FNgh254nyCtjsSDgfPtWcUGbqCeFysSyn0PxLic9EXCZhDhfxTK5mfekF9dn+zROLZihKd33F4MwSThfM66d2L9HzflZOgZL2K63A8YCBjl3psUM+8baCvx99LF9tnriUyrPzISecM8qPvx2gP5/9qJwIRV5U+PnYbiXf7b+ZkLugFgE20yQkGYe4K01FSU6jMA0Qv2bPONfqjUpqm0gYuoB8bohjLtFF7/p9TRZIEpa9UIBIIxBVKvrdWFoqHTVsFD6gLXkXqWhaQQNUoooa0oJED48BDIv9cUiEfcgyVXlw9me7EAt6o31vJBlCnadrXHAnGL7n0hOy6BIU8Z671bxtu+bOcLep4cUEjhiDtQ87fO4/trI+jBijF22IkTlEUoFwzH8X1UrDmwEzho2Swg/SG+7+EKHWGt6DpIzEv21g0JkSDAD8vdHzsCLtduxWtPm6aGLG7JYMMepSNxsVk63QANzkfCBkJao8okeSuFwaHjhta8SOsDeHMS0nQCwUIn9Se5grRh4i5UNQ/C1NUrGQ5RWej2b8kIlP7CNeBfHe3LXmoboQlZK1SuRBavACL4rmlApDUbe3Aop5MSw8rooumQxx6mxBmXo0lX3+JAmQI+uJd4KGP3oYpG0obpIIAVMnnzUBewOhKC tRuPd9Bf Yl0kjB1G0+7lwIt4KiOD86jJ2wKri0QqwN7gIIdEg0J55YZCHBNmOc0bVgymNrXjzoVMw0JBZtEajwHc+0mc7uu5YhO8+h+zC2PQZTUzKD0v6FmTwTGPVImP6XwMaPaoT3TSB1e0PPnBzgWjuv04wnIZcDM/DJavXIh+UDK3qNbIldIWNZP9osxpJixYZx13OXUbdRIyTjvddY+4CP2EXa9g3didwasovCjQPXHoEhktv1K393B85uJpgMQ== 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. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- Documentation/dev-tools/kmsan.rst | 11 +++++++++-- 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, 55 insertions(+), 10 deletions(-) diff --git a/Documentation/dev-tools/kmsan.rst b/Documentation/dev-tools/kmsan.rst index 323eedad53cd..6a48d96c5c85 100644 --- a/Documentation/dev-tools/kmsan.rst +++ b/Documentation/dev-tools/kmsan.rst @@ -110,6 +110,13 @@ in the Makefile. Think of this as applying ``__no_sanitize_memory`` to every function in the file or directory. Most users won't need KMSAN_SANITIZE, unless their code gets broken by KMSAN (e.g. runs at early boot time). +KMSAN checks can also be temporarily disabled for the current task using +``kmsan_disable_current()`` and ``kmsan_enable_current()`` calls. Each +``kmsan_enable_current()`` call must be preceded by a +``kmsan_disable_current()`` call; these call pairs may be nested. One needs to +be careful with these calls, keeping the regions short and preferring other +ways to disable instrumentation, where possible. + Support ======= @@ -338,11 +345,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..14b5ea6d3a43 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 Fri Jun 21 00:24:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706571 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 698CBC2BBCA for ; Fri, 21 Jun 2024 00:27:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 35A936B0130; Thu, 20 Jun 2024 20:26:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2BA576B0162; Thu, 20 Jun 2024 20:26:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F34416B0130; Thu, 20 Jun 2024 20:26:52 -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 BD5976B0130 for ; Thu, 20 Jun 2024 20:26:52 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6F75B14067A for ; Fri, 21 Jun 2024 00:26:52 +0000 (UTC) X-FDA: 82253005464.18.3891B39 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf13.hostedemail.com (Postfix) with ESMTP id 3049320005 for ; Fri, 21 Jun 2024 00:26:49 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=TyYZLocx; 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=1718929605; 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=wYZcdN8GaCldurJMmgBO/xn6iWaosLK3Wj+Mr2vvPT0=; b=XyydPndPAsYl2AGywd/dO6zBR+tY8R2nUOPfQTGWsiL5rblTc0V/H/DRp1x+LuPLE0Ml0h c2Rel4WwExoaIqKNZhfoc2ja/LA+XrJX8/XH5SgHVGI0/YGQQTDeebSs2n4JKSfE4niDGK lrJprfVKCWaiyd75t0LRuqttMSVZBBk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=TyYZLocx; 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929605; a=rsa-sha256; cv=none; b=pHHZLHUZeD26VZgToGgNxjBw10P2EfAmsv60TkhU0hNogs/Xd24DNcUI0Nnem/pZ2pE36b Ev5A/cthEAjDD/tH3R+NJ2JqvUm6ZK7iXKsEx5OTi1am8JnyCuEkaBOB68Jd1TjOLGOVRQ RmiMNfqqlOPnF9p0LQll5d5X9+8axv8= 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 45KNSIao032554; Fri, 21 Jun 2024 00:26: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=wYZcdN8GaCldu rJMmgBO/xn6iWaosLK3Wj+Mr2vvPT0=; b=TyYZLocxPDZI6g1LUnLnTM6RDN3bb M7v8iYyXepna0Yr+j7Hk5FEq7FoB2fFjURkk5+DxhadWyAdzDpOU7JjHFnnP1Id7 +q2ZzwdPHAfACj6Fq251rnzGpfoq06AKR8ergc/fm7tKTPfAHc+3ANsjdPV/3Spm UXnRKjK8/PCs8Kf1NymeznspqQ/ZkrqSzmGlc0pSWIrtqfPET2uyqxvvaxZP/2sf CHNIpssaZWn6vu4fcVb00iEWBPhdzTMdhj0h6pzjDHlVaBy2dxQWT3mbbf+jxvfo 585oNd2nePmOktSPHHnN6QYWTHN5g/dPs/pDZJuPCSSlyxVnghKF1WtWA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c070g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26: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 45L0QSYH022603; Fri, 21 Jun 2024 00:26: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 3yvw8c070a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26: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 45L0EnR4019910; Fri, 21 Jun 2024 00:26:40 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrqujnwx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:40 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QY4p49611188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:36 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A9F7720040; Fri, 21 Jun 2024 00:26:34 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86EEE2004E; Fri, 21 Jun 2024 00:26:33 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 12/39] kmsan: Introduce memset_no_sanitize_memory() Date: Fri, 21 Jun 2024 02:24:46 +0200 Message-ID: <20240621002616.40684-13-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: HVD5r9y6qc451bgRBsPVDEcQFobrK51H X-Proofpoint-GUID: juOALtlB8s58b-RD-irHl1aByTJkzhA_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 mlxlogscore=867 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 3049320005 X-Stat-Signature: 1zxg8z491qxtp5tmmsoiy6f9asmj9rez X-HE-Tag: 1718929609-242668 X-HE-Meta: U2FsdGVkX18hosvzVreCvUrIAHWV0bWhFtau2dsoMqB1YrvD3fFrF+uVJWMJzTVjLiYe5n3dxzEEa7BQLfj7uRJf/uOSRSc9GBZd7D4hM7mhJJzvd4jWAJLfN7do9rgE6d6JAjxlfURD3qy4pVawdgaa7lpWMMnJUUHyROVtfhdLuLz1WPw8x7aPlRUyRwMA4lZx31zlLE3WxCERBZTrwNNmkE2215VUiUYomgEyeV721URJW3UdyvFMJREk3cLokF8NW02Km2RNGIjyHy4jp+CmgdYQC2rkizTv6OEFOoKcqeYNjz12GDcZq8T2bsBwCBsMHlnaSmCIbzRYrINwaWFzQEpvS1T1Sw3mOGMuymCk3IxfrLZz1WYPxSW3F4AjDV201w7CLr9+dvv2Z961StPbxnvOrz1uxE/DlqnHuAyXXH9JNKHAZpptU8Sf+NWY08wckiHVOnj+ypFhbg82k0j7oqBc87fPe4dRKdYfGfJQRnSGzwJi+Ea8fnGzaAmf6eiXSLqUmSGJxxS1n5rxJhnNgUOcp9Njxdvn92JP/PutKGsIQ2ulgjgSKgVyS21H0KFZWj5m12DRsESe0PR9OkPuBWm3IEGytyhudBkSPGd9wYjpLQmKFUdwfBx+bua3j36ddL/6ICFsnu3QxJSbVc82nF16+fjFn5J733Vg9qXxRTD6mE637N/hcNLN1AxhVOYncyLWeFEqFUX3hH+YXvmzIMu8VoVctBIEb4eHj6YpL0JQhfEunjUNEBuXr+PsFNG0M7nS42ImS0T4BOVH38yxU+fAYxPPrW8dzwmgmG4yGqvcmPh4rINepuNk6pNoGjF5C/XxCeY6zXQvqGv16cgy8qFzyzdtXIpf6ApwjIqumX/rInfd8qOJtBOub/ooZbm9gYlNc/QrRYUJGcGypGu1XylpxktvsXctFLsGXoCGLPys6nC6ivnEewhFLGWiNmMzFZUceCB+qDsgZ27 kVS7J4az QNeCGKNh5ni2inhIfgEWvVGvmxGn/3TPEjUxsb47dFebklzOlviVQptgSQvhHE+gxX10vaZc2VnDQCY/JA2UJ8TnDl5bD93xKHcYgJtgdQLtwFKaNTvalSvT5m1pIHlZdHiK5WYn0OGLK3+MBABksUu3r3wHtgnKUJyRA7MKurV2gQSQ76O39IbX+SV558s/Fnbtx1ckmPaIAjfjBvfZkg7yDv4PaXUeu6tgUt8IuuUSNxF2tn3mkDALgWyQRODkIFf8nlxUl+6R3nRHaweatjeT/6qsnWkNVMjamoT1z4d0vEY+f14ghEAw4RBjw6A0ATuFf X-Bogosity: Ham, tests=bogofilter, spamicity=0.000066, 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 wrapper for memset() that prevents unpoisoning. This is useful for filling memory allocator redzones. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- include/linux/kmsan.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/kmsan.h b/include/linux/kmsan.h index 14b5ea6d3a43..7109644f4c19 100644 --- a/include/linux/kmsan.h +++ b/include/linux/kmsan.h @@ -255,6 +255,19 @@ void kmsan_enable_current(void); */ void kmsan_disable_current(void); +/** + * memset_no_sanitize_memory(): Fill memory without KMSAN instrumentation. + * @s: address of kernel memory to fill. + * @c: constant byte to fill the memory with. + * @n: number of bytes to fill. + * + * This is like memset(), but without KMSAN instrumentation. + */ +static inline void *memset_no_sanitize_memory(void *s, int c, size_t n) +{ + return __memset(s, c, n); +} + #else static inline void kmsan_init_shadow(void) @@ -362,6 +375,11 @@ static inline void kmsan_disable_current(void) { } +static inline void *memset_no_sanitize_memory(void *s, int c, size_t n) +{ + return memset(s, c, n); +} + #endif #endif /* _LINUX_KMSAN_H */ From patchwork Fri Jun 21 00:24:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706570 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 E8748C2BD05 for ; Fri, 21 Jun 2024 00:27:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F38456B0140; Thu, 20 Jun 2024 20:26:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4F4E6B0160; Thu, 20 Jun 2024 20:26:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9E9F6B0140; Thu, 20 Jun 2024 20:26: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 A42D76B0125 for ; Thu, 20 Jun 2024 20:26:52 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2C10F806CC for ; Fri, 21 Jun 2024 00:26:52 +0000 (UTC) X-FDA: 82253005464.30.EF12610 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf10.hostedemail.com (Postfix) with ESMTP id EF329C0005 for ; Fri, 21 Jun 2024 00:26:49 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=omgAPtXZ; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf10.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=1718929602; a=rsa-sha256; cv=none; b=6/ZXvxBiFYMZ0E6Or8CxR2YkQfaSeARcx3JHY0Q0CJx0HL7FVsmly3j88pMtQ63a7LI8eV cAurY9aDc2n3UggwFGoCMKWjspMW5/NomVs5/aKQxzQQ6KuHPPKI6GCw/LFFNDdNsJtdbf eqnylyNkhGST2VrEBszZ94EsXqsg5bo= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=omgAPtXZ; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf10.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=1718929602; 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=Jg9ruRohxVRU5pl+TsU+/DFApI3oiRhPhGaXlm3lfTSThpSc8MISdn6U0ezHAnmjt0GW3o GylprR7CXiW3vcGkHZnwMHWXVZxTxiZmp4XktHEp+FuyKYnJ1nBcNAZbayApVDQ+giQrlN pU5tYoJOZg63/h4bzEqbej6xfagtp7I= 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 45KNwuqu026203; Fri, 21 Jun 2024 00:26:44 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=omgAPtXZa2h+wM2Uz5C2qJvs5wx5Q hXHdc0myeGyh95SHUQqk3gFhzs6od31Zynj67GtVY/MP4+us+8A59m4u+rOSEZqv +5/QW7ONrnSvNZ3i7t+BxsrkFEt3Lgi6BuhScGzwhhA039kLykk/F0Cyf09aHBsJ JEVikiBywlSH3+VBn98+AcAL+UYQ2IEFRC3qsMse0duCDFeRk8YjNo2jOSDh33lV hLOTxWjgwoiFL2nwu6m1/XqKbFssI9WK+RppGnpTuf/jVRjm9jFPPHL4K9dS5B0P IhMOGlgUeBeYcND3kVCOh0J1qCr8oUFkKxbmURIXMw4U4wfx4RrRWPwcA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvxjjr1hr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:44 +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 45L0QhWV003105; Fri, 21 Jun 2024 00:26:43 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 3yvxjjr1hg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:43 +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 45L0HLif030949; Fri, 21 Jun 2024 00:26:42 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrsstn1u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:42 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QbQM56361224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:39 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1F4D02004F; Fri, 21 Jun 2024 00:26:37 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F2D0F2004B; Fri, 21 Jun 2024 00:26:35 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:35 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 14/39] kmsan: Use ALIGN_DOWN() in kmsan_get_metadata() Date: Fri, 21 Jun 2024 02:24:48 +0200 Message-ID: <20240621002616.40684-15-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 5W7KJG6jJlxWPE_in6LwMdbQ8ARjeHya X-Proofpoint-ORIG-GUID: JqP1_YZ35bt2dIEOHFacKgEIXr16xCpW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: EF329C0005 X-Stat-Signature: nekrnef5dz1yan7jcpxua4d76q7j5yu7 X-Rspam-User: X-HE-Tag: 1718929609-283361 X-HE-Meta: U2FsdGVkX1+Vt+tq9IYeckO4uHLgtzT+R2Swvqu7IhjdPLCGVmf8Hr7LnmxA/yZZAnjUsBSFL0TtZk3lyhE2oSoIP4aO28BUSdJ4Fity9exZfTSv+gM51uVYA1pxUNyi6i9U38oaVW25BrycQxxvsjHJywhjWqCt85glFVehYS1WDAtjjOUEF4H0RkbiIazeltF2iKCv77Xx8ji/gyn3Rfarwzokx/9mpi5FSnvRt8mmUSd5Q/bIDLaPvot/cpmlJWKPnu+uhL3imYiJIBJW9RXfib9c4QkkkFgKJ6ufvUJbt5pvyYJFs8w5D08nkQ9+tan6RwgsMfJI7upM6uNuMZJN9PmI+SvzmVb1deDP/bM+wUELLSbg9GbipZ+cFiV3NZttsPKF889xtX3pO25P1C9qNROM3mPue9w8EE6Nu2E8AuuzESkCPWU8BIahsIP4BEERt42KSkSCYEpXLRjtMwZIg2wCr1riQZJkXqI5TJsgknT+ki/Jyp0yYo1PWm/m4E9TXZrXBw3fl6lZxbBmIS5wegqk/dwLXoiDzZWXQ7nG5ZHgsqWrx/2OD1ha8FFh6U9S+YBJa7QC5Sd2sT1J7+rMiuuwMgKURRrg1dz1j09shrV31g4c6Tu93mDsQR7nraOiWCWFbXpvrokJwHGlbmbGgcvBNDZqyPj3XxBx4/1qZrlCaUdxoppn9sewbycB1w5D/wxtvyiUaF1j+aEgIc6SjUM9eqnD0RPaq8akS3jTM3UyjwZou4BVL5bqtNQAAlaabDjbLEqNQ4yrYOAsaPknPZIlXRinGzWfmRh7ejhpE3Z2/8A4Zlay1GUq0mvRPlBgSOQybFmm+0tMI1n4xCcyOqV7RToPNByLcY+nHmUriXNmXFSsAXLnuTvOahoEg4giLV02CCYzXK04hO2+c5C5s0YKoXqkpFzraUEiDDh7QeGP8HvRb7n6ZBwrSwXTxYaip2BFwAZnu2LpMKh whiAZBFQ qIb4TvtymND9S3fH9AtAd2tgGgeLzTAeaplD5pHez06fI3F9VskPLyHBo3nQI0XPSHlCQIDXZDShxxPz2Jy8t+xsGrlbYeoCnswexj0CcgoR4QjQaynxHMp6XXa/dM5P8RpuPm1FhzGBgSxjTLQ1niWU5FJsxbp4TEO6bkAhv1+j+VDPSUtaMKim1fiJ0qymqozeqJftjzK3LwU8y/kE8u3IMVhkyCTELO+TNZRP/xFmPXkEVsNPxqd7j76gzk3SpqHx5l2TKYmM2xKaYZDm5abzaiuS2c3sqLMGo0b5d8fI01/nVEgiptS8E6axrYnPM6HXH X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 Fri Jun 21 00:24:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706572 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 BC640C2BA18 for ; Fri, 21 Jun 2024 00:27:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 242436B0162; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CB646B0163; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE6EB6B0166; Thu, 20 Jun 2024 20:26:56 -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 CBE216B0162 for ; Thu, 20 Jun 2024 20:26:56 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 82D9EC06DB for ; Fri, 21 Jun 2024 00:26:56 +0000 (UTC) X-FDA: 82253005632.20.F375D56 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf28.hostedemail.com (Postfix) with ESMTP id 39C36C0005 for ; Fri, 21 Jun 2024 00:26:54 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=s7jYJbCG; 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; 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=1718929604; 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=OuTJsGR9CKQp5KU/moT9q7/MyfMfBzEfOFMR8s/AFMc=; b=Ng4z+mMLfW1zzfzPbXUOKsfkxsKF6MQTl4TcoGe7S1hes/hLg3jJKMeJJlcpmFDQR6FxaM u/jYkKhADFIxVgCJtmzgQbZo6SZOp4bUfr7YaHj3RZLNxJzLX3oABW8p4+yikl8xO/BSXn O5Abcb4jHHBI4Y3MOI5bjRWzStdHztY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929604; a=rsa-sha256; cv=none; b=CG5SQuevk9j5ozSSXcbhTmXPvEWvuGxM3/r+Epluhk+jty7fwBxgPjJihXAulk6wC8ICIB 0pYIrg+IYGJHSjoBcg7u4gGjXmikd04O9tGY1r5E8iYRobkPUgTlpln9od6EIwIikOZjcn HX8CghoVRdkdURZG8R8TySMlTvN4K+I= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=s7jYJbCG; 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; 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 45L0QQ9Y007784; Fri, 21 Jun 2024 00:26: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=OuTJsGR9CKQp5 KU/moT9q7/MyfMfBzEfOFMR8s/AFMc=; b=s7jYJbCG6yxpR8mK4DsWbU1FeA0XH 4dM0Zg1AMMQg6R18G9yk8We2bf0nMJUIRUB9MCgEZO56akknYth0HO5iohGDPw0e 7+B6FuunWI0tzMevqV8Huu5/ZzNRdnifY8uhQbZ6TdkhGf6V0YyrY3hv8jBJpJH0 WiRjnIMd1TWjKBYepE/Ypiwt7vmr5CbU1yEx5vWp/INBXEBYwQfhes43wf7NAsRf SISs2ALtSnLB6MuQ3Pp9xhTpXHG+wrCKkzeZxp9TdnBA2Jc/NcO8e0nK+40+g3ob pugGCRJ2zzVjzdZt7tmnHnotqDS1qbBj5bdIVO6IRE8SNv/YRdqoonoTw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c875n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26: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 45L0Qkd4007867; Fri, 21 Jun 2024 00:26:46 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 3yvw8c875f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:45 +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 45L0IDHa030896; Fri, 21 Jun 2024 00:26:44 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrsstn22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:44 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QcWh49676562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:40 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56BB92004E; Fri, 21 Jun 2024 00:26:38 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 332632004B; Fri, 21 Jun 2024 00:26:37 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 15/39] kmsan: Do not round up pg_data_t size Date: Fri, 21 Jun 2024 02:24:49 +0200 Message-ID: <20240621002616.40684-16-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: l6sxtiSRHhh5e4E51hgME4dLqY6SYYPN X-Proofpoint-ORIG-GUID: Syt3v-DmTGAUXBEEF_AcFeIe-H4mnIzm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=982 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Stat-Signature: tcd7fg66y8937hbwqk8zq93u9661eq5e X-Rspamd-Queue-Id: 39C36C0005 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718929614-833147 X-HE-Meta: U2FsdGVkX19dsd7F6ylnQertRhzO3w42FI/44A4AcYi6NV6L+mvijHw6sKss/z6Wz9da2XAwnAV89V8z8qEmBeELT/9DOy1w06ImWAhGjX96HBkCzqJ2SP2jEX/j9RD4FSQuiYtX4Yv14gbT5nhxkoCrWDxytMt0qUm4vQS/0xf6YEwGnvKtew8ztm0SQ9IhNzbONYg8OhIdSsY7MCHEKzGHbEruylRsbJL5dHK4y+A14U0VD+Zvo30lcBmYVW2QifV4l+Me7jWT/ZFyIYER+P+EWLg/3WpEEjKAOBpYLUYThmBQB6D43gFllItZ93XtwuejS8fkPBFBRBBxE+oYIUUKIxolemXaTZ/wrjUnKRjBWJk8JCTbYteUTFPENylbjM5F/llCN4t1iLOo0UmLHSD/6fxCGlDdzqRu3Wl5fz8ZggaJzVMT3U8srsTz1ivL5Xth1OGAvdBSY+kiZHpBLPNGpz0gfPDtow5ALryfe6rcR3EHMzkmJ3sr7Frtj2H/bYYqC1/UItKfNM4TKEFYcy74EmLS4XlfmoFwxSS5tybeQGdfGZeFtyeTyjwyNbbmAoDWtgIFpJ6rZKagqdgNNHI23ojtzeeRb5fqIF3TjSTMsdq1m+zt+fuXm2b/l5H6nRlzwFKnx5XITq6L7kFjgY5F7Z9E/VXT6m47PaJWGplWbxMoaLQJE9fIn6Slz/8pOTa/IZhLTNrsBK/B1v3MDh41e/FJNeIcBAHMClLrf4bFSVof6oHTlNxZQcrvXq2smHu2puJo3HBcGuyzUDg0yQ3E2r8u9UeYrilUpxS5fbdaiR/eDPScSJCZmBIdyCVm7hhjzfNmMpBWvfydZGN05xQ7UoPubqdmXQk3de1tu3RhzMN9f7liMX42IDySAkx/pn5hSUi7XZYBqo/kbXWe7crGZBvbV67WiVXnS+vVnjOh+3b4wRgbX/tiXkmrWm/8L4F7UXYw2Yfgfpedo1o ++bhppI2 udYRq0Nf+QgS7HPAD/+FYeF0AfPjzznCy0FuIJb7sYWW0OlYAht9ChDLNi1GXqF9CCUejTkMU9HSh2ikboak0pFq/95aoHqkwolKXsWYAWl0XYru2w19oMvGZAq9ektdc3Xy4DACGmd01E0Z/hFyNZ0aiDxalBao62fnNlXWZLtTEFDXek5FMJtwviJ1/qNeXO5+HNcdIfnw6vKSctINGIrYp3L7P64f5ZyMxwd1Zx53GVUNqDDNGjqkIdkXjqxf1astz5aZQEuSO8TZkK4Yf4GGO0JsDM6Hg4mcee2YTm8VSIiilgkTL2+q6DvxNdDeIawtX X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: x86's alloc_node_data() rounds up node data size to PAGE_SIZE. It's not explained why it's needed, but it's most likely for performance reasons, since the padding bytes are not used anywhere. Some other architectures do it as well, e.g., mips rounds it up to the cache line size. kmsan_init_shadow() initializes metadata for each node data and assumes the x86 rounding, which does not match other architectures. This may cause the range end to overshoot the end of available memory, in turn causing virt_to_page_or_null() in kmsan_init_alloc_meta_for_range() to return NULL, which leads to kernel panic shortly after. Since the padding bytes are not used, drop the rounding. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kmsan/init.c b/mm/kmsan/init.c index 3ac3b8921d36..9de76ac7062c 100644 --- a/mm/kmsan/init.c +++ b/mm/kmsan/init.c @@ -72,7 +72,7 @@ static void __init kmsan_record_future_shadow_range(void *start, void *end) */ void __init kmsan_init_shadow(void) { - const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE); + const size_t nd_size = sizeof(pg_data_t); phys_addr_t p_start, p_end; u64 loop; int nid; From patchwork Fri Jun 21 00:24:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 477F5C2BA18 for ; Fri, 21 Jun 2024 00:27:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1F0E6B0163; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A797D6B0166; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8581E6B016A; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5F6D46B0163 for ; Thu, 20 Jun 2024 20:26:57 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 18C341206D8 for ; Fri, 21 Jun 2024 00:26:57 +0000 (UTC) X-FDA: 82253005674.26.6621C41 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf24.hostedemail.com (Postfix) with ESMTP id CAF9118000D for ; Fri, 21 Jun 2024 00:26:54 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=foNfqk7y; spf=pass (imf24.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718929610; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MbSV/0QgndyxPpucafkqjoUk93XB7CWZmEyrMAmxEI4=; b=6nN6YxklHH7tg3tAizhIHL1j8bqdZ6Ivvye1GZLP5b8yxZHnq//bXrIAllA3r8Hvpu4BM6 eehkRErKM1/h/jVIDqj81oTX82sOsiW+FihUIc6mlUjfdwsJ8OjvHAK/dTwegEaRsd9Oc7 pL9bPiF44JnE1ZUjOF1nfBC7jFPZoa0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=foNfqk7y; spf=pass (imf24.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929610; a=rsa-sha256; cv=none; b=qbE5nlMIIbt9yFOCXOLwnBbvZb9IZzIib/zmagKhP/iW9vNYWkv2LDJuDbMhE5L7oG3+du OAnLPHeo4x8MYJkShwHPfqAEZPfTe3fhvvdyE0UKANNgHKCH2GZ/tTFfOffuBcWVIWFtQm xuEGZ6fAJVH09xN4Mkzu8Vx71qFUT3w= Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L0LFt5001852; Fri, 21 Jun 2024 00:26:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=MbSV/0QgndyxP pucafkqjoUk93XB7CWZmEyrMAmxEI4=; b=foNfqk7y1VvRgjjR6LQgz5M9c0dP3 6TKWNguBx6pHOxQ6q4DNRzUPqVk759skUQInYx8yOQ4Ye0nFTQZaFeEqTVRfp50O MFSX8NzG50bCmFGOVoUegiSpdAcWjvoHV1GGSjaYSsZndy4jn9tB+IfF/dBXvMHW L8/FLoV+NByHcJ37Vi+CNcCBIBozpV5XdjAGd4UWJSckIM/zdrLv7WuqSWsu3BWs 5A9BdsA5QD1NJyvv8p7SvmA9c6mjwR1e8hmKLYWdXfTnAFk4DgAFABqg0p9i/IU0 hfk70NVrCmwCQtUsd+cEmbnaZkxwFjFja0BP8XppJTTZA61nukIi5E36A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrdr8aq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:48 +0000 (GMT) Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45L0QlKR009504; Fri, 21 Jun 2024 00:26:47 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrdr8am-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:47 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45KLdx1d007675; Fri, 21 Jun 2024 00:26:46 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspampe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:46 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QeJQ29819576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:42 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C16962004B; Fri, 21 Jun 2024 00:26:40 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9ECF620043; Fri, 21 Jun 2024 00:26:39 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:39 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 17/39] mm: slub: Let KMSAN access metadata Date: Fri, 21 Jun 2024 02:24:51 +0200 Message-ID: <20240621002616.40684-18-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1A4HKTza_ocuX6M60P_a4YFE-_n9G1yK X-Proofpoint-ORIG-GUID: UxAe7IFBDVT7uND_PYXcw2RbRkIaNOQ- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: CAF9118000D X-Stat-Signature: iy5fuapckng8hwutm9yrbcko5uckdnzq X-HE-Tag: 1718929614-749581 X-HE-Meta: U2FsdGVkX19y60NYKLU+3Hc5+0CMVUhlEOj2Pk6mTOdCftGWjBdQ+fwHad+JdHw9qZox9Lnk7Yoj56JJcQ7crYOfLcIemmWqZBYR6DMPoSXrYSZnewsl2m96kU/bkQZnWOUHA875AMt9XApy4oPrrcqxaCeozqlt8uCDVBlv0GH+3c0B6l/CkGtrWXhQNubQJKq7nwZJP9N/fIAjd2JdDcaX9b7b4cxPPSHGmdw4ZKuzcsh9A/TBSF991UGcA8gBPgMa3UXUmx+n5J0qbKq6bLVoDQpxRA6+qigDdYXSRguS/RK1ur1qAhyf6bScDEiPySxHDJM4QymN8w0q/odNNyoiYz04VpHsDFYmgAFJDehpGmNPIqaYmasnU68H0lAiEXTIlzsRTVbPFVJrEB6hTrPMCqDLcnYcuGSk0oUuLl6UDgGz/wMNDdDpg9guLlLD2apTxMosnpdPNe7G7Zh2tMng2LIuhoPIxtfLJRb7eta36BX8uEk17kR29OoHr0Xna7Cx4hMn1J5xoSf0OpUoQ6yJpUi+oSMA3jrDaP+L5pr8gKUElZTsTDcBAEpJ8w8d2sMKWUSvMBL26r2dy/JDhI9SsTkIfcA8zzRGwaBysKGAtj9PKrZt0Pl5/QT3TnBuK7gJHsi32xxTYH2KYfR6FKd3dL5UQqlJtWS09aI8vsXjFJ5o+8kAWKoBOc2v5fWR+IlEQvdPJwRWXiZ81wWD6iTJxT8wEt5gsXwdEdhG1AGqyMLfGn57wWw7aYRRZ9G30aH4B6zDIrqXgJr3HhLyuSCXibGZkQpGqs7AMAAVaxLWSYjtezo8UkfTgjLPIpb4mvFRXkduMGrPLpgwsrIaQ2+0uPyQ9EgUPEXXjVlQtwQwSlsis0bZ0ztvYqU3xX9sVgRt8zYV/itiAc/7vprXsInrmZW40JTEegiQc3SD2TRFvcMhadEkPMzfVUnokBnyDj8dJOJQEfdtf2lvT5O KbZAQVKY 7UvCGKyI8NpEbyjYMMwSNHg2DK0uwhfZ1rD7/YDea5O1WiMJqxBatcS7aMfcd3jcD4mc/ZS6MPbz6BWaRkM+FuPWqrjPwI3xVI91+K8dpMGQCud4rqjhRh+OmGeS9fg6yYFvGJEgUPZD0J/coS4fO2flUqRgsOe1R4FJe3vT5i8oAxzB0QjKvPLnhll2i5FHVOcOltYMJXtc0Zz20grdxG85/X18K41lFHsTzz6Cq2Rks53AZig/HpkzgTVtTJ32SS+3KJ6Ydn7TcT4WQRXv2IEgBc27ZXi07OKrsZoyw461IQvafJ7XE3sO6L1cx/eANyCSdMx2xWMhpcFiiSKiIJpljjCH0DcVyPVmBb1fmCIWC2M8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000103, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Building the kernel with CONFIG_SLUB_DEBUG and CONFIG_KMSAN causes KMSAN to complain about touching redzones in kfree(). Fix by extending the existing KASAN-related metadata_access_enable() and metadata_access_disable() functions to KMSAN. Acked-by: Vlastimil Babka Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 1134091abac5..b050e528112c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -829,10 +829,12 @@ static int disable_higher_order_debug; static inline void metadata_access_enable(void) { kasan_disable_current(); + kmsan_disable_current(); } static inline void metadata_access_disable(void) { + kmsan_enable_current(); kasan_enable_current(); } From patchwork Fri Jun 21 00:24:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706657 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 5A0ADC2BA18 for ; Fri, 21 Jun 2024 01:48:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E36CB8D0117; Thu, 20 Jun 2024 21:48:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DBF3C8D0111; Thu, 20 Jun 2024 21:48:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C38F08D0117; Thu, 20 Jun 2024 21:48:19 -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 A17AC8D0111 for ; Thu, 20 Jun 2024 21:48:19 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 214D41C1545 for ; Fri, 21 Jun 2024 01:48:19 +0000 (UTC) X-FDA: 82253210718.25.7F77E00 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf16.hostedemail.com (Postfix) with ESMTP id D244718000C for ; Fri, 21 Jun 2024 01:48:16 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=tcPUg5+W; spf=pass (imf16.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=1718934492; 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=DjuPcXR1BibZz5Ch991GiPtCxAY119xb/qfTqg6kigE=; b=cVLs63LdPCMDWpVs9KbG2HG5gJCPzi29ReqqQLQZ7FgATMdmwu0II0gmDvfj3VG4kfBda+ JSlEpi0fRyru5o5bKK4UHB4JRbzt4HQSczeNxBs6z1B3PnwW+VUbqJM3zkLAv6eaNAHxXq f+o0YcmgFS21WYyKbYXRE+5ErELmVos= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=tcPUg5+W; spf=pass (imf16.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=1718934492; a=rsa-sha256; cv=none; b=oWIkdPgMKk1xbIG0xPLAN3vswANMC2bwzzmMeX/6cmSTDVjgymaWubJMs/ZauA0+tszfaF B3EdG+cTlXdpR9PEzSqFWvavFb8SfnV+yF72nxklalO4hQY5CG0GtcZSDymxSW+5496LTN mLSXuQ75cLeRfxvsUCtfXR2ICGzmuL0= 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 45L0QnuZ007904; Fri, 21 Jun 2024 00:26: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=DjuPcXR1BibZz 5Ch991GiPtCxAY119xb/qfTqg6kigE=; b=tcPUg5+W+hgpGH+krm31HOBPTrWO9 +DwN/OijUc4YdG2S9x4PQuP91KRNyj0u6dHD6OGZqYSFY7CXNhMh4b2UmKG/ExnI 4LlB6a38g3SSDC3UyX5+LPThGXjReiAt8V/Jha0DgTll3n5JRlwWreEo8vAjWsux 1qhZPBSZo0CUVOdmR/tudy14cnxn7Fqdrj2ry/X561UbJ3RmikfQ5Vuq/z8KugvA DTFsAvh5a5zOK7s0dbwIiQZQK+y7T9TZUBhDhwvIRGMOy08fX+cAFY6Rv8cQwkkE ygUbC1JuBVE84SxG5n4UikZq9py7H0fDu/EO5mgnYRNlVvOgPZMTtKUQw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c875u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:49 +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 45L0QmWJ007892; Fri, 21 Jun 2024 00:26:48 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 3yvw8c875q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:48 +0000 (GMT) Received: from 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 45L0PD2h031890; Fri, 21 Jun 2024 00:26:47 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspjmyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:47 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QgCm18481484 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:44 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 052CB20040; Fri, 21 Jun 2024 00:26:42 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D5F6420043; Fri, 21 Jun 2024 00:26:40 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 18/39] mm: slub: Disable KMSAN when checking the padding bytes Date: Fri, 21 Jun 2024 02:24:52 +0200 Message-ID: <20240621002616.40684-19-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: s7hafDy5aFTcRtvqVQpLOtSJKs9sYlpb X-Proofpoint-ORIG-GUID: 2sowwXNvMO2B8DX6tP-_7374bKZOifoo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D244718000C X-Stat-Signature: dbhmpjk5b8cpnc4xiude5tozpcusji3c X-HE-Tag: 1718934496-114444 X-HE-Meta: U2FsdGVkX18XSCeso9YiiSQ7II7bd5AYnMXIRXpFIPzAhiCJyG8WBhVzoOsB3oNgWvAHfTJhIE+KRSLaQbbIND4ahrRuVNn1edNa/wpeghq2TjFg2MusQCcnxZ7n+jaYP4neRhRrT/Xttv2niRMt88XQVhE/nXpaCAyujTd/3pUiq4+4n35L1FxFfe0S5d9Y9Xyb1ZpFeBBIQB7meOjXLwVQU7rBFxXtLxJFmH+xE3g8TZixKW8meaIWEB6KPimd7rhytpplihzRYI38hdZiBlTlS339tWplZ+hYuXWiIETcWwQE8kkrMiSMBPWdyfwZGU4u4x6R0+8qhc8gOWySxK/dUqt0060FCTZI+37Pt9edED4/BVTUR6iYgOxQKCbDpDS5FlHtZYJecE9G7ucEMfPAZK1ZM8ByANyCCVrHXckG1OlD8wcJ5rVWRE/uuHdnDEoO+8QVl7/ClzJqqzIOEkRVIEYIX8dkPkkRerCxmrBg6jyIoEYCBAY1TAL2uBQEQcCNEnQKDjCwgNX2DE0i0+zTtIrRqCMIR8GYvjJnsEWksOUeNewSoNO9Uk7gkRh5Cpsws7WClSjRZhAgi0i+nM8yn3nDg8FQfY1Uw4yejb6oEnZFnASfnFKI439lctc4WkdrjppqI5/yCDkR5UAGR97WAW2KjVAs1/7vFtOhzgP0d5a81SWUBuEUYOAZ2X10vicSo9e7P08dlTie1/zGVYjwif6oxQ6O1qY9v8tV4M/JX1PGfqz9bXyyEMembvCFURNJemPDZhlJKG/RDqU+SzQh73BJ2WNGKY3zdxivMUfXCe89lPPB8sFKVMcygpCa7s1Uchylak6YfntnLVwxVrOiNNZWBU46KYPabWabESx8Ia2CPdUtz0lVf/H9ymTFo8Hu+gMuvMswC7LpeHEddHussqO4XYQyCUWe0e0dj61ayiUzy+KN+7afOyzsID0A/K5rXdIyYrYybaWhCGP cKZ8G7CW VewebgURk35gw4+1t3BYteJKyq6gQIiFTxDGFl5FtFVjpPZCTBEfGdrgvXUEHRNLACs0H84KsipMmtQvG2wYk+ljpck4B7o0irupsPWynUb8/8kexiyI+m/8eWt8DFVKJHhqgCI1LrmO9fIWO0vbvSqCtVcpV2Cv3JDVMjt9mU3CVYTrU7Pz5c8khmpADXHbiFaBS6t2s8eU2TZpmmKDDADbdAGmfH3q+QqBJOJCAiSLWtUZff3U/Iq/68IG/9NFwS4N2RbM7ht5otpBMIQ5gtOG7JkYbRHCE3YyOV0mh/68X3vo5jGs1OXGvPyiz5O3aNMeOwvelLW/hTL/bT6Wu2GR1fCrlDAiB+esvWTLtCVcyduE= 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: Even though the KMSAN warnings generated by memchr_inv() are suppressed by metadata_access_enable(), its return value may still be poisoned. The reason is that the last iteration of memchr_inv() returns `*start != value ? start : NULL`, where *start is poisoned. Because of this, somewhat counterintuitively, the shadow value computed by visitSelectInst() is equal to `(uintptr_t)start`. One possibility to fix this, since the intention behind guarding memchr_inv() behind metadata_access_enable() is to touch poisoned metadata without triggering KMSAN, is to unpoison its return value. However, this approach is too fragile. So simply disable the KMSAN checks in the respective functions. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/slub.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index b050e528112c..fcd68fcea4ab 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1176,9 +1176,16 @@ static void restore_bytes(struct kmem_cache *s, char *message, u8 data, memset(from, data, to - from); } -static int check_bytes_and_report(struct kmem_cache *s, struct slab *slab, - u8 *object, char *what, - u8 *start, unsigned int value, unsigned int bytes) +#ifdef CONFIG_KMSAN +#define pad_check_attributes noinline __no_kmsan_checks +#else +#define pad_check_attributes +#endif + +static pad_check_attributes int +check_bytes_and_report(struct kmem_cache *s, struct slab *slab, + u8 *object, char *what, + u8 *start, unsigned int value, unsigned int bytes) { u8 *fault; u8 *end; @@ -1270,7 +1277,8 @@ static int check_pad_bytes(struct kmem_cache *s, struct slab *slab, u8 *p) } /* Check the pad bytes at the end of a slab page */ -static void slab_pad_check(struct kmem_cache *s, struct slab *slab) +static pad_check_attributes void +slab_pad_check(struct kmem_cache *s, struct slab *slab) { u8 *start; u8 *fault; From patchwork Fri Jun 21 00:24:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706575 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 97919C2BA18 for ; Fri, 21 Jun 2024 00:27:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17E308D00EC; Thu, 20 Jun 2024 20:27:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 041708D00FD; Thu, 20 Jun 2024 20:27:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5F928D00EC; Thu, 20 Jun 2024 20:27:01 -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 AA2018D00FD for ; Thu, 20 Jun 2024 20:27:01 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6853DA22F4 for ; Fri, 21 Jun 2024 00:27:01 +0000 (UTC) X-FDA: 82253005842.02.D00226B Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf10.hostedemail.com (Postfix) with ESMTP id 12843C0003 for ; Fri, 21 Jun 2024 00:26:58 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=mjcB1DbW; spf=pass (imf10.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=1718929609; 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=o5OLh1G5igJ7wfCkEas83RRSlonR9xfZGMUuvDY/DE0=; b=VObuItVc9jBWgQN3Gt8dbC7pXdFr0uF2FRQQ4qlVCZ9++zTzLOJBrAy7yyKJSx6R4o6eVS dOJcagREyOcdw4ABVxnZhzMCnmXSRdTOr2+Z1o7sjwPzltBvkrXKY56aQds7iz0t5dw+23 KmNUE3GGX8pO70zHilwurbTr65b3o7U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929609; a=rsa-sha256; cv=none; b=XIYD2j5A+1s32X7EazuBDXre4DAXqu1l0nZ73v6hhEBELmJ9H+1WEaYlXATZ2m5as7vmvZ LIgGIhIewZsTz54dgRxScO963ecH2s3t54ortQB2zXuM1VxKvVW8F8HRyavc1Pgf8r2wB/ YcULDkqZE1jGZ5z5+F4Tqp3N8cpMKAs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=mjcB1DbW; spf=pass (imf10.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 (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L0Qjxo017866; Fri, 21 Jun 2024 00:26: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=o5OLh1G5igJ7w fCkEas83RRSlonR9xfZGMUuvDY/DE0=; b=mjcB1DbWafMJ6821w+jAR8OeMJZ6v xocLKnfxJWTQtHkYo3qMsfhMm6Z440kaILsExcd146aULYF0xufV1B9jUX0NinZD Da7lXSLvTn9RThgMuOFcJ4FRwxkfk5nGHDcLVuOWIO8+0Inoe7Lj+8x4GynGx2u4 taWm5PFe/SEtrWRRjuHb9HV1rV55Qj9AHzy4Gk15/jHY92ZWpJumKWax2oFiCDMC aGgybBaa/Mri4X8bbVNbw+/UIGLjff/9rr74aWuOiel/9W5TgubRDw1N/zl09Ats pKMblfr85FZWnD4DKAighxCmxY+SU6sni5qh8dGhPtV3ZJfrONJlm4aPw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvx4g02na-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26: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 45L0QogX017926; Fri, 21 Jun 2024 00:26:50 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 3yvx4g02n6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:50 +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 45KLcxoc031347; Fri, 21 Jun 2024 00:26:48 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrrq2nbb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:48 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QhwD41943326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:45 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3AA5F2004B; Fri, 21 Jun 2024 00:26:43 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1905920043; Fri, 21 Jun 2024 00:26:42 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 19/39] mm: kfence: Disable KMSAN when checking the canary Date: Fri, 21 Jun 2024 02:24:53 +0200 Message-ID: <20240621002616.40684-20-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8qSPJ9dagl9d4HYS4smcsKnsM2CTqo8A X-Proofpoint-ORIG-GUID: 7LaTOJcW5B_v5GZ1BZoY_IdSR_2nuz-u X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 12843C0003 X-Stat-Signature: 9m75fmgif1xih1ekdr16eefga5gpshsa X-HE-Tag: 1718929618-626206 X-HE-Meta: U2FsdGVkX1+EMtkieaMBlmBJ6uRq0Vrhc7Mae86uQBJz7OUxsdXsKBxS199p9y8spo9hXDcIHLEdgmzFoWAhywk5Yn3R5Wj5zHYrLcdY6pGYhVzHocYfYKHefg1adfbJcz4m7/UKq+yldzVgMmZ5cqphASJ2xwQW3vmLa3B5t9KIhcL975aunPdR0lSUYjDAQJGMZ/TYyTnzYZXaXwCp2WDhKeKqf1c9bKuh6f3CKtK3i5P/leDQnaz+1KQ3YkAFD4EPql8Ok4upKcdoDfHmg2fnA9SBakpC9HoGfwU0w1wuVzQTh2NT0/RJqJQlKo9tfdSVuD4j/vsmMckI5TewB/e2iafZQ5loGplOIE1rHx/fqB34NOohKp2h1p6fiUXOSgjmIGccboGCSSH0zPANBqxUccDoHIQ8n2nVoulxLSMEzrIyQZgvMEn7KNP6n4E5jpDsoexnPVRzHa92BGoYeCb4OJm3v1HjIAL1zSWdEoXxO2yjAj2TWAOpQft6CrEZlCRy61AkZVrzoY7cJV6sbLC5e6yO9G9L8XraoynHg/w2ibYMy6lirb3NmOyGQWgun+v9rC3S3gbnsHL5Y/E6A6IifnD09gkVMcqEGZC50LJMHdJTJh2EMfupMzYR27/50wiGVn11GLzBF2ab9se1OCdA0lzDaYduFDkNS/+8L+jzPPitq98RiT59ZWXpTQTkJwn8zJBh/IaJkQGWhMPex2KYAZrB+g+w5C0hoArIX0ckAkbzq3Vrz4EojTAtv+jzWJ+Vbqi0+q9UX31rwO3TZvm8u1jSWiHzeP+pHnaxq9Mc3QcPXhxeKNHsH62TUVB/7bRYqRtJbKs1pChmHRkSePMTv57wVo8NG1c9Y/+ZAzBGz9cS/OAlvzExInNbE5OMCNZA00GCCbcqZzAGRfkEdsZ2MkWziUOhRSSDYttV2MSLo7mqVsf7p4CFi9qcTyrA9zNA7qRSWOhe2USyXZ9 7izOjYZP L5yf/N7cFOfUbGdl8qiHct1kSKrywv+c9nr0WrSVYuzHz1NBq/Kl9DA206ghhCai+9Y1jwKl3pFLpyBeCCq9RQRP2kvq3WeHzdzENSao6ViKM36leQceirsDnNoeKNO+UNBjLAHYjBw8Bi1mv58uoqjOk3a0vZs+GpW9HUj8nZdzmWyXLgUWhQ9c640zoARojH5Yq+QTg4GFuov0zw5ueajGNJeQGiTlBSMBw5g7jdbJ1Woh0yvYX2BBW5PNwT15RPxHam3z+4RIF8s/x0quIqXIg5A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000025, 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..83f8e78827c0 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 Fri Jun 21 00:24:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706574 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 C3EE1C2BA18 for ; Fri, 21 Jun 2024 00:27:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 833C68D00FC; Thu, 20 Jun 2024 20:27:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76EE38D00EC; Thu, 20 Jun 2024 20:27:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AE698D00FC; Thu, 20 Jun 2024 20:27:01 -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 1A6408D00EC for ; Thu, 20 Jun 2024 20:27:01 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8BB221A071F for ; Fri, 21 Jun 2024 00:27:00 +0000 (UTC) X-FDA: 82253005800.10.4873451 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf08.hostedemail.com (Postfix) with ESMTP id 36C8A160005 for ; Fri, 21 Jun 2024 00:26:58 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=nZazUTOT; spf=pass (imf08.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=1718929609; 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=2ufWUYjrkekS6AUVieBXi57z+2PJzJpUCeCRkZb6FY5MJeTgyRMJjeklXMCJ3znCSvgTE4 j8o5hPu/TeHh+9vp1auccXody6EoiqmEUYBi7BxtIkKbJs3V4buZPc4f/XUZumDvd1UovP WYFg/L3AMIP6nGvMq8IJEawIUvTnsik= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929609; a=rsa-sha256; cv=none; b=XwlTTmHecPgqvgeMnCdHR0kqV2QRvj2EYQ0kpedywkSJgv5WLIQUhGzILKNrc9d3wPIhgq yBPgakT5iLPxgCsHTFNXrS4pJ6qZMnbqyLj643cIoKejWiprTV1s2eUq66Bf9/tuSzrYjY gJ0pEOjra/FNGcl5x+uvDh1LLKAR8rg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=nZazUTOT; spf=pass (imf08.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 45KNoABD032764; Fri, 21 Jun 2024 00:26: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 :content-transfer-encoding:mime-version; s=pp1; bh=pcK1rMwKAY+PK 8Ytyz/2vRX/RRHh9XTkiYTIv46ktrM=; b=nZazUTOT4MWjA5SIo7bqlbXkVPqxd lPc5kdjhBklD9w5sBhgGhoMzPqsv/6+9xi2YkEhWPxf9YPLt250idRxUj1Bai5vP t8Zm1/QI2qd9x4OCMtva2WQkVxRmC819CV1Jn6F4q7BiqtI5p2zMRqGzyvylMoe4 NHFA8hw48lSHyLYJEjX3vGX4IEVPJ/Ezd607cF3e1s9f7NT/eHCKLqQymmfTUqN9 0G7sBPMI1Ris+bAlk/0Hjg6iGdURYUu/4z/lE/W60GLG1j6r2n80vwIuou+JL6/t 2Xwnqh2BLNT4NlpmrxUbWvVoVKPXE3rAUFSz/xr1O7Y72zz6/npwhQ2oQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c070w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:51 +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 45L0QpEX022765; Fri, 21 Jun 2024 00:26:51 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 3yvw8c070r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26: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 45L0P27B031899; Fri, 21 Jun 2024 00:26:49 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspjmyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:49 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QioE56164652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:46 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7056D20040; Fri, 21 Jun 2024 00:26:44 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4EFBC20043; Fri, 21 Jun 2024 00:26:43 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 20/39] lib/zlib: Unpoison DFLTCC output buffers Date: Fri, 21 Jun 2024 02:24:54 +0200 Message-ID: <20240621002616.40684-21-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: lBkuMSrPy1rZLOJYYHrXW-DlaDRQ8Mht X-Proofpoint-GUID: AsxR3HdOanE4AiybmDh67tCIRsC6_PQH 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-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Queue-Id: 36C8A160005 X-Stat-Signature: h1u865d61icz8teiuo4wuzpuq64cjo6n X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718929618-269022 X-HE-Meta: U2FsdGVkX1/npJaUKw6Bfh6MXV8mx5cD3UBXXPJHdODjNB0abIi+tVeR3kjBTLQhzpwSmQD43aIvi56N54kamkopZvoUomD+ohllEdKAppGNnxs6MF1xh5YJcldvpL5iFnHcskTybt7B2ZE2ctxngHjvfYzBt5RhHzNfjTfZD3d+AxqrOX8Egu9jImp/1o1kKFVxJ95FUMJLECf9DbyVTwm3lXGX2zUC5HmwCq8RJ6gh2dZKBGp2NiwI8iNSVIo166qe7ZxotI/0ia4pVp5HDkWDjyKcFV56sA2BgD7pWRTUgQ8HOiKWFfm9bzQqlMIW/Tl1kABsVyJQk0CB0Nv7zsltpNQH72SRUdbiZo2FfMnx5FDo2sIakRERUs5D9nxzsl2nJFDW8Dk9qTs2RusOgJEVjT+AT3UwUaIkbT1SPI5KWIJG3dvZMK3JHe1nVT/PUcL4k/rfbcpxyVClXSTUap761J082GpgLafwRMGgfUy9gAt/OPVmX1QwWwZb0cjdu98gD7wPQgD7JVHsYd3p4rX3hzPWKyzXWapYEJlzT7betCywvOi2w9uWCXBCyJq1H5pVI2J70uDHTWMDyQyCCOeOJT5eK41eLI2P+6Dppzxbv8xqtrNtpanen6xgxm8PDMrbcnOt6lex+Ae0ct9+FyakXAERWvYf9TkTpeoozxEFb2Isn7PhD5/arz/DcQ9FCLajPb1m+p7L10JTljOx3Thb7fX1H87WoWNbigbGBeLYv9T1ZFe9zkyLe3V7CtYWvASnU/LEA8y6oVT2L5MpCZugbN1yInkJMDxh36h+CY9IbUEAULcnTMBYo7MbKDSsXOkI/2Qyh97TrO4wRvk4WKa46EadurXcXLKpquo9WHywJq2N9I7XJW48tARyyVTtcW4gkJzjLOt/FoPCmOi2Pg7XmnSFLxrQjS6Rrbiygs+g38FjZB1xgOD06V7HPP5RrUYm9WFraItIXnlGgen 4R0jFr2d YBB5UkVdKNAlFukKbG3iciqlpFqOgcOP01XJJo2taWsKO8HqBh8ooNaDYXDCjQXF5fH5uv5IGf2CmBTeMFRrN45L9BrUL4MZuwac3e7+oj2QP0DRDZBaJkCkr89xRVA/1sQ8H8gyo+T5ZsMPseSvriJ4ddGC0Nb048GiDSNTwzuUiOy4sBueWWIwoDDK93Z6MTXf8vICr+aVnKBxsXcUYnctdFNJIPuZdbtQ4676JWk0CWxS7V4SDDsFvo4BY0VW4ahlyZeYMooFxUtQfkGUTDCca3+F5x1Wp9teVxY1fdm/fzHLA2AGhsP4b8QwNAz21WPnX0Uf7+avSu9TJDikHO9VtfU2+8/sWRHqX5GeO7pvFSMbM2oUAPnePBO99w+CiP7ST5Niff7TK3HM= 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 Fri Jun 21 00:24:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706576 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 ADC84C2BA18 for ; Fri, 21 Jun 2024 00:27:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 157FD8D00FE; Thu, 20 Jun 2024 20:27:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0921F8D00FD; Thu, 20 Jun 2024 20:27:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D16DC8D00FE; Thu, 20 Jun 2024 20:27:02 -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 A877A8D00FD for ; Thu, 20 Jun 2024 20:27:02 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4BFB11606F6 for ; Fri, 21 Jun 2024 00:27:02 +0000 (UTC) X-FDA: 82253005884.20.34E15CD Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf26.hostedemail.com (Postfix) with ESMTP id 0ADC9140011 for ; Fri, 21 Jun 2024 00:26:59 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=QLTiuUgz; spf=pass (imf26.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=1718929615; a=rsa-sha256; cv=none; b=CqrACiEAkG7SpnITNesy8iUPl8oHp5mHldC6311LV99skZ3zzD5L+kXeG7lJSIclgGYVYD DXO4hADFzvFY7GV/boe/+xCZ2T94fYlL1XsTECZlEhTzLjBvFd8/G7k61kGUoB0gxXXEEk wIBh7uCTghlwr9YBPCHM2trZYB2AEvU= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=QLTiuUgz; spf=pass (imf26.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=1718929615; 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=8cy75rs8jmhkpo7xQC8V0ut/aJ13UlzXCswV/hx+7HmuOPMSe2qgI2NlmvmUkuVbkFuLRr gtdGpd1WoDyZ6oNu3YbWr28mhg3eJjF5P90Xob39otvEYypNzh0cdAb/HYKwYS/+KjQb4E hMg0T6akeX1Z0vVqrmet5EUJSIi2srg= 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 45KNQYUQ017245; Fri, 21 Jun 2024 00:26: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=eOJVqKOJuZasA 86pPY8j/wtn7XC9Zj2RO1nXjWn3Mgo=; b=QLTiuUgzXynmL4R8k3l8VgV5LpnKj 37WqWbZdaTcyLbk0LawbuAtMlwCgR1WespmbPcd+J7LIoO1ArRt6qaT/l5V4BdQp TnkYsbO1PAhOULLGbls2dkd3+N3mF3fwbj+6gwWtRtN5P8M3P8f0Gt2j60gHoBjF AxvQU/hXbvY03B4enkqXzuoC5hiBjYDQUu8WSbql3MRt4SEu+bM8MoQO34QIDQTw BiP9qpgKuAsWgzemjsc2DGG237JgursXHPizRyqAVA7wuq8fNTP6shwu1sfBpKfQ p0yStIsUkZIBV+8sd/cxW9jN5HvhJBEUG/SqfMNFn9YP2ain1U+Nco0CA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrdr8ax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26: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 45L0Qqh9009543; Fri, 21 Jun 2024 00:26:52 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 3yvvrdr8au-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:52 +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 45L0Htw4007678; Fri, 21 Jun 2024 00:26:51 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspamq0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:51 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0Qj8Z56492412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:47 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A787F2004D; Fri, 21 Jun 2024 00:26:45 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 848A620043; Fri, 21 Jun 2024 00:26:44 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 21/39] kmsan: Accept ranges starting with 0 on s390 Date: Fri, 21 Jun 2024 02:24:55 +0200 Message-ID: <20240621002616.40684-22-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1AqOcpwzwafdX484ppd5O8j1ZYWTiJo2 X-Proofpoint-ORIG-GUID: FgwbXccNBqEcPSn3Bplx5nbUcnlWVihd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Stat-Signature: xfx51cn3psh9z6t61t93mpe7mjk856ge X-Rspamd-Queue-Id: 0ADC9140011 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1718929619-904801 X-HE-Meta: U2FsdGVkX1+JPq9nSQORfsr9miX5zawzHF9yRHtlJP9l1KKYsNeQ5PfcGbv3RP7dKnDtDRPSpcSgMEytFkkRqOqXt1p91fcHHEMp4skaIowbR9vOlfQ8FbWSdZCRH8PvasYU3eKx839JhFOSeyMylf2GaHDDSTQ5Ff4npkoGZJZ/CMd5KKp1gtpdTM8WID6DRzRafqqRfFEKnHWdo7xY+VGDopkHbpohyqvIWo4p1M0IQuh42NbfqAH92nSFUdo9qpTY0PGBIJmfGt9K7YD/zr1bbIU9JTy6l1MTEL8/ONRhhZLF5wX5QJyozLiAtpYAA2Z2dXesIBXdUJ9ZCn3ZhAW3Y/bIN7JtGEO37CF5hTl9FDJU1npeONLer2ph8wyC9GUd83AF8QCiR7qaD4/7JahfWyVvK71VM7mrVyABsWaDGeIz0xGvHY/vwNi62WWDuXkMxDHyLpB+HDZJTNoGo7RvRkE9V18q6E3lKgEvM31JC86O3xj+hZDCMhzjWWOT8xx693WbIy5jGIO4hTxk7HZv325tYAKGt80aZcBE5BcLj2OU+i/B3fN7Pl4ZSxtCnnUlkQ4WgVOXEeWsqzrm8XcTyWxaVR82tG/2Gf3dyVJUpOSHouqrBmUKq9vgJb/Spt+Fasqg0PpKPbEsQmOqlEHVKEzwKuyt9XrwOqY0b8MpRT9TxU2C6nrEIjlHcnkULf4+NzxcogOsrIdDt9y3f1teryHFLBjy+DHqevKPn/lITY9MeKpmuSGeM4dJAKcDWZhiyn8BZ1+t1dWLEChDkY1lBZCznJG+dyL9FtmrCE8QSgR9wtE9ZE0yYvEiCamfYnuvQJYe8xSZ7MeNEcY87YDbjbskT2mnA0FxmdZNGMwvXD6zh/LzH6wQQU0GMXr/pS/AJITIeS3b7ADgRduKuDuKWRcQt0J9FTuOLZxq5wx9/+vMfwAlI1sbtVQtSMBfgOahYPCvwJQdsvgTZV/ PegY2u9+ VyALjeqqOG9yJT/t3/8KXgei1cBhoy+d6VV0Ey5NVn0YlxNOJmN65ZACNEdLIldHaOiXQkzUL/ngmmOwKkZMNbNuivZA9SPQJHUfH47haF9lQgJLmec6HZqbQmkhm3sMnmkNTUG6r5q7cXnvBvAgTxq76uvbPYkWMxeeDk92pbsZSKcnQwnfZdIZgJ66a+BUya6Tx6Qf2dDhMjGRe/mnFtSIEM9T/ueJY8OZ/8YPAKBZv9Ou7/9HS2feVw0kvLXCeb6eppWVlEFDOX8Qukifgob8659a4LXWafHXWRUv2c/ev/6p6m5hvVSGm466BGifWPshSoKPiIiNb5lg= 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: 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 Fri Jun 21 00:24:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706577 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 3F550C2BA18 for ; Fri, 21 Jun 2024 00:27:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8F9638D00FD; Thu, 20 Jun 2024 20:27:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82FB38D00FF; Thu, 20 Jun 2024 20:27:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6101B8D00FD; Thu, 20 Jun 2024 20:27: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 200628D00FF for ; Thu, 20 Jun 2024 20:27:03 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CD4B6A20E2 for ; Fri, 21 Jun 2024 00:27:02 +0000 (UTC) X-FDA: 82253005884.02.A3E8EF7 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf16.hostedemail.com (Postfix) with ESMTP id 9581A180007 for ; Fri, 21 Jun 2024 00:27:00 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=KYKLp6Lc; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf16.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=1718929612; a=rsa-sha256; cv=none; b=DOewsgohsPDGF8soSTuidc026g/kBxrAbJ6yRaKtocG7kny42Ba+WdKqoClXNgKOj0SKnp W51wlWkAze1gAhqyAze59T9+CzadrbdKkbd4hBQ7PqhmmWNL72sPlKI3JHAZ/fl43xpXQ3 e227oJYMm/6/0iwaVK38Yd8cRmm97+U= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=KYKLp6Lc; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf16.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=1718929612; 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=GNWO2ScI6A8vC/GqOSLc+7OWCjtfWJmXJCjJsJMipWr20KBJ2qd6ZEpehZL9lwfRVxwZIL GSRznSr1THS6ZuZemhpC53MCGTeDYB8hkJ3p0GnUIL+SY0pdci36VHllYKHvxc2eqMO3UL kkbExhLsO+LB/6KYEf7QLpyPhhMgck8= 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 45KNunGB003964; Fri, 21 Jun 2024 00:26: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=OrFUkNCKCdyNk ojULrcA9z04Ys3K5qGxpLIcxQ1wcAk=; b=KYKLp6LcUz3nqZ+RW7ovC2z1c/N5b QtagkMsmAEhbv4tgv8QzYU5enY2uNvP0ZTzFqd+e+Pd6bUOdcZNXFcOEJ5fdGNGe Cx6q1Vm/EdWPSWAcBJUusbUipW9kiTyDOiEinqIbjaM7t5mMxyMqnRLlGL8ww2mC l4gsyO+98X3xAE31y+rmCP7fLnlHwIl9wRo6DlzFVCHPpillFZ6fJgUoSz7JDd1A kp4LpkEVpYwi6ocKgNJsgt/kP8kRYaC6Mps4w4bp2FR/PXgWf+2yg8O6qI9fKTTX rFIeB1sGYUVk90P5E2Y5JBBLxaDiAJiL9AGbu6FVVwUWfcjwTXgWlVs1A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrr07tn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26: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 45L0Qrn4016999; Fri, 21 Jun 2024 00:26:53 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 3yvvrr07tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:53 +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 45L0LpV7025805; Fri, 21 Jun 2024 00:26:52 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrqv2nnc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:52 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QkkW54329664 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:49 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E0EEA20040; Fri, 21 Jun 2024 00:26:46 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC62020043; Fri, 21 Jun 2024 00:26:45 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 22/39] s390/boot: Turn off KMSAN Date: Fri, 21 Jun 2024 02:24:56 +0200 Message-ID: <20240621002616.40684-23-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KqfiPqK70_1rV1P1C1Gy61-oQxzvQyn8 X-Proofpoint-ORIG-GUID: ZAgRwklkhYOmeFVehQ1O8m4QPib-ljUF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 impostorscore=0 adultscore=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=742 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 9581A180007 X-Stat-Signature: s16nwxzuki6ubw1c35mn6bt6agyg4yxi X-Rspam-User: X-HE-Tag: 1718929620-189078 X-HE-Meta: U2FsdGVkX1/dFX2f7Lt+q9jfz/a+aRN9aIDhPXpUupcv2fnslp+Ld4cYX0GBM61DI2yhuoAG783xaThfkVpHegUPqNMsri6+Do5F/gb/7T6uuX/66Na9ZvbuHe3g+dxQMpmsa+E2cjxQhgKjMhnEaj/dqf/DTVxYN5xsV+OHbyEr3w8AbwGyIyoFnZfR4gX49mX1IsMJ43kbaiY6584Y+eYzWQn863FuyMpAE6Nn4EGj0IYE9x4xLx8v6ZuSiWLQ6xwQJVK+WQsEDfcCXpBrFw9PsOR4UP8CeWR/khrm06HzzVCwTPcNJbQPPmgA7XAQeBsMYnHayqVr681Bq/jtiQUhZH8NsnT3a3pAjfO/GmUVHvxrbSUUDU3e5O+sBDIqWY4dWCYyB7AbwY2q/qwgS0idnOHBPRrTBo1IYKK1eIvqCmrSGxzreWOEMOy6CDTq7e1LL109b+asRUE537IbfdocKI7dCiaF2ut9tYng8XAuhCR7edAbk+8NRPAzYELmEPEV2Y8SSmNNVscwk81IkJOdnbeA6QxX/ft/dU+tljMwjzP6Cx6c7p5lVha9hj3RWUzABqV7gXgUuDSgyiGcCEJ6lA6sl8mAYYBZ34ZWKlPTM0NOEWiC/zFAj82ezTRw4q9T+lOsw97MU0JCEpTiZHwzRvwd3B2MxYXceqSIjE881fScbar7qqwq0WkUXavrNiPlSERBUZoMzPFDuiQRoQ4FqqGLbD3c0lA5s0sfiZhurdtwGIomboM5KTe0bWCpDH2wveXfSz3ipG/gLsv7kyx31u9P7H4oVt9CT+eUlf+9nbJaXS00DBPC+SYQuU+Qm9HUhzb01yVFfC6/R07aIGyrwOy7KZYUiSLGotQ39V1Jvmk+Xu7bCZPRS/EeNh9QXFgBL5FX1R/29ZRUESX4+lMXesPXHNPS5FnJMnMGu/1kjDENviedIVtLY+bstZl4kLlV5jwC/MxOSguI/h8 hpcV1o6g aAs67ln9TIWdx8jn41a42764cOeicB4vo2ZjGEtkEBiW/fVYZhBgYpqlAsAQDauVQZBk+zZxZnMWjHEP+qnaczjYHg3M/6u5xQCr2FCafqyDebqaaqwSaIceAfMhtCyxJsxguJ92r0EAwaTxBin/HnV5BgpKp+ByY8j/lKaWFwhuNo4Um/Tx88pKP/LhP1jkmQwXFyBCWOLjUh78VHX9FILe0zLyHM5yQL2g3SR8/I04e4MHcd7xXfI+wQrsYk4FKCr02vX4XWziNtCaPQQbLf6CEmrnzyYINfwZvbSBmE6N0fB5lYXHTKJjqjsmaOTqCeNWI1i4moCRPZVsMQJsNMIRhUZPV3zYmJsa4h0bTocxs7ZLs1tq4rbMTXQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.003660, 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 Fri Jun 21 00:24:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706580 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 4E656C2BA18 for ; Fri, 21 Jun 2024 00:27:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8F8A8D0101; Thu, 20 Jun 2024 20:27:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B127E8D0103; Thu, 20 Jun 2024 20:27:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5287F8D00FF; Thu, 20 Jun 2024 20:27:05 -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 EE38A8D0101 for ; Thu, 20 Jun 2024 20:27:04 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B3BCA140678 for ; Fri, 21 Jun 2024 00:27:04 +0000 (UTC) X-FDA: 82253005968.19.60FE929 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf28.hostedemail.com (Postfix) with ESMTP id 7FEF1C0005 for ; Fri, 21 Jun 2024 00:27:02 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=JUnPueuq; 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; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929617; a=rsa-sha256; cv=none; b=6SaVGoUsDDLUYU6e4S0s0PyROAIZGCxU87KQ7yJvPKEl9EwZLc5RsKReCjCqh8pIM+Y/OD giMSj7hfBj60wrOWnc/aw1WJRwwDxW87jD6tw6Onj1viufYMParF3ZNImPaQqIyWZXTXtj CTUrRNukURBBmyfiEuOzpggqWgaxbWQ= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=JUnPueuq; 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; 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=1718929617; 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=tbvdv7MG2JOoR609MJbSvxa9tV5IaaPPGK5Fpt2fe8o0uI0dQUO8/3o8TnpNe+bvCBuS+q l9z74Wok3JjwzgInB7C5aQFIAd8nNKRLpuP/QRLQqzDkIPl+SAOrkDxKpOXbmJ+cinJ9+Q gYt1lCzOnIysTmghobLqUtSIWco4s0o= 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 45L0Qjxp017866; Fri, 21 Jun 2024 00:26: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=EM2Q29X1oynbi WdgAiIUaE04pJnjihVfcXc099lsq1w=; b=JUnPueuqBgOu/JsbNPliikwunmim0 JVNEZX68nH0vluumtIPHgffyHdRoJL9E0Osri070l13Hq3Qi006YbJoVovwEkxyg dFm3Rnle6Vj5AwAGgWcol/rBfXclFcVmtwCjFMSXvbp0z6qVg2Zy9cHYWkfxPLMQ WoEKWNdd3E4VMbSqAAwRj2fbEKsMq46nFlbQJ8prfgHYk6TBPRbXQ1pHQkKgdgkk jfP/Iy/VnWbidnkOvHCCcc6v0S0SdGhCK4LgxJh+MlhsrY/BMsYeP2JG9Iv7yM5r xS8iYseXSNnkMQxeiFucR10NuvN33gXs0RjW4BtEkkFFS+3FXZfQlBxag== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvx4g02nj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:55 +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 45L0Qso5017969; Fri, 21 Jun 2024 00:26:54 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 3yvx4g02ne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:54 +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 45KLiBxI007687; Fri, 21 Jun 2024 00:26:53 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspamqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:53 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QmSs51315132 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:50 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2432E2004D; Fri, 21 Jun 2024 00:26:48 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00E0220043; Fri, 21 Jun 2024 00:26:47 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 23/39] s390: Use a larger stack for KMSAN Date: Fri, 21 Jun 2024 02:24:57 +0200 Message-ID: <20240621002616.40684-24-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: eIz9QFB34yT_9zDMbTspjjURecmQhbXd X-Proofpoint-ORIG-GUID: T8FTzAuf5ejUZbTmqx1tz4sH7VNs5dv4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=869 phishscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Stat-Signature: htwqdeckbuc3jh77a5ntdypnag3n5ace X-Rspamd-Queue-Id: 7FEF1C0005 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1718929622-455083 X-HE-Meta: U2FsdGVkX1+1sEL3JkWg1Zv1fE1ISKrWeKVnklt4yfadxPHOQm/by4T+1CGdD7V/hgM0/Jq/a0TxsdaPgEHUdVhGrcBpHBo/cFEALdsHWternomongD/EjMcn2SmdG7wyKCLTsj+GAuZoR7riDscYLCTt2ZuZWfhFx010rZTt53h3/rcQ/b3pJQLEyUZnaKzbJFVUcUu+5OJvoeULxcTFGc7jJ/xQ7JLFvu2tp4dgcRU1XkZgs24RYcFqQy5K2MiTyAZTn6ZxvaKmnisBziAtW+f31FfF1o9tpX4YveIAhY4SaVv/dgXEe91Bq4wTJ2qsD0J+PfuFSo9AHbJjEQc5g/ZMDPBHIEdernmOF1T3JS90yYsAth2dmF6CNWkCRp6rVthQx3JoRaxxIY59PB7rRmNytwknNjy6783aDYiRAoQqN0KkcOl3R2mnVNHdSu8XBjI3XnKgM+ZC43NMCquEA01P/cgnpwEVZ3/hBvwY80rRjQNj1xs5mAqY/1wOvQg+4Kf8VJ3c1zDmN9WAhQBGvLUMuhOi/kOMrX/7BYf4djYxawJovDGuALSbO6mqt5FzO6pKu0XjfTmI/zO+LcpLZTCjWtf4pFwCbbw9TCyGW6Nd8vdxPWVCrW0KuvPTKsHWwPhbqeQS+eeVE7fuIwfWwCrTSZddHrgcCKJ1S09aEYenrMejy2WFQlHXpudcUlXC+p8Forh3toy8pzIm443+UpdGITQ3VFyWPPOxMtyTvTejZqzdmeyKBw0Z87g2mH4+ONOnmBqnrteNJE4ceble2aLllwlelC8SxDgP4Ft8Ja+DaOqtEoBd/FtAQIJRX4i+hPrdnzytUe8yMr1RG2IfOMa4xosBBkTfwCHyo9Q+I1xdTIeTfeHspV2XF3n7Lv4ov+bhJgiGsywn4MYLgFYghut5ruYFdTSLNJSY6PiMdLpKc0nK7XwwLR/is8hPtIF27s+/qVXN2z+tlHix3D L2JlwQsf wAIX598AmSz8IBXt8gaUDp34uO9CQAwBNpCwVI4WktTlxd8v4Z5x7S3ewHft5IX0m0azTfv1r5ZlE3iQpsNbtX4bTl0Mxd5ME0QktJmecdvj6zENWkaWoemlFyjQPqm8cz0rJSFVBUj1CFNyTZlhjnQbDAej+2v8ogK/wsLr1zEHYgQ7BotTpq5/ZHW9hJiPXSMRCgnyzSCYGK6DM/nMoL1p9rG8t8ytGJ3GicIgWDuB0jNZIz1OTWwOaayDrTZFgMMYOb8by3pF+MTBRWHYkgEnap6AowKkW43enV0Hsp4HnB52Hhvha04GJ+Ool0J91UB2h8VqloguXjegiePhpD/44lZ8x/bzX6EpkdmWMTFTtViyKS+RKLEqYEQ== 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 Fri Jun 21 00:24:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706579 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 3DCA7C2BA18 for ; Fri, 21 Jun 2024 00:27:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EED958D0102; Thu, 20 Jun 2024 20:27:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4BA78D00FF; Thu, 20 Jun 2024 20:27:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8BB48D0101; Thu, 20 Jun 2024 20:27:04 -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 91C808D00FF for ; Thu, 20 Jun 2024 20:27:04 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 58A341C130E for ; Fri, 21 Jun 2024 00:27:04 +0000 (UTC) X-FDA: 82253005968.15.5C3B0D2 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf26.hostedemail.com (Postfix) with ESMTP id 234E5140006 for ; Fri, 21 Jun 2024 00:27:01 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=HsKrXHfy; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf26.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=1718929611; 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=gKMpqyYVBDSZBskm92uf+QZfcxYfiqqBCpn4Rw63BWERBgPTt4nLnB9ABaFo0RJITxzGfz R1Ggc2I6eq6Tw8WKTvfl69ef/XMfJU+5vdOZavUp0zBrPWFC4bHoNdrcz/pxdbUSUwOJ8y XlGrEZMwH+WAFnjgIVLoV67f7iTfvc0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929611; a=rsa-sha256; cv=none; b=dpzZxP3oG4J/mTQKQ8tuTnB4xylw2lSgwbd+1lYRl4ZL6FPPCflU34OX2ZH9cqsGzmzAKQ CkOe3SFP3AjvtFEemR8kxNxBhUTPPQGq3TjS8OPqyntIV2EfThBLJROuOhIvQ44J3LUWJc jHHQYaCmOKLSawBL1yI04/kJYkXzOkE= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=HsKrXHfy; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf26.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 (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KNugHH003832; Fri, 21 Jun 2024 00:26: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=erZvlatfvJVe/ hx7BkMgZ/7G1oP598/R1HnuL1JF6tI=; b=HsKrXHfyZxSWrtuzJP7wLSRWK+8xX LiqnptjwY5fqq9Lmc431QzcNHWRMtVnrAYIKILELk4SzMWXqvXAXooVj6dLuSQC6 P74diip+lzqrViFGaFkG4JVMVsjUC4zfxks9CPeLpliSulX24vtrq4aPfODCU7dM NlHOgNDVuWmN43ZM7SO46HVNnLXu4wttutr4vvWAOm5N58L4cEWV08j/5xv6p8QV S0zfwT+zfDEk1YhrXxKE4r28hdBd3032ULCSiNpUk3FuBz2RMoTVk0Reb9DEeyyZ TeSQjkNH7FuUH96q2q947fMTZornH5LdzCWKSes7/2yUpVZTmWYHfQeeQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrr07tv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:56 +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 45L0QtVJ017251; Fri, 21 Jun 2024 00:26: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 3yvvrr07tq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26: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 45L0Qo1h007675; Fri, 21 Jun 2024 00:26:54 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspamqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:54 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QnIF26542838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:51 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F0C52004E; Fri, 21 Jun 2024 00:26:49 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 38C3920043; Fri, 21 Jun 2024 00:26:48 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 24/39] s390/boot: Add the KMSAN runtime stub Date: Fri, 21 Jun 2024 02:24:58 +0200 Message-ID: <20240621002616.40684-25-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 9dcK0ufp-zk6wCTiX_6yHz6QVSDZTOKz X-Proofpoint-ORIG-GUID: TZ4RD5EfkJbUFEJTfU6D8Katl0egKWBY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 impostorscore=0 adultscore=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 234E5140006 X-Stat-Signature: us8owgshfebai57o73gyi19puepy4i6n X-Rspam-User: X-HE-Tag: 1718929621-376586 X-HE-Meta: U2FsdGVkX1/GOPB5g/XVaF58JsL1Xt7fg6bHlEAp6cYhqIyJ0dVZvPSXdqKcT5UZ4yGBWTcsr0keDCjL1nc1GFdV5wiaFrGIfDPU2olaf7FrOFBnOJAokJ34Hy/XN46LTfjcCDtXkyZT/mhKimhhlqQl7i8s+N1lYiQViOn5CymCTkfMAHefuBDFbEfvkBJNEnYyTLvEPSGCCJ6C9E5ZTrUuiznUkOqi3fHVPTBHQOg/QDid9tZFYPphPHyJu5wK2Ak1rJhDLVqekior6RJq0YwLN6by04bUUZUr3Sl+/hhbjWlIjgAg01TnuFu1pOJRTEeF1YMExsB/5N9dADR/Y/mhAF79kZmuukZDdvEtdNSjonq5px21oUShqfbXIrT5eLMb6S51WkBqNBiHGzGmx4CXnKrRLYxPwwSYP8hpKIyZVp7ElyT4tzToyXPMRgaJbc8nGzUextFpYeg8SbGS4/ufKd9Z8d64TqMdOfv3CZMeuiL7PDCdXCiKwX7JPhTADMmWlJLyx4q3OVzmjVPKosjiqzhlf6jmeoJl1L8THdcds1Sld+udrJcoSMuTZdy7nVtL1olPYBKMRugwS9jSBbBt3u22Dv93Do8I8rw2bnJ718ov7vcHPsY3utE5R73R7t11/eU5dlXgnAgylF3WuNIVr+xrQJX8nx5hYO5f0UwF099qnOnm4bxhP0RMJ5rUcCBIwldbWjJXteEUOxNe5o9A5Xs6SzipM9bnZ6a/XcfpzEzfOkL1izSU9IUr5E7aCaQ77mLcbzy+Vd1EsrP3dGh58MfePwd3ASYRm7eG1LtRpPEpayPOR4msT0VH6aqqyckJtebFeNEHpMbkv3UN8EDZQff/5zyvCqQGCNtx58GMM1CUvxDAwOykrFh3LfeqE+3YTC8ZXKI4t0DrRgdxDSxC22Eqy9AXqpWRTYzNInR6J6rL1KOsn5zGzHjpdWAZP3tMyYE5ZUpjahdLTf5 HCs9IZOI H+PL9nLVVCMLkp17/cqY5/AHCsT418mP8l59zoB2eZi8C+5OeEKAU/S9AollZWI8mIyEO+FOTKmLrGpSoMLG2GSvNs1C3YlE/69Hi3TcJFCGo83CAI7WcyQKcIhJFRXYvBwcImytei7sOx+p0skfFlQPdkEn4qXt65/TOaoN1m0uguxPEZCJjIvr3SAweCaRzL5Bpfw3S26ZbyfQg0vivtY5ZCQWjo47/wiiou5yFjfaVXhC8KQetH099rB6t6R0Bwu1vKYjK3sECV3qXdp1TEqvm26ZMbVanSUcif8bybIEuDpdyzzj2ZRzsBKf1odBCjjnKWZJckpXOi06HZf5RbgSdBqt19r1iKN8LUy+scIcCJ4U= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000011, 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 Fri Jun 21 00:24:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706583 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 7FAB1C2BA18 for ; Fri, 21 Jun 2024 00:27:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C62928D00FF; Thu, 20 Jun 2024 20:27:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBFE78D0106; Thu, 20 Jun 2024 20:27:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 862ED8D00FF; Thu, 20 Jun 2024 20:27:07 -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 5307D8D0104 for ; Thu, 20 Jun 2024 20:27:07 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 10F591A071F for ; Fri, 21 Jun 2024 00:27:07 +0000 (UTC) X-FDA: 82253006094.01.285136F Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf24.hostedemail.com (Postfix) with ESMTP id C47C1180006 for ; Fri, 21 Jun 2024 00:27:04 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Hbp62VBZ; 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=1718929615; 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=7BX1dEhMR/vbmoVhKCV5YQZWIuNMu4qEE+bLqSIXN50f7hNYp983LG6JH2Qbl3ULdnF6fG xt2PPf4dLnIsewh+vWpMGQPtSBrrhLHgkYxg2sQ6Br2noBUB0yZj5ubBNvRVMRLON7HKNv z+MwleKW/h0Dmkk20XUCvJ/PoAWr4Ak= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929615; a=rsa-sha256; cv=none; b=WUh2A1s+K6Le95qtUu6r4RNbArhaLC7kSjy/BRf80PPVJ9vh5dto6++1XkcccXOUmrQvjm QtqUhXlCaS61DeQhrSKpwtrseSQjurUsNvq59QT4oHd5vhlg7UZKrWZv4zMbA7EI5052Wj vUmxZz2Md3zKhsQWAb5xmSv3iD1rbWs= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Hbp62VBZ; 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 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 45L0QwX8007942; Fri, 21 Jun 2024 00:26: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=WE3ASvt90HWWK hjLUTLn3R+jUtOfzIMMtdYDGL1//DQ=; b=Hbp62VBZxiHUsdyo5dGI8J5KkdspW go7nDRVYNGfriLghTa32q3zp/hOpgc75p8SnUXHqUNDffVYd0cpU+8hPR5H/2pJD iMjPHcO1MrMWU3U5Io5NXRHp6T/6IZ7qiM8jackCHTCLIXTKlluzWunk2a5RYzTe XLMcfFepGkay1K72QmVtXtRG0s3ST8TQ/xu9cEYI+IiLCOCDQPEYqq91K5k+GEFg gzB7lIzj/L9auh9gC81C+t0mqHiDNbdgRO9gwgS6vWOl09a7wS+y+8jJwVFC9tya Qm+TmmrTosi7v7H9HaHKhnGwK5JPp3Q+lX0c0cPZzPoBOt5JPoSN9JVEQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c8765-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:57 +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 45L0QvfW007926; Fri, 21 Jun 2024 00:26:57 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 3yvw8c8762-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:57 +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 45L0LbSD025654; Fri, 21 Jun 2024 00:26:56 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrqv2nnu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:56 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0Qo4749283438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:52 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9676C20040; Fri, 21 Jun 2024 00:26:50 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7319E20043; Fri, 21 Jun 2024 00:26:49 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:49 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 25/39] s390/checksum: Add a KMSAN check Date: Fri, 21 Jun 2024 02:24:59 +0200 Message-ID: <20240621002616.40684-26-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: v1IZPgxWzopaZuk_kqDc7YIXvTz_GWeO X-Proofpoint-ORIG-GUID: MSeXoogrFNNvcaxdXykKNNCFHA-AI_pC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=927 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C47C1180006 X-Stat-Signature: xt9rh417cazcxdjsi9icii1utswsj8zr X-HE-Tag: 1718929624-875466 X-HE-Meta: U2FsdGVkX1/WvT0R2YX47jab/u8Eutm6P3YltJv3V66rJ8XXf1/UsaCjPYO8nztwh7HhVIpHVNoKGrO5FqWhZU2pmRUX5LJMqyxH76GUeNCV0o92ofleZWYcBYyjvclxNmJJ95/0QGASo4sR85s/kuQ5R+tjdX54MZdjjzj0QKuL+5ZAWPH9hUvubvKfiHepHgoOuAQxUEl74RQCtwxJFBUh14ErsC3FdVy3NWit2nDUxm0lqNevYf+Y/KAWKGBfxBP0/fZRYSnzfifGLBb4fzpkbSsiVXmAlFFQopVQv7KDwDWuUUCjzBuLGTXVqQddOCJXdiuFvZnMEVYJPPp0aiNiQtIj1F7+fuZ+o1iH30GWouzfXU02a/VRxLKGgGd4AmwyfC268mY4f7iF5LC4l+TKfq2jPj/IVZ047FVUb7yPLSXAPVH4f9TNXvQR4Ylrp6APcjfx5xJgd1qzH9cB1jmDmFXcw8wO8ExYnul+0y7WjFt4LHmv7qVFKEJVusisd8FaLatfF8vCcDzVBr/V0o3rEWrgPnh5s8aqwrfzvTzh0LiUlJF8uJuJc611Ke1niE3DrPDwEvUqe8n5I+AdUDPwEgHv6Xdbl3CYAjxXoEo6HYRCMmywlLqXANPz1zKhbc89HZ+6OqrriufClubc4VEkBmC0hRV7L4KArFSxaxEUIOjtNnCWOylWOJvcsfximlgFzxpmoDTffwybWkLk/k9/ABjYu7O+JoWqgQfOjZDpP9VvuVCqZZK7kehPmpY8lAplSG7o/dGr6aUZcBVIQ4X5BMfpkSzFuxZl3OfHjiYwbcoqXJDnTlUNrzUUQPQKCwV3MfaWY+9WpEepvEiH+7CwczFjCIOnRbjRlYiwiNnTXFRaLDarABOLCvjjEtZNnkS3TuFhdyoPeDhjdtOZJ44Vk5qXcyPexrRc5ac54m4gYY9KmqVM2ho9UVv06WkUYJfn9QcZPj/STSWYnpl VL2kY/2S uB6vxv0z5VLhn+RHmam6g1ajsFLHYDukCCCJeunJ+APi40VJ/ZmlVJTKQH5Iicdq8vlIHGlTsK1agndnJghdc4kW5s6TH3xqVFA4LpyihDW/N4Bt8feqZRPLheNwHEO2UhyrecVyinWXoSIKRTYoVFj7C6pjYsRK2gjPtOlpKVGsamj1RI9HqejyiiV7McTb45lToXHXjkqEjhbOO26beWc991+8jOxScI4Q7Koq9Bp4yhHMne9Dy49VQzooA35uRCuB9B9M/wpUQnGnw506BiRd93qbxXlmkuRnFP2NbYs9x71AiZ0q2fPzbGSWRSyLdJ6EG5HSQ1Wo6xowsdZ46gYCI+rT/Uo0JfBqJgQeO9UQ5KtQVrqHXSiLA1g== 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 Fri Jun 21 00:25:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706582 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 E9638C2BA18 for ; Fri, 21 Jun 2024 00:27:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 992C38D0105; Thu, 20 Jun 2024 20:27:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CE3F8D0104; Thu, 20 Jun 2024 20:27:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C2138D0105; Thu, 20 Jun 2024 20:27:07 -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 34B618D00FF for ; Thu, 20 Jun 2024 20:27:07 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DDFB9160702 for ; Fri, 21 Jun 2024 00:27:06 +0000 (UTC) X-FDA: 82253006052.09.3D65C01 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf15.hostedemail.com (Postfix) with ESMTP id B2DADA0004 for ; Fri, 21 Jun 2024 00:27:04 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="cy2g/IQJ"; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf15.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=1718929616; a=rsa-sha256; cv=none; b=iAFK8sI8o4fTl62HixeNOvnNTGRsWJn2LgSiyQWH51jqlpP7HHUukAkmTWzIgGV3QjlUvE 3Wvfq6mw8mSN6u7RAuYiEufUIch6tV19snKMVa98Cu7zJLtMFTa7S28bjQBR0Cd/i9hWXQ PIGgsitAWEcldSro+yLHFiY+G+rsD/w= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="cy2g/IQJ"; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf15.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=1718929616; 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=K/viBy/PeNICITSZpD3tBAO/npQA3ucnq3Zo5JONrlk=; b=45IpU2Jit5c3uKirDM03NvybFusl3cyCYXD0VP+M2DtVDwL5lWh0UR02/ddG4PsZA7Kceu MghUloefoAnaUb+Mm6h9pFik+yUrNGJjpQSOSKjohUhCl3O7TPgWVqgpoCTT9EnoUKdjj0 b5d0mWWmmy+YnkfQbPNjUD1fXVkYlXU= 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 45L0QxwU023263; Fri, 21 Jun 2024 00:26: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=K/viBy/PeNICI TSZpD3tBAO/npQA3ucnq3Zo5JONrlk=; b=cy2g/IQJ/rIC37eXKJgyjCiCGbIyu tKRrrpl7nuQQiFJlc60Y2DCFhvK+PLKi44YCFJbMvtAjwlWiPFKYltlIIlqOMCtt apOdrkBvxP7xc4GeTA9BzQ6JurhS2n0M26WmiHIbRV7VmdxRmxAABkgIe6jp2eKS irqQGxXyvB21z8fT3F+O2kF2un7qUzrmPn8oKQBidhQwMrQx5kd9o1gOsIVL7Fyn KiUSY/KupVXdQp72xf3m2yIC6cwX17/4e90+4IF+0tYNAiUfsW0rgy9RIcwl7N+4 xp8iT00GDd3vq5s0wvYdPdHNo2v00OrILQF4pRSUuClEIt/lALkkXqasQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvs6g7sd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:59 +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 45L0QwpX023250; Fri, 21 Jun 2024 00:26:58 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 3yvvs6g7sa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:58 +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 45L0Mhnm030888; Fri, 21 Jun 2024 00:26:57 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrsstn39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:57 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0Qp3M52756748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:53 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB30E2004D; Fri, 21 Jun 2024 00:26:51 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA86420043; Fri, 21 Jun 2024 00:26:50 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 26/39] s390/cpacf: Unpoison the results of cpacf_trng() Date: Fri, 21 Jun 2024 02:25:00 +0200 Message-ID: <20240621002616.40684-27-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: pFMJ3VX5eByn_XhL8lU2OEpij4dBIlvJ X-Proofpoint-GUID: RTniQi-mQ5NH7pBqPS4RncFDW36QzFEI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 mlxlogscore=780 lowpriorityscore=0 clxscore=1015 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B2DADA0004 X-Stat-Signature: 1qx868tn5th8jybg5apjrfh3q3onth3h X-Rspam-User: X-HE-Tag: 1718929624-725731 X-HE-Meta: U2FsdGVkX1+uLRT2EEbgk8JjHAnA9wRKa8iAngT1zjbx1/7TjpBfguUpO6bJ28wp5ym7fXU4hGwJgWoEXRyqqvJ42XZYraSZQnfv2PA8w24pyxLrMvwFLvmkgei7x8hTCCK92+Xx9syzgRS5T1uu3z3fEeijPVgDKUTpKFMRK6FKclhVy+KXiVNd3QZmnxFMRnb80YisiISaeuS3tCTFlntMYIhmf7P9HLVcD7B7hOR0HY/YnQVhKIrCxf+Gb5Tf/GmjwnxyG7N0JXOfC9mnV6XJY3A+iKCr7OsLGQUi8LnG+8tJYhihgujto5ys92EZmy7EchD6IbRCVylIWdznXoJfA9r+pyQVSkWebqBY/6bwnxrYifmYM6vnDyFJRKHKtQyWvpolsuPy74/Jt6ZPQIM18xHb1rlCFdu91CuB0D286Hw6K1Cy9m7xryuMSaYGAhYjSuLVPNkjxjPmrLtGTob/4cFz9cCowR24rsTvaHq/O692Tt2UQ8XCQUGDk4HbzG4HcKoToWTr2iS8iZPTDybr7O74eFw3yeDNXbcXZV7PTg8+2URbww/qFlGqOhlcwYFHZ+hUDN43DSq8BDGlHUBNTi7ErYHdSPU8j+w1INp9J9FK6Q1lQTL3FYZb1o08Jq0HbHlEx4z+FLHC25JpvpL747p8fNEGDY/qFavuPIbp8er//wMVj5itO4wqR3SQ8Od9chcIK+RYtc85O2aOGJ0Ms51zgp09MdES05AqaWq6nu+hl4eFn/9NLBYqHQkLpwdFa/BoTuJj4A1MN6h/tarYuUG4Y3kUBv53G7DpMyWiS33DwCTCvJBJvluN5IUzUh9RPJTcXE+ye1wozV8ToDIwc95buk0QOoxQqTo/MWps3NTEmhY0IkhTTnh/94uxuIMGpJfcyPkvjFOTdVmRIC9hZQtb0cZwRd3v/HP+1wQG6E87RJKOIWETThpCK8N8WrJIzKcewZJWj/iT4LB EY/dVSSY kAQ/70hatL+p/9xrU2gm0w+rEcyQicuhs97XR1WwX0N+t1UwnKqlq6nk532pAWU3PUDQuXodhaDYvg5CQIctjZ43mPa6lkijsJCLeBx5pTxhXFVgpOW2z8HFtnfJ/PiE6FEVPxo7kK9B43hUaE0IOjDnII5RhBiKtUf5c8CyzRbGI1EDTRI1p1KGfw5Vvr2fj/OFhTHg6nOwUrpVr/ZuqfSICKPw4B0b6LSx9sFKeksyIK8SNVe/Ae9srMvZRnz1awDbcbVUpxP8x/5pKjDuOHm9GQrpw5NlL+ljUcgWbwI5e7+aup+VwmqRK4l2FfQWwEGF+ 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: Prevent KMSAN from complaining about buffers filled by cpacf_trng() being uninitialized. Tested-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/cpacf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h index c786538e397c..dae8843b164f 100644 --- a/arch/s390/include/asm/cpacf.h +++ b/arch/s390/include/asm/cpacf.h @@ -12,6 +12,7 @@ #define _ASM_S390_CPACF_H #include +#include /* * Instruction opcodes for the CPACF instructions @@ -542,6 +543,8 @@ static inline void cpacf_trng(u8 *ucbuf, unsigned long ucbuf_len, : [ucbuf] "+&d" (u.pair), [cbuf] "+&d" (c.pair) : [fc] "K" (CPACF_PRNO_TRNG), [opc] "i" (CPACF_PRNO) : "cc", "memory", "0"); + kmsan_unpoison_memory(ucbuf, ucbuf_len); + kmsan_unpoison_memory(cbuf, cbuf_len); } /** From patchwork Fri Jun 21 00:25:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706585 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 541CFC2BBCA for ; Fri, 21 Jun 2024 00:28:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FAEB8D0104; Thu, 20 Jun 2024 20:27:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6594D8D0108; Thu, 20 Jun 2024 20:27:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 289E48D0104; Thu, 20 Jun 2024 20:27:10 -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 031CE8D0106 for ; Thu, 20 Jun 2024 20:27:09 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B6D9A1C13E3 for ; Fri, 21 Jun 2024 00:27:09 +0000 (UTC) X-FDA: 82253006178.02.D501F75 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf16.hostedemail.com (Postfix) with ESMTP id 6E23E180005 for ; Fri, 21 Jun 2024 00:27:07 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=WOG9KwPy; spf=pass (imf16.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=1718929623; 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=JW4OYlulNRlCFp8KghuZIX8r8TxazwG2lVgiUsdKx0M41eey/qXhwNH3gXnmYysqysMm9f MziBsnXok6NRpj1Oa55u3IwMPzCw9X1gu8Mg+JpH8O6bb2V9zGiGmVOcGFaXAxZnbCAAFW NumYXj7cAn0StOSWOKiB1xUyjvkj/nA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=WOG9KwPy; spf=pass (imf16.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=1718929623; a=rsa-sha256; cv=none; b=ULnKipHhXOu/gi2YzHtBByaggWoeFH7D2fataiYAVZp/5eO2dVFPSVoTtoBVh4hkKKLAM6 VVgMCwQsNVHgNNFxc7IL6l+/k/vgM2vvdzEdcK8dfkKQZCB7n6sGaVrbwJgbHp5hd/urzD eN/57TN1XiyphxhPt8eTIyiTazRvE7Q= 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 45L0QQck007775; Fri, 21 Jun 2024 00:27: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=tPY2/xfj0WoIT wfgq4isE+nahUee+x7RgpdrRutXdLc=; b=WOG9KwPy5lW6w/HKd3bM98s4XlbG/ HxT0Fdi4dg1Af4TILtilSApJ0ddc1DxxKQpmUovmxZbyfnpR4gJgxyqqZ2/DbVm7 6+AZ/8JNvxo4BmDNdEB1HnznDFfALsynkALE9mF3kQls/8WtGJZ+KLBM/Z/2cKcp fYI3n0+iQEpEYUEbIHAzCClNpgpCPPkvRLvPlpVA2Fqgk6dmMbuyuGuWg7n10vMM aI63AsdOkM2geaHldKvk1F12M4T9sLo/3T4s01K6qJwqaTElkuGmIA7hpmpUTkjg xhh8zW/qQEi9SDNWXqVJqDWKBnQjkVoV6prfVRLE1W5ZMS1xAU5+gr43A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c8769-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:00 +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 45L0QxAf007945; Fri, 21 Jun 2024 00:26:59 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 3yvw8c8766-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:59 +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 45KLeEAh032326; Fri, 21 Jun 2024 00:26:58 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspjn0y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:58 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QrZi54067482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:55 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1160D20040; Fri, 21 Jun 2024 00:26:53 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DFBFF20043; Fri, 21 Jun 2024 00:26:51 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26: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 v6 27/39] s390/cpumf: Unpoison STCCTM output buffer Date: Fri, 21 Jun 2024 02:25:01 +0200 Message-ID: <20240621002616.40684-28-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZyRH2cM2a1ar3ozL6AHjMGtgyGHBGmOh X-Proofpoint-ORIG-GUID: ikkOvxFQ4wm1Gq2BQy-mlkcEGMDjF1s5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=958 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6E23E180005 X-Stat-Signature: hqnmnk3qfhosfpsgzd13esfgxhed7ea7 X-HE-Tag: 1718929627-775467 X-HE-Meta: U2FsdGVkX1+0KL/Iq9FM8Gw/IEt2za0/Lt2TG7SOdODIAAbWcGWTjT+EZk3J/GwBXgP9IHWqm58cOr7gwQ9PfK8QIf2ezOe67DdumftPgRt0V9Y4b6Ms3tEQdk14HkK2s5jt/HuhoeegivlDBF0O7M2IAWX8dQOOoQE/DERIzC8KdVIXSE/PHbd4G2yDuOUHnKY1lHbS/vT1eOjIsAQHwYuf7VnaoVR+US1lxb/PdVsth0D+t3oC40FO+4t4zdNz3Rp3lgQX97QGm9iZfCHAg4UgvUaY4QAROxyjLJlwn1v3Da60kxrdzPe1SZaGfJMTehn894NPL+Kuwwx0A6GjFI1UQ4YBU5ZIooUlq+FL7eDq5o9i3fcNuQjnkD2ElQwfcUnk9qPMCzumjllU/Hq47TnaOrCubLXAIQJy+LbsrmgnPo8vHrw7I/zys4kqycMWiggLn35IGssBeWw0kkBEgr4AU6hAIsiEcQAlkzhRjKT6TsfMC6nhoTcKSofQqXJLjLKdNcH4lWCGU/h7rABzYa1Uce5o3ShvkzUfFGfsPeJOty+JMZFwF8oiic/YDWd145Qu2phyj51P05UUnkKAvtNiB6Gin7l62l5mNofnXXfBRbAuzBtPlgdDVXUgfUww58KaR9GXtMiWFrOGofTZdmMfvyH+Lq7GE41m3amYeN12qlYjfnHQPQNnXFc7E1Vms9GGE05ko3rOQiY04tbV44JLgJkFk3mIoJxnonPTZwSStlyMcuowPEyjXM79ogH0e7jUaJTdG1MmRmErni4XDKvwrUzJH/jV413gKdeVxgUTU7NsMF/2TVkFf6oaMhGWKgK24OjzkiDjuW3dq/7Dv899HE721O6ED9uMQp8ymah9yzZxsdhSuP8Vb5Udb9uKL149vDFnJQ2E91KAd9IVyIIEtIACoxvkE0uwxCK8FWEgUSlbBUsNjjAuOUyx1Xu/fmZ9jr+gRiE9UxukRfu VaIvRRgD cfTmjt5O5BvwYjzQR+BMXPD3Yug2g1uULdDJL947ITaeEuqHNBhMg3z+sVV9aT93xjQ11gKg3QQu+QyAbh/qKl367S24vDejoRowCdLnxFFoZqjf1K2imAyQCC6kV7LGt8sbfmIo1NHwZIDr17t+gyggVD+aEynazJEbFfqbgYRcpDHlzXesHDFyTr8R2jZJmnkoR0u70OVqSNaZ71i/JfDKJVfs4OFsEP0q64WEqIhh6KHjJxjDUbpo9n0XU3qQOwSeRmTUVCbtiZDhY4f+YNcM1Rh4o+P1GCVP0qDBr+5HjVr7D6P5FOwEAG63cHdCIHQTvYbjv18M/DpUrCgmT+7UgzaKWmsFnDSiKFiNWiEUr9bcpNz4Eo/vCGw== 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 Fri Jun 21 00:25:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706587 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 D7E7DC2BA18 for ; Fri, 21 Jun 2024 00:28:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DD7C8D0106; Thu, 20 Jun 2024 20:27:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 23CF38D0109; Thu, 20 Jun 2024 20:27:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE5FC8D0108; Thu, 20 Jun 2024 20:27:10 -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 AF2F78D0106 for ; Thu, 20 Jun 2024 20:27:10 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 693581206DA for ; Fri, 21 Jun 2024 00:27:10 +0000 (UTC) X-FDA: 82253006220.19.87C2429 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf06.hostedemail.com (Postfix) with ESMTP id 2021E180007 for ; Fri, 21 Jun 2024 00:27:07 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=PNF7gbL2; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718929617; 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=//0Kc+3BL5cKzp2INWy7uHqYWutu2bfhjte7hQD65vA=; b=gr+fjR5se/zrOL48K91luHlaHrgB6ButquThF3PGxs3w+5hh+I6hm+tZ8k8KdOGanUYbVX LBI23N6B6XeveG/CMdLfCTh2Gj0ww/1cpRHXMvMTTkrhAommiQ/Aet+T/mBANp7AoMmf6Z 1tKs/tAQP/Mf02+OfG+4sGlgOIQATZE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929617; a=rsa-sha256; cv=none; b=cBcpQqQCYYz9y3ZB6v4Cj48fnkemWTsVGyYV1CQiWFAgfPnooNcdcfAMyn09P6nMSP/eJH Aa7ICBwZK/vo8RQxNUW07IvlTbpvBWldXgZFYK6DJ0/R1KCBfaSWvfslJD2Q8n8gvFTumk kuAdS1e3bS31KitxqZ4po6adUnsh/PE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=PNF7gbL2; dmarc=pass (policy=none) header.from=ibm.com; 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 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 45KNtjEU028042; Fri, 21 Jun 2024 00:27: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=//0Kc+3BL5cKz p2INWy7uHqYWutu2bfhjte7hQD65vA=; b=PNF7gbL2puZuQ+js/w+zDJTHu/+C9 CEQ/m504q8i3T4mqudfRdya9hSrjEodUkeke8DarSdwPD3jceJAWgB1D6VM/VpVp j7Kh5D9FGaWDsB2l5a1Dg+8PDV7LtkTh07U59cN+55mDRMMlmPN5Nnf7Kp3+C+6q rcgz2nDLzulci9yeR/yZUCsshoXuoIycM4u0mCrRV8C6aXTWrlFLfW/AmMBymZz4 sJJbfFwA3DVQAgVxt7n0Jfhnh9mZb93BSTkcP64eDCNMtyEYTzAWz3FXt53UkSte wad5R6D+6i2GzvX8qwURobdjfNG8AW6WQ8y6sfGxTbfvYHJbsajRLOcUw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c876e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:01 +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 45L0R1Ns007963; Fri, 21 Jun 2024 00:27:01 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 3yvw8c876a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:00 +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 45L0GVt1025708; Fri, 21 Jun 2024 00:26:59 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrqv2np5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:26:59 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0Qsuj16253276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:56 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 46D862004B; Fri, 21 Jun 2024 00:26:54 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 257B420043; Fri, 21 Jun 2024 00:26:53 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:53 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 28/39] s390/diag: Unpoison diag224() output buffer Date: Fri, 21 Jun 2024 02:25:02 +0200 Message-ID: <20240621002616.40684-29-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: dR-59j4Kk4tyD4-uSWRXBGdaB4Fdihzm X-Proofpoint-ORIG-GUID: UqQveLdo15GSMG0ihOGcB2yNIYG0gRJI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2021E180007 X-Stat-Signature: z66gw6zp68f5n4taay463r5bety6eiwe X-Rspam-User: X-HE-Tag: 1718929627-155813 X-HE-Meta: U2FsdGVkX1+gjp11Een+vJFIWoSCdLbhfv6GJlECDl5BN9kgQAY4GJLxw6CeV19R4P47Y+dR2xj2pQtGooNMSJ+AROPdJF+wcag1hIVK8JWPew2LvEwKIB8qYBOFhvLSUfD6EJVEik+zA0ejCXhHdS25jPSa1SOUEw4eRanH159I2FBWrMgmPYAV8oVMuPo0xAcGL6p1v3qIKzL6LQZOHuCOEjzloog8a5xrGSxbMqZz+crDmkuj0yXLEwgxch2LQh8H3EPeU9yr8Ik6Qi9MWsCMcufEE5DGhmNk049TLR0BSpfYvBc6klo+2XFo82U/PKjy88B2Ve3k0ZjzK/JJ1mIUbdKWSn8M4QTowRzW8XpgluFSBjGQYYbaGSAKo3qZDIsz5IYSp6wYF5Akpk2HhfyObE+KRAxQVdbkVBAVYsV/KvJq/lu5uGWwiSC8DdTfjTRH/Y59WzuHMY3EGtFE40pJaOeHxf3xCiLR6jc2uBd1vzn8Lx8s3H+MbpyoHHgGa/WnjSfOwhkbQOTP9IiVqzG6QcS4Q8P2Hj6OUFvtXbNI0lHK55sPd/eFScpTDjwu77JPuUxFhlq9XzDzueJa+OZL0a1e6FZDYEsE5CId8uWojttGtpPm8Smlp69OWysmh5DmXk2mKMH5L33T4CtmSY6dLmbjpzpKkPmVHCVDYVWcBaGSZ6VxfdC7T66koZA/kdDdMIvmGblbeVUNgZ4YRf6JYsy+/8tdpTqEVVg26EDY9QDH/YrtWsbppMJuyHy1bWKfT28f5BWIWohD6BoIebkMNUcaY6rD9ke7kcwyAH/shvYFgw+TteYlkRW0zaA8aGeHiaw0hyOZ9XAGpChsPm3zzbEsTTgiiQpzVj5ZU/X5B5/KUkT8DTA66nUEyuKia/jCmOIZY5bD060QFabz4wSg8Z0eKrU/VraDj/lnzHBExZ9uREHdz4VySGPbrS7hjx2KRjV1yptHq7QS8SP 8jQLsgXW CzKN+szlA/pknyezDH3U/Yy7ZRXpD4yMjuEufD5OQfP0wRCvevGHXW1Fet+L7cVydq8yg3zkjrx7UHEVl7ELzkn8ZrNYwES5alowUP968HY4kLfoxQBBxr2YMsfJzbiLU81lhLtOJRxC0zJNsEBT2mJQcdywQr7Dyz38K4AGatXSQJhAcTklhnbBGK68bAijNXYXSu/yqZoxNoy9oUlTLzICw8QOm7BJjm4wF7BQetGk/+PCenksHgRdzd7n1qWijvMur+Z6nMz6GwewaQdEQXWRSb11Q64HT+hI1NgdWWuEDpszxTEyDq+cLJ4ZY18AiCAPYHTXcmBYBj9hvCuZ7yizUUC+t8XY5K0jlFV52ENj2M5AeSPcNTcZBqQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000034, 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 Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- 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 Fri Jun 21 00:25: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: 13706586 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 136DEC2BA18 for ; Fri, 21 Jun 2024 00:28:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 242F58D010A; Thu, 20 Jun 2024 20:27:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B6138D0106; Thu, 20 Jun 2024 20:27:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFC8E8D0109; Thu, 20 Jun 2024 20:27:10 -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 B59098D0108 for ; Thu, 20 Jun 2024 20:27:10 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6C29DA03F9 for ; Fri, 21 Jun 2024 00:27:10 +0000 (UTC) X-FDA: 82253006220.22.F2CCC2D Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf03.hostedemail.com (Postfix) with ESMTP id 3950B20008 for ; Fri, 21 Jun 2024 00:27:08 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sUnHME64; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929620; a=rsa-sha256; cv=none; b=JGyNSbIbSfWm3WCchD6pAoKz1aXPfGtfZRluqCxoRzkAef/8T15AE44XcPPUaLhXZnGZ9o nZCD+o99+j25yv4Oj/7L778BipDgLYuviQ79aM2J66QG7uYkhexh4ncMhKwLPvuDzLi0De c76jVtpS4J0BoYinwRgSmCrRVBphb0I= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sUnHME64; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718929620; 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=cydGYCBLvXy5bwxnaLLeIPgIhyA+qsDvAhnmnIEPFZI7OZYf+O3yTlBNdbkEFyWeXhJgfq 0xCoxpx/WEdnryWFS+EzILx5nfMHZKRYbgxY8yR3On9Jlo5lgKCLXkFrdZuOMAKX3GW25s XeU+d7cGsgNKYNZcyRYZbDDw60ImKyU= 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 45L0R3tp023355; Fri, 21 Jun 2024 00:27:03 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=sUnHME64zAR07GeAsCP+tfFazMxF3 AvF9W5UCwUx7LoW3WzAZfnxwWYON8fjMhK7kfN4JALZ+xlEgs5BsX/6eTrPpv3fe 9RRDK1FAnCTwPEjVN6GimR9wgNkYooDDWBPrtls4oszTTtcjE+CMn+Yz26QHa2Sv az7WoSlOb+sdcqh4z9iNwgdbzzDosvUCxXj55ZBlTFWgEFm0qIQAKtu/RYe/NbBL AVSFc8h+aLsCsBo267JOfd34MeDoj8t1pcjwCrxsRY39Xo/gW9rp0pm6YBLfFloI BqVKccJOkx3zRqBMooif8i+FsH4jOO98EtqS6RunC6DVPHHW+mncS9Tug== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvs6g7ss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:02 +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 45L0R29o023301; Fri, 21 Jun 2024 00:27:02 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 3yvvs6g7sj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:02 +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 45L0DBDN019999; Fri, 21 Jun 2024 00:27:01 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrqujnyv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:01 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0Qt5m44761488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:57 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DF2120040; Fri, 21 Jun 2024 00:26:55 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5BB6820043; Fri, 21 Jun 2024 00:26:54 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:54 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 29/39] s390/ftrace: Unpoison ftrace_regs in kprobe_ftrace_handler() Date: Fri, 21 Jun 2024 02:25:03 +0200 Message-ID: <20240621002616.40684-30-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: N3pQcZOmYYu02d0GkX16fhENd3yleyOu X-Proofpoint-GUID: f6nbbUMMpzabyYE5l2CvSVqR2_ItvZYT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3950B20008 X-Stat-Signature: dpkwydq71683pf8ujpmp4raxg8pzmn7f X-Rspam-User: X-HE-Tag: 1718929628-248737 X-HE-Meta: U2FsdGVkX1/D4xsEEmwu+bvhGMFi4WRq8ce4txv74krdiiHDCKcvJbKHUVqjsXklyuvzZWvj+M+4F89MCjudHtOT3hzY6ELW6u4ET3+DSF+RMaHVi+dpXzSKYD1vQYqN0USS80qep16UrqYLDCu9njn7/JczfGqQgClBhEr8E86P72Xrpcy4KCXELD0UjF/WyQMfD/+dCdhRp5UVonSnEm5NmLnfpuANoQpQJkI4Bf/RLnvaG2m7FOvvL6H/2LeVkwulDlSlNmcr0XyWBje52yfFIyDb8Vg+AVbUrPE6WAtACTNqsiXAEmY1/fIqirzo8Y2xXJCMWJWihAgEeIQPG4Kh8J+r286mQlnpyL734JAvdKBsJpqGbuc1JGbNzNnPQtN8qLsUeVVllV3xhTfL/QuNy1YPOhPHGDCHmnTm7Md8wdtSZkxJSU3htEMsWs/T67qVfaTdUSlMegNIG592GXZTLFk9FdVPvrURsCQgybOLRIKq7vabci43DwYBMvEsd6Vjnu4/p2NFzN1OH8bltBWFFGPYYzvizZf2T1dYBN2iY9CaMfJ5IC2Xpy33dIQlri79gQzwdJZfc371jtiQgkKebgaZyKOQzuZVnQlZLasAbm8tHUK2/DxdFfrlClaWb3SUAbkMAZs31+bRUjUCqSjTO/WFkRZAn2uxKIZfrB10AHqdHy7RWjGXTKkL21FS+T+HX79kg+nxiRjkihtFKFtjaQZl7umAVm2Ry7pYQMQQpXLVETAMJ9URMLT9NR4Vn2n/glvAH56F7T88SG9kcCefDR5NkphBGRfxT7nQcbxHV8poxouE9IAtfh1YPt2euzQUpdnhSg5CiX9E0t1l5eAEz8NYC7DalYO68EX+ag3MdBsB/FxD7UYAGaPv6jz7+tpTWfQde7ZyldJ+wFXKwXVVHjahEsFyOcgNzg+1Y8vYchsMpXfXa+7Zduk95FHIB0liJYN36EftDYpx4LT 8SJgLmGg N7la5QKinWxUnJ4nlZ1LSv4JurIJT8xItdSNYnfE4p+eej0S973NMLgIZuzaG5DGf1e4HuOkfdcKqKg1A8cdAENvyLyBIEvpiaLy+3ou+7G43zUwAKC1TA2m+x2RLp8hLI6shwPj6IUBDlmzC9ZujaoJST4Ifi74JtpGANzgMAozrJ4mm6ww+kDxdnG7OE//rlaARq80S8OYZLT/HQHCYZcGRNqPRSxT4qlE4jnxNiGNNPRu3k1uuw/iGpMstkvF5pTW66lk0fd6JihpEPgDln4zWKv/xyDCu5wjq8WdzehWObzgK6NCbnie8BKZFAJB7hFXE 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 Fri Jun 21 00:25: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: 13706588 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 8A3C1C2BA18 for ; Fri, 21 Jun 2024 00:28:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C9598D0109; Thu, 20 Jun 2024 20:27:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 306208D0108; Thu, 20 Jun 2024 20:27:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0DF708D0109; Thu, 20 Jun 2024 20:27:14 -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 D5D7F8D0108 for ; Thu, 20 Jun 2024 20:27:13 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 93A7EC06AA for ; Fri, 21 Jun 2024 00:27:13 +0000 (UTC) X-FDA: 82253006346.23.92052F4 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf08.hostedemail.com (Postfix) with ESMTP id 4B07016000F for ; Fri, 21 Jun 2024 00:27:11 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=IQLYQcBZ; spf=pass (imf08.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=1718929621; 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=qiJSXsCqqhNhqkeB4DbxmciVqvkkNhhyrXyjl/2nna20aIyQOzvPEEgJVS6PPRdRMF27CZ PwjpXx8kom4Zm/mUKadZvJ/nIt1aL/gnYuB+EPxUK5gJNhejBpoIsjM65S2hpQXZgo3yxp 39aXTEXMX29p5H1j4WX+V+1M+NoakwE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929621; a=rsa-sha256; cv=none; b=E1CUae3eg7QslDisOvWkBUIOkdPic837r9OAhmBeiI61Hzh8g7LFPf3OugDfEalHmEt/NR Vj9wkHD+dl6Jot2QD8s0em9wDZd/cTwtngb3p72DER3EDljuulNFYYl1lzJC/LFC2QLc4I 7uLVzxq2VMmKzSJPt98fkINUQ9ihTjY= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=IQLYQcBZ; spf=pass (imf08.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 45L0Qnua007904; Fri, 21 Jun 2024 00:27:05 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=IQLYQcBZjqnXY46jTEf3T1rXGEJOD JzsTAECzL2BtnJ+puhZwIO9klXa1OfyYh34KfRBM7kET849OfcIlmefdWL08DuAy MfXzFprdqGipnoBIm8XVByjbhMgUbhcDL4heEi14JHpWfFLT+/At/L5oR9McdDv4 JvZMNdCnw2JBNPwY1qGOWvsbxFWhKYebqbJCxrZlzKsClEcoNTX8SXK7jdL/1onF bj3cnBI2f5oXGR7QkG4Tt2vD41TG+JsZ7r3P8vM77ydNqy1BCBjwpSl8AMI5PaLu jIQlyzi/yrCUHomasc12Mu0MErpWipBmRJuIOPZ3KQHT0aFBehYj6kokQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c876m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:04 +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 45L0R3AH008332; Fri, 21 Jun 2024 00:27:04 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 3yvw8c876g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:03 +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 45L0PCOr019980; Fri, 21 Jun 2024 00:27:02 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrqujp01-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:02 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QuN328836416 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:26:58 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1C8D2004D; Fri, 21 Jun 2024 00:26:56 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 91A1120043; Fri, 21 Jun 2024 00:26:55 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:55 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 30/39] s390/irqflags: Do not instrument arch_local_irq_*() with KMSAN Date: Fri, 21 Jun 2024 02:25:04 +0200 Message-ID: <20240621002616.40684-31-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: mJfVanZcD3aql1zd3WEmKagMvpX0kn1c X-Proofpoint-ORIG-GUID: NFgq7-uLXQwiRiHtpJGf6Y1zeU6AIr_p X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Stat-Signature: tuktoumsipatsdrzuzg4jn3aypyrizmc X-Rspamd-Queue-Id: 4B07016000F X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718929631-844410 X-HE-Meta: U2FsdGVkX1+Q2FqOvk+Fi3aWpK8b+RlZ64DOMke/uC8SDAWseph9CFU4ZXtNaWlWSeX8FjVuEimul3qJKMAhLXDhyWqCFFmgEfUcaFBx8zdAovjzWia55Fdbe8b+S9q2VglzHS5MI+3oZk/YhDDmPWYiDawECN9gWob2yP8y5WOel2l4QjKgIRdhmxRdal5fF/dAmyn4FKp0q5DYrl7+KQa8ochgUsLSIH/Ixh0NZRrbMuJG5zuelE4I6hJqJJRjCUbMBWeiOcD2DH1EIZpTsgHyYCkdcvhn0VAn08h6cY7YOHUt/cHAn+OtvTBcVvENvs4a8/KkteY7eODaz8mhsTIt3/E7mjPYdeXcUB17BSH2sVmSCMZNmojBG3ibhZQR5EWl0eVw/M5NhgSYvaRTwM/8m60UNa+zoVE+Jh4W/ZMw1wjqrdYHw6LuhBk39JDkavOAXSQlmig7CpcX3Mu4qYp5NIgr3velX9V9Zpg0xE8CtOhN8tuAuNg0dAH6azGkRg9RCrj5drwYEJ7CchPoRvLDifk+S9hlCrJ2alp2JPa7vgZJqAsltnyURpBrbavzBOQi6wPxDiX8jeHfb2+nnJ1GCRzEp3KYF28HGs+kAYu2VYxvRYJHUqsyeDpS+IU7W38PkYEC+rPJ9uheixqbw89Kb2SpgiT/gxEVFTXBOpcJY4qmXFhM+jWaJCDMAGUA42iTpbjlZJnUNkRzXnLYBdA1S9ZSDYrz3aFbh0yhAmxv+IEdaeH/9cpGtxZBEyPXM0m2E4iAZFRWDtiuVVE9QcFSloUNRSSJrd740ucFu4fF5CRztcv0egGbKIjgEzJy1uTYpbs0ouwIwMkPnvW43cgVFXz9jvB0SkFvg7+aeusG450TklLGw3r+kktMPIih/7VU75gdwhQ22Gfr6/+uOWxwJUXM7s0iPmI6LixW4z++veLOKg+SWMl08idBI2M/mho+cAt/1CYc4U7SDAP +8KQXoB4 HyfBO0nu6pX1QPISA0z0LfJO4T7PKUgvAOdNJQYWmeHlsEfu3hDhyJPfWWW+0eCqhrrZJichk0VAK07qS9QL/e+HP5YqzzB59K94CGhrv/qSkjA3T2pKyTC9ZNhMJxC8o7m2PcYzTglZo697QKp/OvdoIDNrUYMxiFmfaI+GlL9Y2EXM690A8zrRhJBQTcz0Gw/QXP8zrK/2psMm9SPMDr8c0jF7TkA2CSYsRaiR8WoVZ0vij5kTT+K1kkjlkh6f5ogrk65XbXV/wvD0o/RrUVp5dmk18Gu0ic6I+7ePq2dG/kwSZGXRNzVjaGnOEhviXDA/qYuFvpyNpvx0= 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 Fri Jun 21 00:25: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: 13706590 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 9A78EC2BA18 for ; Fri, 21 Jun 2024 00:28:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4D538D010C; Thu, 20 Jun 2024 20:27:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD5F08D0108; Thu, 20 Jun 2024 20:27:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B65B38D010C; Thu, 20 Jun 2024 20:27:16 -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 8C3458D0108 for ; Thu, 20 Jun 2024 20:27:16 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 477AE40681 for ; Fri, 21 Jun 2024 00:27:16 +0000 (UTC) X-FDA: 82253006472.12.5199E1E Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf01.hostedemail.com (Postfix) with ESMTP id EE8624000A for ; Fri, 21 Jun 2024 00:27:13 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="W/Djp9Zt"; spf=pass (imf01.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=1718929628; 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=X1oGap99TVdqBvzHLWhv+TXBuFqzUMdrRG4OBua4bwY=; b=4fSSH6vmg2ttVHljZbCX1MTEpHEt2+4cCxd5p/437jKskHMcpTs0VfCfVg3eV0IZr64gXI Q9fI38Bgcr2ZcBc+e1VRC0OEGUoh5HgG2o1tF4WvSfrxhOf1fMri+OHLEhvkVNKiTDcgAD 4WXiFBvXCvDjkIXdQ82vNaimTpKFLZQ= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="W/Djp9Zt"; spf=pass (imf01.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=1718929628; a=rsa-sha256; cv=none; b=DOjVjhKmliwhVmEbvSzjCzAVoL3KCfKYm3ckxSL4w/JJmBg1vSyHjwFxoWXBq/Aw8KqtxN a4L0x8dGLkzvlGUd7mHDE7ZN1Z/ocAsTAHP96SOu2hQRYSDdPXl7TW5OlTcWzmogGJGN9Q 25/ze8cGepKldID8TZGagzqzwotJf5Y= 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 45KNQq5q017556; Fri, 21 Jun 2024 00:27:06 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=X1oGap99TVdqB vzHLWhv+TXBuFqzUMdrRG4OBua4bwY=; b=W/Djp9ZtsfVEpx9QWWwFkzt8Fv3ap QSwktim8QLOry4OiQYZxRoOLDLIyi8ZoxjR+Rv0FvLEsdBfswRxN3tmpWh3wFr9f QXzjDQHtq4HdTZykS8NoObH4NHqzIxm982ozsNg4vYn+zB7uVp1tSZb4ky/4RBoF LHybOvuJoMJXyHoXuCIfA+hFzoN2hWYs3YrghVR3Zh6/zYU5emAiyerhyWj6MRJ1 1/ygwrPHxfDlEIooBOgZe+wwKnR2PUZV+7r15BfMuU535DthUOQwk0Nc8VO7MrMe jY+Kkf/GqvuNK7gOlxq/nnNdrMR89jL++qriIuxlKXv0D047CfEHxmbyg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvrdr8be-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:06 +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 45L0QaaE009416; Fri, 21 Jun 2024 00:27:05 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 3yvvrdr8bb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:05 +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 45L0PHZm031330; Fri, 21 Jun 2024 00:27:03 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrrq2ncq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:03 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0Qw3v46924224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:27:00 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E97EE20040; Fri, 21 Jun 2024 00:26:57 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C698D20043; Fri, 21 Jun 2024 00:26:56 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:56 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 31/39] s390/mm: Define KMSAN metadata for vmalloc and modules Date: Fri, 21 Jun 2024 02:25:05 +0200 Message-ID: <20240621002616.40684-32-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: bwF18VfazW8eN9kbTGux1ece82genkGJ X-Proofpoint-ORIG-GUID: vQS0SDPy88_48lPJre9HnK-Wr12hlnFB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=663 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: EE8624000A X-Stat-Signature: gemcy8ndcj8z1co3pb3ugjnaw5naqdc1 X-Rspam-User: X-HE-Tag: 1718929633-591288 X-HE-Meta: U2FsdGVkX1/KOnvGJjZboRVvAeXoOaLvBa13Rf4z0F5naDOH9nJGR8IDkHBK6IhNJeKnVSf2aP3DzFlZhhH1eFR2guANm3ypUsf9nmiSxlFSey0RE/jkt2ELQ/3r6oPHWd1D78A8Y7ICOIxZ0iBeJ8RjqRcjTrWkBAAwwEPnL13DckVnKv7kbDCsJemG5XrDlFUH8gIM7L2E72JwHPPDoNgolPHpArrSnXiBiH3RRY7Al5BmuKRDsq+qGt4Loe2NNMs2RyTbyLA3zYNHEcuCNRvySHiS1vdgjsLxK+79DaHbc7RVNBZS+upGAZetsePENf6G86yZW3nbTXBBhdBvE3BxNoAtOhivO9onhqtH1L8Y+Ia7Iu7kuLK3TiGWI9K/v+03wlTxDKVkM7rZRFpDfrUrT8TVGaVyZ929PKOlth3NFqsTQVnep9/Vb+wbI30u6bOt3mtNbX7O8T0nsLLdVnO+zulewk+SvnfKqIaG2/lor0b5jqG8RfcS+bhwF8VRfx4tGcu+pqviydA/RU9DBRXGohgyVsTxiBhNszscarcoOqB5m9/qJPqU0kIZFebqC9yR5OEHr0KQ3teh/OlCNLTQ6QV8bRtuvX+kGo/y3JKSoIHcmvUENktvXqN6F9hygLZQbHJk5oR9KHxn94XmJE5BxPX4fKOAqwIGvdP9AXuui5mntCzZdFKa8+sNYG8AsnOUIizHbcAiCtE+XslbPQPuNwSzvPj8cRvxDRO9mWQvlTvnHkSUv08z5D4WgVqUFVxCmMxWPCrbetcIuHTc5mwK2BY72upSxMNqe65mOmONWM5wz5v4uO35N9zRWbwqSxZ/k0FG0N4aU9IJY9wyWkEZyUJlPc25geCJbC1oJ+Lx3VG6dlGNvSBgiR/R84OmXVO9P2doS4yaT5F9natwqQmrh/rHMulD22mkWVYtrTnsq8IzHdw5A24x5ovbnwIbVTHa8Dwr7pnhKAj690m MB47xyC1 j+8mW0eAzqDoqisLVaUBI1eASMQE1ZIZHvZKCToJNFz1tuKjk0/gtFMOQG5ZnyvNLvMkHZTp31fuF9QVW0yN50BgHM8l7pZEOtN4yYq1QEIxrxrvjBgSiRvtTxesErDnPi1aoPkk9JmqniirlW4BYNMrfSfiCIzs5ztBgdg4czShdkd1J+A2yK1pcwSJ5A93Aw0//318/mXaC78xaEweWc0PqMnXLfqeu+allRAN+ubZw4jgq54WadhW8Nh/4JAxWhoQIl7DVu9KBGtLr10En7TJXrw== 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 | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index 48ef5fe5c08a..d6b0d114939a 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..fb6870384b97 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -107,6 +107,18 @@ 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_SHADOW_END (KMSAN_VMALLOC_SHADOW_START + KMSAN_VMALLOC_SIZE) +#define KMSAN_VMALLOC_ORIGIN_START KMSAN_VMALLOC_SHADOW_END +#define KMSAN_VMALLOC_ORIGIN_END (KMSAN_VMALLOC_ORIGIN_START + KMSAN_VMALLOC_SIZE) +#define KMSAN_MODULES_SHADOW_START KMSAN_VMALLOC_ORIGIN_END +#define KMSAN_MODULES_SHADOW_END (KMSAN_MODULES_SHADOW_START + MODULES_LEN) +#define KMSAN_MODULES_ORIGIN_START KMSAN_MODULES_SHADOW_END +#define KMSAN_MODULES_ORIGIN_END (KMSAN_MODULES_ORIGIN_START + MODULES_LEN) +#endif + #ifdef CONFIG_RANDOMIZE_BASE #define KASLR_LEN (1UL << 31) #else From patchwork Fri Jun 21 00:25: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: 13706589 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 9FBD7C2BA18 for ; Fri, 21 Jun 2024 00:28:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F113A8D010B; Thu, 20 Jun 2024 20:27:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E73AB8D0108; Thu, 20 Jun 2024 20:27:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C506D8D010B; Thu, 20 Jun 2024 20:27:15 -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 9A3448D0108 for ; Thu, 20 Jun 2024 20:27:15 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5BE71140696 for ; Fri, 21 Jun 2024 00:27:15 +0000 (UTC) X-FDA: 82253006430.24.99753EE Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf26.hostedemail.com (Postfix) with ESMTP id 31978140006 for ; Fri, 21 Jun 2024 00:27:13 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=CpVjcAR0; spf=pass (imf26.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=1718929620; 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=hop8BCpVSniaFM1MpaXvqCFGVqZnzKhq9StiRXmewRE=; b=hQXqVUHtgkrtbFfaCD58tGoQF7gwwX8b8d49VX5+qVKUiXnsn7fjQa8jKf8tJaeY3i7klW V4HvPBKWH1vAGPEXCGs2gnKVKhIquGRrv6zFJ+sOrCPle/z4fo7FmxuZ3bCNAiPQzfT4ut uOvIVlXtE6fX+ImIIn/u1n3L+Q8gdpU= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=CpVjcAR0; spf=pass (imf26.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=1718929620; a=rsa-sha256; cv=none; b=5gS6UBH7UagpFIW1tCihM8GaxhiDcJEaWus2xlEpHnVf2daNo4tKSBiuCeuznx0zg0zdEw dUKw8MmYon6Wh3+JR8TrhE4a08BSpO6sEK5fZGh1OPLbO/NThde6Ori7cT51A1NNE5kwoj 9p89auhf7Zwa9v7pRDi9p6TQwmZ63Rk= 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 45L0QZfW022585; Fri, 21 Jun 2024 00:27:07 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=hop8BCpVSniaF M1MpaXvqCFGVqZnzKhq9StiRXmewRE=; b=CpVjcAR0OosZ+FQKvo8Jt1i1ShciW NC5NUYX6ovbPR0EhliBF9Qb655atP4PZX5N4DlLuKNKwQDQ8wNwBP7xnzeEtKHJZ eDBa9JXexUaC70+QolO/rHSeHJFDr8zvCdnFDX2ZY7VytXmVGKuBL7TwVGyfprAx 6EwH2gcc6rnckKj1HnyOHBe12aMzjxtKW6RK9T4tGHaopCFZo3ycBmNwAgY4+3MF 79lmxIJPWcuP10J4wCpKrWpN0FvyscQq9DDNu+WdDM5zj+anGyOBGm8rU0R51TEe UAQaHxcjva3oSw3RNbkhAiwvhZzpKw6gXjYKhe5La3fPrG3GE74isni9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvvs6g7t0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:06 +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 45L0R5ij023521; Fri, 21 Jun 2024 00:27:05 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 3yvvs6g7sw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:05 +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 45KLcZY4030993; Fri, 21 Jun 2024 00:27:05 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrsstn3u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:04 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0QxY857213382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:27:01 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2AC832004B; Fri, 21 Jun 2024 00:26:59 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AA3520043; Fri, 21 Jun 2024 00:26:58 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:57 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 32/39] s390/ptdump: Add KMSAN page markers Date: Fri, 21 Jun 2024 02:25:06 +0200 Message-ID: <20240621002616.40684-33-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: D7iiuOSKyPIFLwMOccTbCBPFEbLUtDDO X-Proofpoint-GUID: opa2CPcd6-_OVWf6pOKSPr_YpfqQEXBE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 31978140006 X-Stat-Signature: z1jmxnjre1g884otbpbpkr6js6psj858 X-Rspam-User: X-HE-Tag: 1718929633-419053 X-HE-Meta: U2FsdGVkX18eGZXoYPxLM1VK5P7K8NhuyG9YQAIsd552HbBxOti105dkS4YUbZhHh99HZBgfeoSYSTSkiFhe1O2+zHFtkbfnj/A37rR23dL7WV6kRTjcBrVOCDxG+mj+tVX/aWcbLp3owg9nGmgl5tW2e4OK/ziK26FmTU4ECayfBdvB+qa5PhRj9hAm8ZNe84vU0EYuTyRUoNEUsvkwtRKPwl8wAxoTmAWps6HUlS78zK1WUoKYr5uMrnuAZPSWRkksau3Sg47YhzwPhBsVSS3EhrRQ4upvhvcHJCp/y55WykpadARlKwiSZf+AcvkyGtixiEWPOWxCiiv9D7TFVcSTS4oq1RdIRasUlAP+mcikvRrY/oDRIE/Pnv7kzV8iCGvzNamIki9P69UU+Kc9llxpvSkq5Ssa0ERI7B9CTUpQm8rK6yEiaRa6QABDlFnPMFWOqp2M8w0CygzCfiJEf8HGF3CmtpkzoPxo/gLo3Coy/eqqSvSlA0Ae2dvqtvqZrtoqweo6wA0fKxzJHSbq58hKw26g/gyDcT5hhVdQ3nkdR2jg8a8u5mb1HQy9fLwywpHSrGg/ZbNPGt58ywLJwyIN++S4AoLXzefLv+MWUG/Nhfq/wrxxWoyWGUFnWXXNZLGOmndw98ay5VBZ3/14gwg0+lRjTo00MuEOF3YlN41zbCqjbCCjPNnYqMxM/VESLYclm8ESfHvZEAsTaF4IlzTLZL2Soc2+Rw+JvYKcLCsgTYy3zdJxgTwPb6L6DoEY7U/Zxq30Y+FhnE83yJ4NJki5Xo1ecz/qgQXglL1pqoJBJNRRWrD9bFtLmf/ao5jTFrbFZdKZ84Tky1gp+jx/eAtBBuW+cLATFKwWyNg74GArHkk47EEnEW0X8+LCX4w1nviHpQuZBz5F3NSCZHm/swAeTZJt6TAAvNqS3O/CItfUEhyzSFShDSnwrgZt7esXsBeGkfJRxSG5mdmNhDB Oz0AAWxq qashX7LCtqz5vRCFUiBVBc5fVIshwWn6Xkix23YQJiX6HL8L4Afxa2dDnNYsB9y4IdHdg6OPBy+btTdn7aGavqCx8Uj3Zi6IF49WMHNo12/dEODWAgj01LdUG2vm754Gt3+Vku5XRZLwHRAY82GUzXJLnTHIq9cLjJ9vcM0jkUM1IFiuNLhWZ9o+mUCGBpZLf4MHg4XcxVzBWYV87WdTHeDEW+z3J7RLOfI5Jdu6Jru/AdBuvs6L0JCHHhYNqNg7x9JXP 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: Add KMSAN vmalloc metadata areas to kernel_page_tables. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- arch/s390/mm/dump_pagetables.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/s390/mm/dump_pagetables.c b/arch/s390/mm/dump_pagetables.c index ffd07ed7b4af..f51e5d0862a3 100644 --- a/arch/s390/mm/dump_pagetables.c +++ b/arch/s390/mm/dump_pagetables.c @@ -36,6 +36,16 @@ enum address_markers_idx { VMEMMAP_END_NR, VMALLOC_NR, VMALLOC_END_NR, +#ifdef CONFIG_KMSAN + KMSAN_VMALLOC_SHADOW_START_NR, + KMSAN_VMALLOC_SHADOW_END_NR, + KMSAN_VMALLOC_ORIGIN_START_NR, + KMSAN_VMALLOC_ORIGIN_END_NR, + KMSAN_MODULES_SHADOW_START_NR, + KMSAN_MODULES_SHADOW_END_NR, + KMSAN_MODULES_ORIGIN_START_NR, + KMSAN_MODULES_ORIGIN_END_NR, +#endif MODULES_NR, MODULES_END_NR, ABS_LOWCORE_NR, @@ -74,6 +84,16 @@ static struct addr_marker address_markers[] = { #ifdef CONFIG_KASAN [KASAN_SHADOW_START_NR] = {KASAN_SHADOW_START, "Kasan Shadow Start"}, [KASAN_SHADOW_END_NR] = {KASAN_SHADOW_END, "Kasan Shadow End"}, +#endif +#ifdef CONFIG_KMSAN + [KMSAN_VMALLOC_SHADOW_START_NR] = {0, "Kmsan vmalloc Shadow Start"}, + [KMSAN_VMALLOC_SHADOW_END_NR] = {0, "Kmsan vmalloc Shadow End"}, + [KMSAN_VMALLOC_ORIGIN_START_NR] = {0, "Kmsan vmalloc Origins Start"}, + [KMSAN_VMALLOC_ORIGIN_END_NR] = {0, "Kmsan vmalloc Origins End"}, + [KMSAN_MODULES_SHADOW_START_NR] = {0, "Kmsan Modules Shadow Start"}, + [KMSAN_MODULES_SHADOW_END_NR] = {0, "Kmsan Modules Shadow End"}, + [KMSAN_MODULES_ORIGIN_START_NR] = {0, "Kmsan Modules Origins Start"}, + [KMSAN_MODULES_ORIGIN_END_NR] = {0, "Kmsan Modules Origins End"}, #endif { -1, NULL } }; @@ -306,6 +326,16 @@ static int pt_dump_init(void) #ifdef CONFIG_KFENCE address_markers[KFENCE_START_NR].start_address = kfence_start; address_markers[KFENCE_END_NR].start_address = kfence_start + KFENCE_POOL_SIZE; +#endif +#ifdef CONFIG_KMSAN + address_markers[KMSAN_VMALLOC_SHADOW_START_NR].start_address = KMSAN_VMALLOC_SHADOW_START; + address_markers[KMSAN_VMALLOC_SHADOW_END_NR].start_address = KMSAN_VMALLOC_SHADOW_END; + address_markers[KMSAN_VMALLOC_ORIGIN_START_NR].start_address = KMSAN_VMALLOC_ORIGIN_START; + address_markers[KMSAN_VMALLOC_ORIGIN_END_NR].start_address = KMSAN_VMALLOC_ORIGIN_END; + address_markers[KMSAN_MODULES_SHADOW_START_NR].start_address = KMSAN_MODULES_SHADOW_START; + address_markers[KMSAN_MODULES_SHADOW_END_NR].start_address = KMSAN_MODULES_SHADOW_END; + address_markers[KMSAN_MODULES_ORIGIN_START_NR].start_address = KMSAN_MODULES_ORIGIN_START; + address_markers[KMSAN_MODULES_ORIGIN_END_NR].start_address = KMSAN_MODULES_ORIGIN_END; #endif sort_address_markers(); #ifdef CONFIG_PTDUMP_DEBUGFS From patchwork Fri Jun 21 00:25:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706634 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 AA1BAC2BA18 for ; Fri, 21 Jun 2024 00:39:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 358DB8D0110; Thu, 20 Jun 2024 20:39:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 307CA8D0108; Thu, 20 Jun 2024 20:39:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A8B18D0110; Thu, 20 Jun 2024 20:39:35 -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 EE5548D0108 for ; Thu, 20 Jun 2024 20:39:34 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 726E71602C5 for ; Fri, 21 Jun 2024 00:39:34 +0000 (UTC) X-FDA: 82253037468.14.E177A38 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf19.hostedemail.com (Postfix) with ESMTP id 413861A000F for ; Fri, 21 Jun 2024 00:39:32 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=jiBtDJef; 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=1718930362; 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=5cNcIrctV1PyV7XEqv6oe3MQYDe7YXHTFqdEX2LJCAftbSbnbsnOT/Hxj7K71TujfCokuS URxrxpwEWJVpuFQ14VzQwHj9ueIyiVGfCOtAeDno/JHWMmj/szfjCd7YOjj3EXD/wurCRW ouYfDLJZtH8MouG++rRiFAnhg1Lu5OA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718930362; a=rsa-sha256; cv=none; b=n1y45iXdV8W0Lfcf2UD2oPHo8uIl7O+vCCQtHaff2oyLktq3jxsgvCDn1aSyIESwNO0VTL gbY7Cppdrvd6/afRNnHn6itByeo6p2JeseCXgMXI9Jq5RqwSNaEquJYgD0Ju5hUjajwI4x ws/aBCtohTR270+l93cUATGpVffeb3E= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=jiBtDJef; 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 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 45L0R8Nr030442; Fri, 21 Jun 2024 00:27:08 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=jiBtDJefwSZ0adJcvj47iUoK2awHM ZRkLbMucF/4MbIjhPN/tzA/AH6d3ETPaAkD4jGiOWaRJ9/FgLRvEAggS8HiGxzcs h5gdgas8/h3szis7aJDEpXWdjkNrSLCgFnZDRFr/cPsNcyDG7z3bEGU4Jzp76+Kh 9NpH+dF05JLKb+Mvi7pG5M5XhD3IvPC5EjG39FM0QolK+Jm1qBWESpu6L6bdWLm8 G9FuasFsRjjkmXCpX7w4YKMCehVcKxRYHtXGiHf7bcx5sCGPnkxGU50Ao92RqvEA tTCqQA5NE0vO+t9+9OsIzbGxS0l+tyu+fZh2L07QL2YM+evsdwpjF9L+w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8m05k6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:07 +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 45L0R7Kj030413; Fri, 21 Jun 2024 00:27:07 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 3yvw8m05k1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:07 +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 45L0Mhnu030888; Fri, 21 Jun 2024 00:27:06 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrsstn43-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:06 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0R0hd56689060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:27:02 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6000820040; Fri, 21 Jun 2024 00:27:00 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40E5D20043; Fri, 21 Jun 2024 00:26:59 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:26:59 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 33/39] s390/string: Add KMSAN support Date: Fri, 21 Jun 2024 02:25:07 +0200 Message-ID: <20240621002616.40684-34-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: DCrf_kw9F0ThMge5E2Hiq5L8_HHpB9Db X-Proofpoint-ORIG-GUID: 94o7KX1XsNd8aCWgl6SdTmdusc7KBk8Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 impostorscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Stat-Signature: acfm1fk7r5gctuzjirrx4tbu3chaokpb X-Rspamd-Queue-Id: 413861A000F X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718930372-789470 X-HE-Meta: U2FsdGVkX1+CdXh08nXtLLzNGrGRS6IPQOA7cLss7/3hf4wXLhitPGbbpKKCVhf94AokZcp1nh8vrlv2Uxn0HDbnMZMDwwU7AYQKY548edoX6YZZ6ejrl1ydhlGxYTIWKfCwAdI02/ydaXKt6ne9B/hWZyJMyfa2nwLYhtlpPbBcOhBYmIfDoIWuIndOWPLHh67OlorLoCwaeTcMNzYgV2gBPtYneyYR50I+GPUDj52D5ee3ecjL/cs4MbKLEn0OhaPGoInW/LO0m/XHEeoLhOmb0JodgRT9Zrw30yqfZwUMn4c013Xu1M+2pQkCoSKMMZh8vETAm1GOe+TOZO0wnudQz8Tmo62NcSD7pP3sJHi2NfdxYCNC+E9IjDoPnt+4M2dyJH8oEaPRwKCSGOQ25rS86VIFHO+/eGR09Kx/JvW9vncE9J/TwUB1+vk/JumClA9Cx2Lb1/NFlenNVtMIsw5480UeWQcFFg9cOVaXunmZ5c3x4N80wIzdXCQhCw061hBaSllkvjgcSfF5GcJRe/BVd251GaLyY9lJMEfZRuUZCD5ftIV6kpKrMAOlRcXPx4N2GamHSqk+JCbDUzNVgUC9xill6nLW0o29EEGx8AzNTbq0+IX18IpxPy26FhlJhxo1Zmn8LNHUQrYYmNWqZy/PMvMRR9954tGG36hqvVGPhPD8GfcsvS5RQ7dX6WJ4XCuFqg3WrxEcTejGOL9kRwDekK9xyW0r06LSrDoRK1gKSTRgQhW5vVq9RDJ+2lcC6xDwWf303dUIGeZ8xwKg9mgKtydz8PLtWI44mHRhDphq6LaLoMT3aUaSVLy6NWn3O7+ryW8B+/wgSOh0wYNR+tqMWozztZNpqcLqqqmhIiqX/OR7KX5YCyzxUIYpMAUdsv2epB60BpbWjS3b1QonPCfN0NHE9y71YGlLbQHcfKYbuT8xFC8XYfDbMlpx/RbMwNS5eIcTzFIUfZcvAUt ZI3dSQOc 4lspKhcdaxqW17tcdq4xKlQcii+Z+AiW8Jw7Xiuy9rHKtAOCTz+zly+CtQ/TIw76EmbU7/7nUe1UNW8/m3zPdLi0p8V0tU/eWVF12KVLLUhitbSlrgTsmhThyGUR9x9wDojJwX3nq2tvG0+GDh/u9d1zyU+F6S14SoCq3WAyxl4PU/HvnyS/c8pYpHHDN2A6ELf8eupTaBuShhHwiH2SBrDvpd1poFLeM9gMX8FSkTIPtF17OjxgaHZlVdT/WoDy72dYO/FB9AZySK02yt86jmKg79A== 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 Fri Jun 21 00:25: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: 13706591 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 B89DAC2BA18 for ; Fri, 21 Jun 2024 00:28:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C7258D010D; Thu, 20 Jun 2024 20:27:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 068E48D0108; Thu, 20 Jun 2024 20:27:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAFA48D010D; Thu, 20 Jun 2024 20:27:18 -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 B24FB8D0108 for ; Thu, 20 Jun 2024 20:27:18 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6CEA11C0717 for ; Fri, 21 Jun 2024 00:27:18 +0000 (UTC) X-FDA: 82253006556.07.3C41269 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf17.hostedemail.com (Postfix) with ESMTP id 42BC040011 for ; Fri, 21 Jun 2024 00:27:16 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=OtO9k6id; 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=1718929630; 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=2Lekuxa2dBCBcc5htHlKGfkEfSg9eOPP5CW8wCh3gqI=; b=EFIT/vCCg6FPkvN7Hl+ordKVH5i9jKAt3Pe2D+Pwug7gmFiQUK536EOpDECKZKLHZma7WR A2MM1f9CYqQ3bw5syCM+Ot9BYoTUuwqPD86zhrycRMCoATnajcO/39Rgr3reKcm1CA3We8 YNHOlC0/mOC62rLSXS0vgNsr0nYYM5k= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=OtO9k6id; 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=1718929630; a=rsa-sha256; cv=none; b=YprboI8OneegQlwnm80OAy4pdtMh4oWrdtSIu4trNvemdp6zgYtNXr0u4L94B/4CWDUNIe BtwnhN/F2BtwBxFERY2NdihwzmWcc4amFZDFCpkbQ6hNOzT60unGVXve5FOUd0X99MwQpS vM9oc68/QK5z6bNJ5Ug5BOV/gMP7/BQ= 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 45KNx6Ng026318; Fri, 21 Jun 2024 00:27:11 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=2Lekuxa2dBCBc c5htHlKGfkEfSg9eOPP5CW8wCh3gqI=; b=OtO9k6idlCrAvzfmVpEQPA2Dmt61l RF7fl6Sv0FBzPBUYC8zllw0vZZwnVsZVX1dwbeN8t+bssFNoMdmuT6iVZpQH8Efd 9mVcI3YwuFklGULWeQPHpR2v2MuiQ57Qoy/OtYqfFQ7F1N4tu4Mch+O5W2b//CQF WfPPOKRI6Uujz0/HLKfsPtee3E1zLi/Wp6uzX9nhjMrodY/+9qXm4LsqyJj8ogJR u6rVh56tuqfxwplbpeExbJOHh3nfpOI6epdCqAd9tCVktssrbCKJXGcqJdOvLLui 9DYX14CeBLqjgrjZekzUaIUSVSIpXfrnGv383N8hiy8zDmUBDPupIEJlw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvxjjr1kc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:10 +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 45L0RAOp005234; Fri, 21 Jun 2024 00:27:10 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 3yvxjjr1k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:10 +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 45KLeEAo032326; Fri, 21 Jun 2024 00:27:09 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspjn2n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:09 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0R4Uc51446080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:27:06 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B12920043; Fri, 21 Jun 2024 00:27:04 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF4A22004E; Fri, 21 Jun 2024 00:27:02 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:27:02 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 36/39] s390/uaccess: Add the missing linux/instrumented.h #include Date: Fri, 21 Jun 2024 02:25:10 +0200 Message-ID: <20240621002616.40684-37-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: pReXJqEurT5rl2qq_mhD2EICV0fd-riR X-Proofpoint-ORIG-GUID: Tezy0GW5uUBrF3gOWCkC2HUP_VXQfi1u X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_09,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406200174 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 42BC040011 X-Stat-Signature: szwon3e51365ojkmusgxefodxtafsgf7 X-Rspam-User: X-HE-Tag: 1718929636-346582 X-HE-Meta: U2FsdGVkX1/2P5su8j1fwnnirur3C535HxPqVrtSzOIKtVQZG3Wpj/Y+SWwvuoQxAlOonoX8zuLYc/Sza8gRkDx2MTjRLrBPeXvdxlcGvtt9HzXNYAlYcZRMYUVA66fnlWAeku6Yxs7joM85PjRR8DWS81g0kF9I+XWEf/L7HoW/WkQ80yjEvb6/F6O9Qq+xX2lmSiTxJ3xeE/jhg7jAyZFzAMIEm5PMVr68BiLs6CfYYyukLap2nXzywcsAHtl2xC3V2q7pOVn9H3Z84IRN7AikJvukDDI5UU2tABMizJC/AQAxkv8t5p5sNPGlYE/vfxykcKND85h9KOd3hPBykzmxv5EFf1IeNTk+K1ZRitu8DFDd7bQtjLwujA0e7iVh3TgWi5otx7FaGUkOOFqf38EMA6cmnduq7Vrue/b9fZHYP6TGV52FgTMutuNBwpU9/6nS8kVMnI4kIDwQFURLCKYEuU+5KaPbFVXBbK0yH9W0bYBO/u+XllhnugpzzG/Sr+B217eQXQ2HJAgMVxhYId/4exo6+Idq/2Z9IKE8q8B7LYjMrwtcaJoucUl0PHeB6NKJTG1xWGDIBnP6Trg4O+jCHRWExTja9TS1MTM0QwdGjcDHdTCQeawPZHO8Hl3Qq0OHYQ8davE9UZ2ZqCNA66IBabiaoJaXQFTvlMJtMB0WJYhvIBp8kktk5iy36A7v0ptyQUFew2Svus8LoZiOa55tcSXrXYjd6HKqECrO1uFPVbSo5PaP/sRMJuET0kffbKLGAKKZWoahJKNHEwvLDQ5HtVrEfmsmwxGt81vr4wpIjRTGnAy8cVTpgxsvnAGzLFqCLDqgPSnGXrN5ffWJJCpEV1CNfmcvvZ6lUf0Y0Ha+6h9PzZpm8fKu/J+CbrFub/+E1b52fKKdUbeAEOstJXNmID5yIn9GESMLRCcWYh6/JiwEXpgdUAk6QkBJbN564X2sMQHjFdcKVREhpuI XDrk0V+R oErKWNAuYMCqaeRlFLW0TbDOulCYGkn/GYWuQp1y3077w46oyUU8NH4S+Vjuj+ee3e0fGQ6q4FDinRMnUEBKWVi7+U2O8NPvElNvRDz2kd81qpWTGlJrMY4382taO0HPe8rAQ8mffJqgdNLVYx9JTabXTA4FfolnfF2w7hEtvB7O8ISw98b+q+3dD6JOgwEewkI8vn2Yu4f/9cmQZfIcStt0Oz3qRaad70eiG1qAotMUmiet6VPJNdi2iGTiT+A/sDftei/iE7d6MQNvxJq6o0VYBS3pVmJlWWIMoWJkTdHuafs8Bo3+KHZ8XEkFBB4UjITDEiwgmaQjEpgA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: uaccess.h uses instrument_get_user() and instrument_put_user(), which are defined in linux/instrumented.h. Currently we get this header from somewhere else by accident; prefer to be explicit about it and include it directly. Suggested-by: Alexander Potapenko Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/uaccess.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h index 70f0edc00c2a..9213be0529ee 100644 --- a/arch/s390/include/asm/uaccess.h +++ b/arch/s390/include/asm/uaccess.h @@ -18,6 +18,7 @@ #include #include #include +#include void debug_user_asce(int exit); From patchwork Fri Jun 21 00:25: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: 13706656 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 22745C2BA18 for ; Fri, 21 Jun 2024 01:48:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F2368D0116; Thu, 20 Jun 2024 21:48:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 979768D0111; Thu, 20 Jun 2024 21:48:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A4BA8D0116; Thu, 20 Jun 2024 21:48:06 -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 58C438D0111 for ; Thu, 20 Jun 2024 21:48:06 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EA608140715 for ; Fri, 21 Jun 2024 01:48:05 +0000 (UTC) X-FDA: 82253210130.22.9E4DB37 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf12.hostedemail.com (Postfix) with ESMTP id 6F2B440002 for ; Fri, 21 Jun 2024 01:48:03 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=aIb6VgQ7; spf=pass (imf12.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=1718934476; 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=55hBXU5Uapf6SFUSS0SLgc3rSJJlEWJqMkj6SBDk5T1LTbM+Rco/xXPDgiGXpBVK1hHcT6 iCTXOgTm64yqONY/2hMHa9ENSAI8PJp7YDCRFshEn4h5CSjBmAOiUyhBBFptj7BK3a73qc yEdtocfj/cmuFEIg6c95wrOkbvCUqms= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=aIb6VgQ7; spf=pass (imf12.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=1718934476; a=rsa-sha256; cv=none; b=sK4AlPu0ScY/tOYvykRA7i0QVWCLOrUvvRbpA181XKawqNY9pjyf8LYrhj6vWvLg4IEQdm 9cXbv9dds0YlA4CWtDbLXeGUQdpeoq9zertPCn7kk5kmyM+njH7uvBr7cnVvyF/AiaCP4o ec7bq9Q/27aykDoXjCj4TLkxCpYpP+s= 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 45L0R0sb029514; Fri, 21 Jun 2024 00:27:13 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=aIb6VgQ7QbQ+a9f27FW1rXkgU9TI+ ac6E76x0Gb+1RLsf4rrhn5v57/TZ8hpha9wluSc2XzHDYUJ+dhRvbdcWaP+0b9mG i9s9K0NyJCazzyPww8pVRFgzGCSztyRcNxB7ihlxKH5EGIhiOkcek6PIinRW/q7a wKFEpsqk/n2Hx06TILHR9Onee+7xt5tZqr/aZkbR0ekQ6oimSvQPe9jxUnIPCKeD Jvxda/zp1osbnOcEQsjgk2AA3Lp0omBcjFsqS8uXi0I/k6B7RrS3mTQPTPs7zLVu OQgKw/8psjgw/Hlkm3JEIV5zUe4W2xQD8rYK0i4oRnvDw48pPaYunuMYA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8m05kr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:12 +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 45L0RBvd030721; Fri, 21 Jun 2024 00:27:11 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 3yvw8m05kk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:11 +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 45L0GVt9025708; Fri, 21 Jun 2024 00:27:10 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrqv2nqj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:10 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0R5MQ46465358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:27:07 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FC7220040; Fri, 21 Jun 2024 00:27:05 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1F5E82004B; Fri, 21 Jun 2024 00:27:04 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:27:04 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 37/39] s390/unwind: Disable KMSAN checks Date: Fri, 21 Jun 2024 02:25:11 +0200 Message-ID: <20240621002616.40684-38-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Xga3aQKnQ9DmJLZYRCoEpzCagVb5KSSi X-Proofpoint-ORIG-GUID: 13yGShyYUNJcAcP9nVDWJR7b0NO4Emrp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 impostorscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=886 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Stat-Signature: dijwn66reyazdb34opta6cnqzb6o4k4o X-Rspam-User: X-Rspamd-Queue-Id: 6F2B440002 X-Rspamd-Server: rspam02 X-HE-Tag: 1718934483-396469 X-HE-Meta: U2FsdGVkX1+A0rY9sVFizEicCwVCLo8s9CcntDxFWFRM57/CIogxHu0orfO0BOAGLqOhQIvVjsgxOqm+5r173kENJZ9r6TkOPT7mFOl2qN6m4/ir7kzsOcUJR1ZE5YAKN+cmnL0wSPmktCdNAoZ6rmZi27xdyHky4BiU+MvrdsHgppWVkqtNiprMelKsUcgnbygVn9tFtLLzW1brJ/CWiaqI9ITg6BdSDU+ydkg7r8FnSqYB29RNd0HcUjYkVaSjoxfVs3Fy9QTPxlJ8Zr63FMEGVZ3hivDabDVGCjYdPjnHrkkz7rJP8EOV8eY68iy6hHDQEV3WxZQgqGMPNjvl+t8Gl6pY68WnXGsK7ks4jXaACWJ0O66SZfY7wV62rFs8UQgodZ32ggj43MAQ0WnWfjU9V40wpE5VklavHFR57Z5YOhL13BdJoWVFP1RpzT8Y1cS8wEr3vKXvVA5ZVpW06ITOtKRmPx+lIjOAsZOs1mpWVeRRaBoKQKuPJx0Nqn5Rgz77HJa82U4bIlNL8qLvGU1KH05+3vw9tsDvT+LkCgIGFPXRK66bCDiLkx0J/KzuyAXvEotDRBpCAqhFS1XKsReDuRlZO4Pz+GH/6AOfI/NPOWxp0ZXTbT83xcjkyty+g526iWUSY2RkiocUpe2Ixs6P5oVCfv69G7FUfL3NwCVbmcFlhWF8QTgPoqWJCuSyNgxYSkhVTgkcZOcXkomIwqTAid5yK9zuiM0MtSH0NOoSjh36QZcPdbEk3dj/2c/WukZ9MDxd69ELoGQZdHumtTHU5HgRiuFD3vwN/9FLVHn1Uxou04OE8mS7lL3PyVEZnS6W43V9Td8GI3xqLyYDLenZjpNPHWBpwo4TY9k/kqpj4scdxhZ+4d4tmImXHn/cKILLgpGICgJMOgVXedLAXInF8PI/CnBsOeQkjc8iPX67kraAnejBLITL9rsE+35/MmKp12wxdGTYoeVnONG 0E1VbfeD G9spI+Z+6svwra9BRkcBKiN3ZBj5+9/EF/HylsGbZAEvF3U8pVWLffKthx1kbI3ofliGLNR5u2YSVuL1sVziFyBioyJMlOfXNk2wCOtRr89FaUsXbAyQbWUuzEA5Z0i68kJsZsxFS2TyUzYBMBmZ91ksMsCVnOkEctGEqfB2bO7mO6W3aUDv6lqetzL48TvpRsHJXZAPl2idHGo6ulGux3T0qowXftxLTEf/Ct0I37TB85ssbeKj8skRYPffjVrQt36uJ7n25xARv7J52ivSPNNloCtK9gak6Dy5zGv7kTem33C5EVj728+ihDnRu7O2hGhdxoA4BviJPx8FT/DpMMyUrV10q6qQzQff+tdjiHsG1yMA= 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 Fri Jun 21 00:25:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13706593 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 4DD1FC2BA18 for ; Fri, 21 Jun 2024 00:28:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A833A8D010F; Thu, 20 Jun 2024 20:27:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A062C8D0108; Thu, 20 Jun 2024 20:27:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80BBF8D010F; Thu, 20 Jun 2024 20:27:24 -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 4E8BC8D0108 for ; Thu, 20 Jun 2024 20:27:24 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0EB7DA06CA for ; Fri, 21 Jun 2024 00:27:24 +0000 (UTC) X-FDA: 82253006808.01.A538006 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf06.hostedemail.com (Postfix) with ESMTP id AE6A7180003 for ; Fri, 21 Jun 2024 00:27:21 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=PrZp0P9v; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718929633; a=rsa-sha256; cv=none; b=0YbzxX8UPvEr81J55fTTLKiHBiYa2ZAAicJzlSTA0CTAsX+3DeDvtihf1oei2i96T9kQdS oZw/Gjk4k9orAnR/LBSIi9ok9HMvHEBmZLRiKB4pdXHdtccgD41zdc3DE2vJ8/ELr7GMqv y6pCKGDImPepqdYtRKXXkrxe35ASVC0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=PrZp0P9v; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718929633; 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=dJTBCTVm+DYwwDfuPqhjkMdDHVgbTJOgQUj+bRO14r8=; b=PaVfY3oIXUwuvTMRynkqe7HZt6h7pIjsXgU6upVSyDeVPR39FntC9wcT2oi/LxVXGot7pT MK3x/QACYz7k5uZiyKZFRlSqlm46ZIUiW1xrJnEh3BZiakXYRdTr6jFP3j6uxcWEOiyrt/ sdOjMPUXFJ1y7Y/IkHTWs1uEOh0bWDo= 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 45L0RD1Y009176; Fri, 21 Jun 2024 00:27:13 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=dJTBCTVm+DYww DfuPqhjkMdDHVgbTJOgQUj+bRO14r8=; b=PrZp0P9vS4SIuZRygqUYIsIzed3SS bl5Pa8eSYbFHwaAv4guVbMcHJHGvt37IUUI3wEa2iPyfXe4xk+bxzDECOakKTx1s TNc5uxKBFJn5qx3PMcSLibc8OENUUc5wOGS01hZbBQvqpe+Bapyn1HjmuRVgfbby SsijLCYzLuMKifQZUrk/wy9XEpllq9ijGb85AYGJ5/ZNMwSGbfFLuDUIKUwDz8JA fyC/wG5MyqCT+SqjzUEox+rjGz7+Q4q/ac4nvIps+0LyiRO3DEa/HKUXINgkXWTb Uo1xeaJLgyVdDaH46KtUAZY13GIFr5kkEzuLQd+dwldYx2EoGwp7b7g+g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvw8c876y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:13 +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 45L0RDWT009113; Fri, 21 Jun 2024 00:27:13 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 3yvw8c876t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:12 +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 45KLiBxN007687; Fri, 21 Jun 2024 00:27:12 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yvrspamsp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:11 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0R6rw56885562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:27:08 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7450120043; Fri, 21 Jun 2024 00:27:06 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5446D2004B; Fri, 21 Jun 2024 00:27:05 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:27:05 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 38/39] s390/kmsan: Implement the architecture-specific functions Date: Fri, 21 Jun 2024 02:25:12 +0200 Message-ID: <20240621002616.40684-39-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: qJzneyKICj495LR47ihcGQ3AFyfHC4KA X-Proofpoint-ORIG-GUID: DAUWdLee_Gr_anSc8J4SE-nczW9B-DNE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=926 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: AE6A7180003 X-Stat-Signature: wai9k77wyn9un87kyjhd39hbfgejzsqs X-Rspam-User: X-HE-Tag: 1718929641-835467 X-HE-Meta: U2FsdGVkX1+FkaOv2bmMsk+O7/Qk596R5xCnCUEquXEQuJdIdrPf2B1E0EsHQyBGH3wGqUSto3oSEKAwu/hl+3thVF8TwWrkiU6o6Yarfyip05gcGjh+dqXTVmgSu0pfvw8nEC8qJgsKgpwU6CHlWrArnoA3tqpTB9U5wpuL1wFN2d1/86OUKIJiNX5e1Y+Qj9mFD7CfQAvk+y8c/WA3Dhil5QKYva8JOO7mG/SXCwcpVmG3Mt6CSB6aJD2PmXMMeBTka4lJ8pzG1C4aUcl+AMjjiz0cnI5jN9JvXBWalHJxOMTUSXbw7mHDW9gVKBBd99DcLQuPFQD7HUR6YE7L0O1/kkl1eajvfQtkmPpBqbqkHPghzetd0VsN5x+BmwngMV9CVfWf5T0pz7CRQsfGihXriWm56Yp9Yd/hLxIupG3MuL7gjTGyJv/f5HbDN81j/x6GBt3R4qUdf8IFdFSmHB5ppFQpQF6MU7GMBcWjpRrisTx1dGiZuMBWjmV9l7qgyQFRcpfUhgwkq4/aXPoZ43ZVrZIcTFgBkXMQGi44ncXsZm4nGj0OMz47GeMFUb6ohkmeHe1XmeWdE3DuZfNuvazbs6F0XEnDwcVGON9RPOKMs0S7MCsfPmp/b6hT6+ejWT6/8e6jEdCbrfjIsUTnRc4cc9xCA1jxGCwdFoopmeLJzzH6W3VLq71oSiYKkwUz9U1L1UmT9JIQlsvgiakFQMmYWMcKTaZiEu9zc1Epk0EJq6C612qeLtClIEWpVKEDgR/1ftYsaaWHnYT+3cImkqgFfwZqpZoCRE8APRNysL7+HW31AX7oi1DSdTwNeN+DebdJUsk0z2k9Om8W8i+TOD3t231xYF1ErTnbbMUspyhSzjI7U6H5yKRpq5xt58v2EvwZMGKfClMSo8LfOm02YTwTMxbsfPxgy5Fvwr1yALRYmUjJFNM2frhIWYBJM2Oa2FMizQEXvqLG5NhhEeR xPN7NPoM lbKt4a+5Zf9KAef8GZmnFOBQmoZ++rn48kp9JU9MgQwXu2rR+/Q8BZxg+lfBILbZZoC1NcoqmRrnALTx70R7x//Gj2U/5En1ACujZBkGMA48uZNBXorLpVyjqo2cV4aIUWZWGRXEoOrqd8cK2+Pj1+6q7Cy3SjT+wyOdpeTuay+kUFdoRkRu/s7Xj31PcTzxPp9mWw395agLKqmwH3qwePaB3l6mFz67JecubiWWiime54YbXyEmOzkJ5KrOkwWMgaWIMNT5dx7PJb8kUzThed/opibUYPVECUFoNUmaDO7CMDsw1yWOHStIi+ZlxrNBX/IxChYBSRKwC5TtxJMrgntRY9eLUv4kviVsd7pGMK5Hbegem8mOl8/CStw== 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: 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(). Acked-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/kmsan.h | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 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..27db65fbf3f6 --- /dev/null +++ b/arch/s390/include/asm/kmsan.h @@ -0,0 +1,59 @@ +/* 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 (KMSAN_WARN_ON(is_lowcore_addr(addr))) + return NULL; + return kmsan_get_metadata(addr, is_origin); + } + return NULL; +} + +static inline bool kmsan_virt_addr_valid(void *addr) +{ + bool ret; + + /* + * pfn_valid() relies on RCU, and may call into the scheduler on exiting + * the critical section. However, this would result in recursion with + * KMSAN. Therefore, disable preemption here, and re-enable preemption + * below while suppressing reschedules to avoid recursion. + * + * Note, this sacrifices occasionally breaking scheduling guarantees. + * Although, a kernel compiled with KMSAN has already given up on any + * performance guarantees due to being heavily instrumented. + */ + preempt_disable(); + ret = virt_addr_valid(addr); + preempt_enable_no_resched(); + + return ret; +} + +#endif /* !MODULE */ + +#endif /* _ASM_S390_KMSAN_H */ From patchwork Fri Jun 21 00:25: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: 13706592 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 7E674C2BA18 for ; Fri, 21 Jun 2024 00:28:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 637198D010E; Thu, 20 Jun 2024 20:27:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5974C8D0108; Thu, 20 Jun 2024 20:27:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39BEE8D010E; Thu, 20 Jun 2024 20:27:23 -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 15BA68D0108 for ; Thu, 20 Jun 2024 20:27:23 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C82D6A06CA for ; Fri, 21 Jun 2024 00:27:22 +0000 (UTC) X-FDA: 82253006724.28.7772577 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf10.hostedemail.com (Postfix) with ESMTP id A11A4C0002 for ; Fri, 21 Jun 2024 00:27:20 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=nEk7JSnj; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf10.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=1718929633; a=rsa-sha256; cv=none; b=fD8gLNc82sOoej54yp5hX4L52WX899s0Syamu6nU4joa9zq+PKqb0HB5Irmnrm5i7m1DVe N5MCjfamo8+nvrdClKGaWtcY4wpQcaC8pjAC/kaYkGUVivpwKcuuq01TBc+7hMV6piWJoj X8csdVHLONeGiVW+izW6E/JhUf1XrhI= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=nEk7JSnj; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf10.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=1718929633; 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=IRZnfl5kegw9DdaMeWWbTwWzCErv31wkZ0fJjvxbgdM=; b=fvEV2BhtCV82Q5EokuHeCdLlIoxUFpn47bNJGQKDNN02bUSfYFD6KxBWejnXxXi59+YiIl jL7j0gAvMUMcjMrqLQYVSLaQamlF0jEzXiYTDmQ7YyVSX2R0R6h2rayKY+vo8QwIYUqnG4 8tPL1E1CQ9kbmsCH1JJrrEGphAytAoo= 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 45L0RFh6024999; Fri, 21 Jun 2024 00:27:15 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=IRZnfl5kegw9D daMeWWbTwWzCErv31wkZ0fJjvxbgdM=; b=nEk7JSnjyNbyb89aNlfwVZNDGNXud 7ClFQuT6mNwctBpZWjeFLkyhTG/Kg9y0k5ZRtRHDdfeeQB2Ja09/CX/ukSjP+7Uf WJPnYgVW7Uh46up7zx/9K3kcSjXSJ6A/voJelelh3Ha39zLzN36vGEJhcwMlCX/D 3NMaiV0ZsQnB+r0elDS1oK6tU8Si/qGN2hWjqsBTHvrwFj5auL6Lov/B6sh5n24o b/+MmEmZFAB6cgMZ0PLpa+rRrXNt1trwjt8GSVrlorUkWKimcdEklCMqZ9niiMFx oTeyR5LfX+A0PjEKP93Ysh1zyhTGIUCtHi+lC2gFozZiQMQUHNl2xe1iQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yvwpq85fr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:14 +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 45L0RE4B024983; Fri, 21 Jun 2024 00:27:14 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 3yvwpq85fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:14 +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 45KLf02F031380; Fri, 21 Jun 2024 00:27:13 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yvrrq2ne0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2024 00:27:13 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45L0R7eV55247218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 00:27:09 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8C402004E; Fri, 21 Jun 2024 00:27:07 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 881AD2004B; Fri, 21 Jun 2024 00:27:06 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.44]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2024 00:27:06 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v6 39/39] kmsan: Enable on s390 Date: Fri, 21 Jun 2024 02:25:13 +0200 Message-ID: <20240621002616.40684-40-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621002616.40684-1-iii@linux.ibm.com> References: <20240621002616.40684-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: PP4qwk9tQyN0OUNhProNnVvWgrOSmEgV X-Proofpoint-ORIG-GUID: 6m8QoD8TaCpte32SN6f3pDfGGHdINFD2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_11,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxlogscore=764 phishscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406210001 X-Rspamd-Queue-Id: A11A4C0002 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 793x874346tiw6zkpwk59px4byyemoey X-HE-Tag: 1718929640-216495 X-HE-Meta: U2FsdGVkX1+bQ38zWPYh7Q5cCWPap181Ucl8bnIY0S2iXYh92gELgIZCQ302/h8Qb1f6VVyOycHAU1HFE1MaGg/Mj19lMvEYyJxCxchscTrvOodkV38qUx33ckCGWXMwSxAn8tEJgyiW4TI6Mv+hXaP1VCxgM4zjOg2BUN6rv0VS4/2CPaMTho/m+A0k9pTCbDD6OzVnFI+x/Do6HSu67OZtN8ZaCXrfVqT36lyG+sNCiP9q1i5Q1KZPRLh2mLrNRSq/66LHpI4r6vPOLbyqdXLP6f8U+n7v6XGXlzN5UYgZW3nm03aKK94726zZaZg347dUCCJZgE2kp4FYFX4gENVm2GBLi5fNCNU1tKnpmJlvKpZIsNy6g9pe23mama5vq1rjAc3w03euJnf+5xnXKy5dyJwKYTo2LoPqLX6c0xAyCZWjmtLsvLJbk+4xxdU/2KM8kSrK5pqDS2QePmfXnqJJUV4v7vvICtg1Vr3TkOu2lJfWbvwaDtgy4NE+duTBOQ5nZNIZ3xPXq+D5nFMj7y1WtH2fSQVMSieyM8HoM6UpwEtr+z0Yim09N4DpZ02+hQ0p8tEP/LfjNVQB20pQkioRLRxTaZGDzKBNAm6n0id4lFzzfs5BboDFhtSkjx4mJMhz+XTcWo6QxAHoI3w+ySLeMLDPu4za/mvOsli+dAQ1V14Gbg0SgxT/uz79lsJ0VrWI76n/75hxD72CDRVai2Q9yewRIyB48hKt94gXsy7x88sBtL3HFov/s99Zup7AQpk5Z/wwJQ/gKjfbvvDOCzCoikQ7xALS5dINQym85t2swmMli2Jt/rOyhR8JYGovjgwIiCLPEkGWK0EwjqKbiyj0Dsowi+j0Q/v5sR5nVU82QSYE3IZaEuySvMF5eZtKEKWUSfAjkqEAN2Jyrj5raXP/lWvsnCK+t0q0v8evvQOSs4hsafTaP7sdtFE1MNzkvNmdFhMUB65Cn+ymO7W wtAtSORH jDy1oH3Ua4Iu3s6awrBOgbzgfMh8sx45zQs/dRxFlZpGS1nG8dY50uZTUgzgTnGQ+Jin9VTBWOpDDf9+5kSIAJAd3FaFOXtarMuqxk0Mu1AS5vwTbsELqBBkkZuyqKyA8SqxNNGVtXWnPAaqTAJwI2+4VkMEeOHTDftR3PUZVx0wEZq5yourHW5eSinZ5+9qHc0wsCpkur7i4B8m2v1w9Nqrm4Zu7gYqMR6onmQkZt2vkjnnbKaXjiJ/ehA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000706, 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 Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- 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