From patchwork Wed Nov 15 20:30:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457282 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 72834C2BB3F for ; Wed, 15 Nov 2023 20:34:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BB2C8002B; Wed, 15 Nov 2023 15:34:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1433F80022; Wed, 15 Nov 2023 15:34:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFE808002B; Wed, 15 Nov 2023 15:34:26 -0500 (EST) 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 D962080022 for ; Wed, 15 Nov 2023 15:34:26 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BBEFF140998 for ; Wed, 15 Nov 2023 20:34:26 +0000 (UTC) X-FDA: 81461341332.30.FD77DE3 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf09.hostedemail.com (Postfix) with ESMTP id 59B75140021 for ; Wed, 15 Nov 2023 20:34:23 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Wy5tAH2Y; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf09.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080463; 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=CZLHkQEJKjMWj9tFsHKzWIaMVL7MbTldFAitesNVJzU=; b=rorLtB4GFS3Uhq/7NQpYwp3TGF2aA3ugPuQaHkfFrzcXvHePA9uCB87qqzc+UMAdQWYZMy f8L+ZfIvzjJCFRA1VaU23jNviYns95VyPbtqT8TaCG3n9WppEokJboC7FZDUdGpPAvNb9i Y4BO1khOia2F9SgeCrmh8SEZ3ycLzp0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Wy5tAH2Y; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf09.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080463; a=rsa-sha256; cv=none; b=O/JwafNKGDyMS0pu0+YfhVEH5I4R+GaCXLdDhgfb76Ke8N92E8ojhWW8RUb9B0BGXqMeKx FbVQdnfL2M3TTt//ZqZgtKM3GGGoeVZJ850LdAtm3tsKI3XEoO+ini0d4aQvlM3jkb0mqf RdCjr2mIkheL0lytpoi18payhBCZlV0= Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKQiFh031245; Wed, 15 Nov 2023 20:34: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=CZLHkQEJKjMWj9tFsHKzWIaMVL7MbTldFAitesNVJzU=; b=Wy5tAH2Y0prkmcxdkPFFzA6XO9UYiRv5ordOcL4iAmCznlmr3BEiVssqTvvupHnuNj8c dKFWnlAxMwLnJCkVB6fn1PFWOR7/iHcnApou+y5k9mNyVm8mUc2hMImk08psZDf0unWQ bop5Gxplx76q4Xynt+1oN3O9VRd2ZSSgk7rp/A6hlghDqL8QbcwPLR7dko41RdzhlFhL kvk4H0RuXOFqpB4JoHYt/5F8vLpKeL0zMYNwv7FpSUNavhUsjM5frpDXO0OJVHpNp7Lv VyC6O4Qj+ns0qcd5iGPkgpDaNdsF5d9CGX+kR0EKbXPcVsVjiUBe4oBkeX+dsjr4wwp1 1g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4tk8fef-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:15 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKRO1n001546; Wed, 15 Nov 2023 20:34: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 3ud4tk8fdn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:14 +0000 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 3AFKIxY6014619; Wed, 15 Nov 2023 20:34:12 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvrd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:12 +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 3AFKY9l222348470 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:09 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BE1E20043; Wed, 15 Nov 2023 20:34:09 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 38AC620040; Wed, 15 Nov 2023 20:34:08 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:08 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 01/32] ftrace: Unpoison ftrace_regs in ftrace_ops_list_func() Date: Wed, 15 Nov 2023 21:30:33 +0100 Message-ID: <20231115203401.2495875-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: VJX97QA9qh-kHNZwqS0JJ63zRqdAobq3 X-Proofpoint-GUID: t5KbkiQ6ScFLylCeNY0jbVA7We_XpEup X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: 59B75140021 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 6xwiynpqemuokz7hdtzk8rpy1i3wf3zn X-HE-Tag: 1700080463-160613 X-HE-Meta: U2FsdGVkX1/E2BRwokdz5TRekAmPfVRAxfqkRgsdQQGpwi7RHLAnmLqvNpTerVD5Y0fUvXlV/7W+EJRhnp/7109iiQpOu9TdM4s6nUPWlyneqje+sVALZR1xUrQrIRe6JRZHz9+0FihuBA4u9c48gVd4vhUCDAwJ+1fLdS89w75QEJa2yKIY6s3+tTD0sIXgY7KlQjRZrmvEzw1S6EB/CyJn3kE3edWWtAyzrWvqx3rD0pAhT0B38hy6BNks+AqzQA5J30PRndysbdbLJIhlOUlFcxaRzzRMcixplhJyPg3qozEy9sVjB7Vkxn9ZncpZD7VZq0wkENMtCvK5L/DzJ5UzO9BgBkbjBlSF02mZt/vo0TnhyLgu+LMuaf/iJ7EZ2K2T28QODZBssUGyPQfn4jO5s4mV8TVIwBWQa/LQ73pH1TvX0GM90+0j1H8bFcfPO0dseSIxAnh0HGTSrUH8xda85lUjGk8rVsb1UoooWYJmA5+Sr8NlVonfRLh89St9QxClLZWn0O6Swh9SHU6/qOa+hh2l0kShF3E3Vy12Zy/d5tXxF/2CFNh3oZz9oC0hNvom6WhpJHi9QT4WxInHrEdRfWclNtfWE6Qhl+Tjz2yf1jCv1W45f71+kF46vpxPSzUUHR4+RtIB98uc0cRNVS02m47xgOTuU5jNUsbeD6d9bCbinYNrNdNM7umK9C33Z8X3tdDLTeto+4JieRj7gtj998tvBW83BrEjBlwagXJM/r6wXGuwZxXvj2hnQduAq1J9xhQPAUcKEGOzKHzPzH1YkZUbDPl8xMwLdUgFLjcYbcd3jyluzSDk6PWXSSI5afdEyJK0NSKmGbLpDt4yTqU7gumLnKy6T9ODET+LoBRLUpvLzAVSoFGZ5My85+vTPJ2LlTEOkyyOXedWm05LU/U9ei0m6iYuhfNa6cQZRRfDM8ljlvMqCycVrm48YDvFX5Xsc4NnPYghA0PYI8B 7tWVLsWO YxufE+q6Di9BZYDCC1rf+4a/rdNUgfZfA3xQN86SuMCbSgHih1f22TZTdfTq+si5OiPSVK26smf2MP/uCQt6971RE3bltjqCEW3T+aRh2bR34UWj0LsfW8D7bqrOE//oJqsMwiPcjYie8IcqzHLPyfjbl6wXVMtTgW+N1mOE8kZA4YRRZ+oxYmjtcskaw41RirDhvD5J5Kl9x/8ZV84lLdjHGfyah9TLMcNJKeFY2m8kwikvH+pc/OrZJX+VgYh0G9BgM 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. 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 8de8bec5f366..dfb8b26966aa 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -7399,6 +7399,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 Wed Nov 15 20:30:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457283 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 7C8F7C072A2 for ; Wed, 15 Nov 2023 20:34:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1B9B8002C; Wed, 15 Nov 2023 15:34:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B7CE980022; Wed, 15 Nov 2023 15:34:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9326D8002C; Wed, 15 Nov 2023 15:34:27 -0500 (EST) 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 6D66B80022 for ; Wed, 15 Nov 2023 15:34:27 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3F2F2A0972 for ; Wed, 15 Nov 2023 20:34:27 +0000 (UTC) X-FDA: 81461341374.27.6E95A29 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf06.hostedemail.com (Postfix) with ESMTP id D9C0018001A for ; Wed, 15 Nov 2023 20:34:24 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=lLa75Rz7; spf=pass (imf06.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080465; 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=ALe+orXRFp48K8J9UFekuIwy9fPV1PAP+S2ziEgYlpk=; b=jl2BIj19wfhnybeTT+wVvap8YFV7jJSbsk8yDF8NEs+TpDJviHkxczCNejA9tjYchEXZIy Z1PpoGMOuJNOPa752nj3Rws4gwUVl99v36UUi70d+3C/diQ1B/ZTJwfD+RN2u1hFl7AXUf pLE7nUcq4aTR2KB68+OO8sqMzY7P3wQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080465; a=rsa-sha256; cv=none; b=vWtee23HV/6caZc42rx4Lf3hiwL/6r0rBm8wR/nBE2/9ZCNFIHqgrL98o+WvuSrOtB56hC GdAvQRbTf8qYUZzFzxPQAChwXP1UPKY3qrDvvNJfdhOZdjZjeitv/wFErILsoxSs6qkJI2 ImFIYtlUglL53i0C4AqbMEbG+x1dBY8= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=lLa75Rz7; spf=pass (imf06.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKQk3k031373; Wed, 15 Nov 2023 20:34:17 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=ALe+orXRFp48K8J9UFekuIwy9fPV1PAP+S2ziEgYlpk=; b=lLa75Rz7SHDva/Y233ebGR0kBcbg8raDcle35V3naRto+dRymq9Ye3Vin6glSxdq+LyB xP3fFHVwzGP2WrpDLC9dY3nrBMcFkqldW8/yXHjnjgvZ/XHszMt11AqvsYgicw2W/Kxl ETLdOTr2JFCV5Ye8UNShOEBNZwTI3KGD950EUXq3iFBaTYN+1jeZvmkevl/OVl9WH0e7 /uc2sucHgE3Ze+0bSdD6t++UMPW8QXtdHVI6CNaBiRF9+zLwpFyAptJ4TJJYGwUIjz8M JJVEP2+4SfQqeBVZ/Vc5JDxMJ6ouLia5AkWERgkO/fSg9bYJevmIx/EucZ93bbzCkIjc Jg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4tk8ffh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:17 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKQrZH032053; Wed, 15 Nov 2023 20:34:16 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 3ud4tk8fer-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:16 +0000 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 3AFKIvbd015477; Wed, 15 Nov 2023 20:34:14 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamxnj0hr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:14 +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 3AFKYBkA20447746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:11 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A2772004D; Wed, 15 Nov 2023 20:34:11 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3EC0620040; Wed, 15 Nov 2023 20:34:10 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:10 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 02/32] kmsan: Make the tests compatible with kmsan.panic=1 Date: Wed, 15 Nov 2023 21:30:34 +0100 Message-ID: <20231115203401.2495875-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: o7Re1uLxrmfZ98PzFum0KnGUcltBzKIe X-Proofpoint-GUID: hXQ9t0DNpe_h30_zYtji1RDR8Sah29gx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Stat-Signature: zjsq9iqw84k93deiiwaijxdoddnydcu5 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: D9C0018001A X-Rspam-User: X-HE-Tag: 1700080464-360394 X-HE-Meta: U2FsdGVkX18Ok5kHtHc8vsH9TSSdYVXBok7X7Hl6Pptm72lM/LMVR76zmdvtOG0p1PEReFJzB8DQIJDvgADU3/35cdrhYFpUya7Ooc5m0Hor7qZlF5aYhTx8FfJdNxIPq4bM1f43oMKe1gzdn25Lw6YUfSc3ZFczIoRdnch02fvs2i4mYGEC8TSxmFqCfEsf2pvpNnlGfaWvuxM3NivcfUQMIBCzjZfxT+qAj1Vu3duTlZ8sdQ0cGdfgdoz7wrOTZTSTUZ9clozezOW2RBCGSgLfzDqsK6oRQ5HeWK6qpaIEgWEMj8tNvWqwJ8w4nfBVyAO6G5MvR5u5unDzpd3kM/cn9GhCZS07zJkbWwXrxNxJzXYwOuFWdTwRKrAan5RtUywKIjFkB9f4ST7W2lZltmple03ieVGF+0cdMO7kVU7OgjSf0bz+D938s+iqdqc4+ZHLLntxwFYX6aPoFtQROD8fjOiEbjVFrR9cY5tFQKVCgOWWfyhDv22WWXVncev0ECz4Oq6Bg/u4v5FGa4E88qA7kZ7IOzNuvcdxPCjOT1VSIjmf1JyjTou3Hs4Wue2OXK4GqoMB0UL8LcI6mlBBaE/PU0JkRtcYmovq7GcggKtVB2n0fYCktwVeg+d1JZWcjia+WX665JuXLav2CXHI5ZzAbRY9tRC4MiKLC3NFopqxdIqdJwgV3/ZjPKPxe9fnUtPOYtuXTGfKp1HJ1as6e9y3HzK3Uf4FTwZG2B0cYFCNRL9kBfu9okn2IA0AJJZB0M2FVbRy9JuI18p8w6R6g8+9ot0qAueUVk3rkuPLFjBmDOz7NrDsQAYRf6/Au4azuJZb2+Hn33Kems3iq8Zy+PsIbW30XOLFaCh0jYhzjp9xiEE5EbLq9xVgiek7t6TSQR7nBQVv+dvhgTZKWs4sjpKxPmaMILUMx2MPXyzyAZ3bX9s6ZAvZKnJHbCq1pUahD3GsNphTk43U95EDOrR klCNdevw WIwTIQGvuvDLEpxJ94LqzvLbDweO1VcW9OFlj35BSDn35Ap1AVZSqKbcXahZ4C8cgoWcc+LyNQm92gThyTAzRp9rs300ZPLENmzxDG49a4XYAf/tKNuy6hlDX5CLrXrBerp1m0sBRIP/PpNDYKHJRjHJTBM+/OhRaeqDkiLxbeDpDPbACkkGqXflnJl1sbedeX3R8RnvUgPefxEij2Z/KmSnryA== 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: 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. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- 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 Wed Nov 15 20:30:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457284 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 9FD3CC2BB3F for ; Wed, 15 Nov 2023 20:34:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF4838002D; Wed, 15 Nov 2023 15:34:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D794180022; Wed, 15 Nov 2023 15:34:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B56888002D; Wed, 15 Nov 2023 15:34:29 -0500 (EST) 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 9A8B680022 for ; Wed, 15 Nov 2023 15:34:29 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6BB2A140998 for ; Wed, 15 Nov 2023 20:34:29 +0000 (UTC) X-FDA: 81461341458.07.285D1D0 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf30.hostedemail.com (Postfix) with ESMTP id 1AE0280003 for ; Wed, 15 Nov 2023 20:34:26 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=XJj4gqRK; spf=pass (imf30.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=1700080467; 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=/jeu8ikBdkG3zT8cTTXDudBR3p8yyOmYypD5+KnSOCc=; b=fG0GlUrrNDeVkhQO/AeI6dYkPuJF6ERYLbWSbhmIXEbtJQxrRBeNxSTSUCJ/q1f9ncnHgx SfRcl4Gca96p3W1nQz99RX0wN2nA9dHoJgXbRbEPUBQE+W6aLu2KrE25skLqejhMB7r9YT 46hDMbgT/nw7jonmwkLUEgsgBXUTBBg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080467; a=rsa-sha256; cv=none; b=TfWc9R0p/QWwSQUUlr2StU/2Q1rY32J/duTpwLUsyxgDCZdN2rPrNETU1KJ04zIu3UgC+y FkPb5i9gLyjXkHETh41ANVlRbH7QOV+Xmt3q6YTd5KYateCK1bXC022FD3XKGp1w1bPPtO pS9gXqJw2fZCYYYdM/5UWcyxaW5ZGQw= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=XJj4gqRK; spf=pass (imf30.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.17.1.19/8.17.1.19) with ESMTP id 3AFKCEbw020024; Wed, 15 Nov 2023 20:34:20 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=/jeu8ikBdkG3zT8cTTXDudBR3p8yyOmYypD5+KnSOCc=; b=XJj4gqRKmolO6HaPwamZIPxiW7a94DubZ3Lh4Zo3ERklwMevuk9M6ZdOd0MqGJlJ8zOY ILwoxdECXoBgf0MIp+j7SFeO8MAC+ZwSHAuC8bFhucruxiW1t2O8mGBZ7lCS8wvjmNTG ZnLMcpG3px8DPkwcMgVnK+gQwRM5b86Q5Z6ho2/jN/xnDebeNFcbE9uYAEvcsuTOjiqC TImOzxLm8zqUFIuMYwclvIOrbo25ssWXv0fAvlq9A/bgYXB3BPJVSzZ8TYP1Y38oF8eE j1eX7rAEskNY8O7ms8SXmF+6uko9S+a34cqDzepPYk5VYN0DzCU9gUFcA3c+cZhFP2fF YQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4thgjvk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:20 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKCaZt021252; Wed, 15 Nov 2023 20:34:19 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 3ud4thgjv4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:19 +0000 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 3AFKIxFi024837; Wed, 15 Nov 2023 20:34:18 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uapn1sj4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:18 +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 3AFKYFGK28639744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:15 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A8DD20040; Wed, 15 Nov 2023 20:34:15 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E4C8120043; Wed, 15 Nov 2023 20:34:13 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:13 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 04/32] kmsan: Increase the maximum store size to 4096 Date: Wed, 15 Nov 2023 21:30:36 +0100 Message-ID: <20231115203401.2495875-5-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: iSRl1qDbw0UxpkQf1oYEu1Z8v5dlxZV_ X-Proofpoint-ORIG-GUID: 2IYbA0_0cM-XcK8HWULf9sl6eCYS08q2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 adultscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=693 clxscore=1015 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: 1AE0280003 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: p1i4y67b3d3pahwpc1dt5s6rrhz9cs9m X-HE-Tag: 1700080466-428961 X-HE-Meta: U2FsdGVkX19VocjlJ4kq6xBh4eRbK69dBrobOf0pA6GQYoSlWpUWx/ZmJPyB9fhfzNHIcg8qEtH/kdVvSu4ewtPj452X++gXXB8narDp+vuG+oqeYgSf73Dn3KNtnHvcxABZgeVZGp9B+xrIw7a1hPPTQgJ7isV4/TGpulKAG99SbFUNAD7TFeGoBTRnYgA0XKpZtNLkOL6wXCOu0eIch5IFzaM7RkW8LrV5aHFS3VGeJPqq157uH87nGo4YaPHa3/ASOQj37RGRESaGJLLfQd+B22baO+/SdklFs7BtDgEoJq8DwbN3njp+iH3wHu1SYKSWPcEPmKCR2ZFl3xryx4+VXVVPDl6HYkVQYcSjbIiKvYwLRozpdijcjD7bgDQ7PRDxNHjcVMqlrB2EFb9Tk6UmmpHlsxvlV/ol0ia2DOYAWDqQfnRSfl3mWMAA26OsL3XJlSOt05MFZhalDwTbX3Rvv5n7k33qM3WNBHOKVbLvZIlg+lySoOE2sWFTb8CXCiXrfZA/WtfL8ZYB6P93ub4eEQM1mYveQQ6iaJ5RSY7Eot/FsrwogytpnTfpL7syyF2LPAEvy1Vx+yqt0aLH9zPLi9t2Ufo2w7SVIEnv2WCCrjbWww8Nzi3ONZH8O58CqpCTEpFNx3mkoB+pqCQbwLxMwY1ZJerwV6PD00iYxtM7jgAY+c2yH+2M6bAMti6TtwgokyLIabwLlp6ZfZj00eOZ1x4sNUue6cLtNevxT89GAczSuzkPWriowN9lyNgfwl+AGl3brAx95YkcJiyzVtEk1+9X7krMGCCuDPKVBFqw/yYio2RxihhRzTETB1kYLNCyGfSwivdPF35/92wMh6iv21ef+u5hY1A9PObib3xfWhp111bvmWWgbsWhewGu23exC59U/SY4FEsSZsHJJg/e2/jEU83J9ku4x3AKk/IUpJVM4aVmCl5f/7dnzo3lXh6jS/RbQyNKzY/QpAZ QSUcmVLk 1UsKf97sORhUspkWXJg7q8JUldgmEXdi6SxYfPRYazqfCUw3fsNu8oKIEixWfhyhPE62zj1AYW6+8zFAhUWGYZgi9XCp0PnRsVQkSpfOR3+UCAsrNnxZzw40Vm1f1k8wtfo2OcjN1vtnf07MX75KS4/zD8jkJCFPKK3UHvXU2chGFp838YEcJF7O/wj7o4L7UxeqdjNPe34vvME/arWc2AI+d09DN+JjZRDRBVMbWFkdS5+gvAZap4XNZWaLvzCS1oeUOhEkIzltk1SKbb9dnT4epMd0hnQpDMQ7jvFl4PFJn1lbUsG2V3INr9HSE2EQu9ZEWKWASFKaeWd4= 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: The inline assembly block in s390's chsc() stores that much. 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 Wed Nov 15 20:30:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457285 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 0CF81C54FB9 for ; Wed, 15 Nov 2023 20:34:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 20A418002E; Wed, 15 Nov 2023 15:34:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 170DF80022; Wed, 15 Nov 2023 15:34:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F02D68002E; Wed, 15 Nov 2023 15:34:31 -0500 (EST) 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 D369A80022 for ; Wed, 15 Nov 2023 15:34:31 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A4468C06FD for ; Wed, 15 Nov 2023 20:34:31 +0000 (UTC) X-FDA: 81461341542.18.B531BF6 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf11.hostedemail.com (Postfix) with ESMTP id 5240140004 for ; Wed, 15 Nov 2023 20:34:29 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=dg4iR7AS; spf=pass (imf11.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080469; 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=VZEQ7DLTQn6OqQgSLo67A6SEZnv9L1qroObhIZ1xXOM=; b=vad/xIgbFkq3dpUDO7j0bP2CxBXriD15C8/5yoWYdzR4yuIx4t9SvI2IBHLspAYkPJiwIl Y3XXBIA5qR/zBzhF1iLG8HxB/hAEIr5wdG5MyMViI31TeSaEH2L3Yjt2/6VPgEVPLSgw7g vx4cXLeq/VnFgGdAjNpTVJ6JSxcC2tQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080469; a=rsa-sha256; cv=none; b=G1Ly2YzfaqA77RtcMvQuaibbFKjJ3Gv21KxUuCNHIwYTje9q2Bu/li1NvpkrTDu5+gh98v EzAQZpiYVWBbQQY5pkOqkTBhvKk1TBE4X74Oe2WQIPP9uVSPgd6q5gJImZiAiwaUay49zy hX+KsK62CsJ9K11fTNzC71lBXdeogLI= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=dg4iR7AS; spf=pass (imf11.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKRRsu004222; Wed, 15 Nov 2023 20:34:22 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=VZEQ7DLTQn6OqQgSLo67A6SEZnv9L1qroObhIZ1xXOM=; b=dg4iR7ASsjMcFxTDwjvCYLnHoVuy1Qfbro7WxLkmXAFPDzrHl4ABKsqJoFUHCQN13fNa 4crhrvYNsY5a5gNUgvU3Q80SlojQtneGOttjR9TnyVOn3GW0/RjYP4rSANttgOSDhJN5 zPM9wHYUrV9roCYmfAa2gHVV+qtuC/UpngdSdmvvL7tYZ42/WH605LRUeEWyTewBxdUh 5OZtujcbrRbCp1vp0JJKB86UoMmJPdc03HVO3vQOoIHf+HULGzOSuv7XlykNVMSmEltT 4hlHpsaQAbXZOA0NP+ZGG6Aajc4AetjSLwVSxETpQUHNtWWMOaPbQQf0yozllcU4mkys rw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud51q05rc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:22 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKTACg008842; Wed, 15 Nov 2023 20:34:21 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 3ud51q05r1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:21 +0000 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 3AFKIuv7014594; Wed, 15 Nov 2023 20:34:20 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:20 +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 3AFKYHqG45417192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:17 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09B5420043; Wed, 15 Nov 2023 20:34:17 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B202D20040; Wed, 15 Nov 2023 20:34:15 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:15 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 05/32] kmsan: Fix is_bad_asm_addr() on arches with overlapping address spaces Date: Wed, 15 Nov 2023 21:30:37 +0100 Message-ID: <20231115203401.2495875-6-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: NSV7ecFnmhdnhXadJujf6HXFiI7hMP7v X-Proofpoint-GUID: A_uHNzfE3lkD9p6tFW_ky0Alz8aTnTpa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 phishscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=922 mlxscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: 5240140004 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: sck1tu6i78q75j8gojwbmotn7jkdqs3b X-HE-Tag: 1700080469-784483 X-HE-Meta: U2FsdGVkX18IpQ/RlLnEHYMlCXtjLAjtszx/zTzwLw2CsKacrx4cJnw0fO/NpsDTpVRFXoKaqP2Czg2O+aFfTnNzCC8qL48CHwE79USyLZT7w/VTVtfSvqHv6MBC2tKt2Lkyz8HMmZeZRUxu74cUGVZQgoAoGDMV+o9fTB9KHu70W6szDZdatxR92szHdnBguVTHsERLu3B5QKCOKa8shIR4d+eq419g0d5OE5hmJOqJOcoKpP1MZzotE7kpnhmcUlI/Jb4Ps9ZHO2VA6PKV3dCIyrS3jPmEY9JcK5P5n70V6JR2fTX+UV2dQrfXa9IV+8hb6iMdM6QCAsx22iosN/8eKDFl14ceDZzJSfCQBQhpAs7Nlo23MY8pBu4iZ9Bt8DyCbIr+R36jA8f5KD1mYsppdj0rs7o+/9OPSPzFqkcq6vSlRrIHyBnTMdygxZ+OojmijaDHRtO0NLQmib05Z1365DCAHsjZX7dt8vy12Ljl1TNwmCW0tKTytww5RjIvxw76p2WPQaTSYY99fatmMj+qmfRb76Smu3SvgInuTz6M1jmNAOIjbg9cgtyBnQgjh7eTaylltBvPJi6xYqjTtxQkctmenScFgdDL8uR73CSchRnWOeXS9bxo6ydM+G7GyW9+pTA/Sgnwok4veBkZPriFl4IyS45TQDM8x4JwvC7/FjoHZsvUa+MceASq4OqXmnpXpRGH7PFGHJAG9K99y4nG/FKj0QwcRiITS4jarwsbd3A1dd86BBdtxfZyQzftg20Cx7L0Tua2iZRIjbMBiC4NxcDLTx5dWC6zPyBJwcLa/GPD2LUxg8tW49ir2arKqNW+WvfmZy4Ouixuv6Yw8cGTZyhOQKtf6qxhbLijsanUOl4jd0dYD2yJFWFPJFhRMUyv0LuILr5uHzF1sc0LBKiC/atMuW3f3RxVVPTeaYTzL8dCBqbjcuaQNnERr/nz23rK/nRuSpfZD4b+YJA faVzCReU 4+xUUGQZl/u+6spf1qdC7qXufi84s1I4nG2m0qelp1VMtTMFvvK6u577CRFgZV4P7ncz8d6VGYZDVpXODViKoPWGgTMcYBEsLPIQXgwA9MykjOj1eueEpPi8RvU6sxck6zo5RUySxJUR2IMmP0X+m1p0HzSeL0txv68vf6p78bYRod/cirf8xGGlLO5nF1otdn/R+43Q4ic4M5VKzEV/uN1r7mThJ9d4aPETauOKimmijMFW2oN+KQfanekDGwTAd+q/D 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: Comparing pointers with TASK_SIZE does not make sense when kernel and userspace overlap. Skip the comparison when this is the case. Signed-off-by: Ilya Leoshkevich --- mm/kmsan/instrumentation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/kmsan/instrumentation.c b/mm/kmsan/instrumentation.c index 470b0b4afcc4..8a1bbbc723ab 100644 --- a/mm/kmsan/instrumentation.c +++ b/mm/kmsan/instrumentation.c @@ -20,7 +20,8 @@ static inline bool is_bad_asm_addr(void *addr, uintptr_t size, bool is_store) { - if ((u64)addr < TASK_SIZE) + if (IS_ENABLED(CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE) && + (u64)addr < TASK_SIZE) return true; if (!kmsan_get_metadata(addr, KMSAN_META_SHADOW)) return true; From patchwork Wed Nov 15 20:30:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457286 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 5D00CC2BB3F for ; Wed, 15 Nov 2023 20:34:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 983828002F; Wed, 15 Nov 2023 15:34:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BDFF80022; Wed, 15 Nov 2023 15:34:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C4A08002F; Wed, 15 Nov 2023 15:34:33 -0500 (EST) 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 551C380022 for ; Wed, 15 Nov 2023 15:34:33 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 120BA1A0AB9 for ; Wed, 15 Nov 2023 20:34:33 +0000 (UTC) X-FDA: 81461341626.03.BD74A3D Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf25.hostedemail.com (Postfix) with ESMTP id A6F6EA0019 for ; Wed, 15 Nov 2023 20:34:30 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=EmWgrT7y; 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; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080470; a=rsa-sha256; cv=none; b=3xDzto7RVTXGvkVU6/uon5Y83WZj/seFlSW+D608aKaeEOmh5dq9NRtsa4jcOOuYF132C1 D7EhWvkewGiT1k70V0OMGuX/L/nS5SfQK6rOlns/9QdjQsNrSjfC7LBlOZwBcFn0RicQi4 234Ln888Cfe8j4kHR4rE1E69QuXUewQ= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=EmWgrT7y; 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; 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=1700080470; 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=Px0rK9+UdAvKZPZ7DYl+Y7dmIAhcf5TJsq/L/AiJTMo=; b=4rSbmp52s8oQDCUXTNRlipGeB+U/IZ8M6xRB7HQNyzIrwRDxdlc91P2nQah1jzqiE1TKd9 h33HGFDy9gAu20p57LWAE3jG9tsJeWOsMR5vc+ZQJMyhn69cD+E/e50Ko8ZeVWMcHESnKh A1Ae5A7rM9KzxiYUEJu49Ie0AdEe/R8= Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKWs2S030886; Wed, 15 Nov 2023 20:34:24 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=Px0rK9+UdAvKZPZ7DYl+Y7dmIAhcf5TJsq/L/AiJTMo=; b=EmWgrT7y4bMRo/sPUnhX4XtYy0HE7VGWic6ewv8F+nIInGCMDVODOsHwEs/4+jYERfGD mNMCvEtmuY/wkeulBcAGRaqup6FdOY8nwc2So/fn74OFnsiFoipXKm4aWXlrxoIDCQGY OLBnfX9wES6plwqEbQpW5e29MhqzRxlpEQWUOfVFOR+LcxJZ9HoVggn4UlN7YnQicuik pDmQonoxFSuhsKEtKKrYDq7PHjX7L98Yyo9B74OzpMrmcyjkfOR2W8T6QeVxzbDytpXC lNHu7/OZESxHt7BIJokFXszmH3l36HO/HwADXxyRsg6wgRhwyRWt1/wfbxMBla7ckFMj VQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud543g162-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:24 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKWsDX030885; Wed, 15 Nov 2023 20:34:23 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 3ud543g156-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:23 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKIxCd017495; Wed, 15 Nov 2023 20:34:22 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamayj78r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:21 +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 3AFKYIKS22938342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:18 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C150F20043; Wed, 15 Nov 2023 20:34:18 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76AD320040; Wed, 15 Nov 2023 20:34:17 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:17 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 06/32] kmsan: Fix kmsan_copy_to_user() on arches with overlapping address spaces Date: Wed, 15 Nov 2023 21:30:38 +0100 Message-ID: <20231115203401.2495875-7-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: HD7io_J1O9IEJux-CMEYdG8MJqs-tACj X-Proofpoint-GUID: zQLNbotbJOONuucBdc1_g_GKmcQkwnzj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 mlxlogscore=761 bulkscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A6F6EA0019 X-Stat-Signature: aoapjbyrgshxygp1k1imy7c9tqhwa7zt X-Rspam-User: X-HE-Tag: 1700080470-547429 X-HE-Meta: U2FsdGVkX18uFH28/yMzRklroCr88IqxHotSRdxxgKSDXQHP+D7bGvIPoTBYbJqh0lz0NpILEfZsWw2AthldxdyILlHjDrcgXr4Gb4o9sKaE4H369ushEj1tJ/q8zF3RglrUC3KGfvaChIXMkSLPLJHYKVv3C1Tx8xxX29r+EGVXbCoQQOUs9I6ZjWifEfzV0f8ZKdFZ0Z8P0m8OjJ3Q1/irpU4q5RTUeGPYx03F2R4uC0RpTKheEBLbxkeeqWXQhAmOSdO0WKVQ6RN/+4BMOMKJ9RSoIpcDAaBhw3yqgfzqeHYMsUVSd+EwA1yCTyF5DukZoD/3gQMbSQmekpuH8w6PgnT9G/iVtS/L2RTAI0p6FsjEYiVSl5IB18n3EDnw8jdgBPdbxC9gnwe6ZKdeBMS5ONBBwNnpjDXXij3S8yE0gY2tPQ14MarNhj5lWqy7zxr5jiZ1igi8sMmrFb9zv3Xo34ysE5M1INwA3NgsI4/bPC2saKk0zArh2o4j2PbpHKX8GCi2Afhc5aiwdiHZ9oJ8shpB/rKBTfSP0zHBvgqOJztr7eGbkqWRgHQSQIkFcQRuSt1Ail1Kmrin3AzfmhkPmHo+5bbLzdyeENQJpcs1PYrWByZOutFLzSdjzpJfOOxfRS/uFm4ZozeAO2jS5IlEI6mK4scgn4u2LWPqOLCUSygHhRwzqjAu2vnOOZRJP82yBmi0GERIPhg75Mq1MB0oaIY0dKUBxF09LQoacK8q1uEQm/teiGKLfk0ifMElKepHKmVggLyqWBZVsIGi92ub06BynSvXw0bF/oQ+29kDpY3hiuX8bDP90jX48gonPGQkawphUUDI2UciENOvzuJLXfT4++VxRYABs1KzfujkIyqoLS0gBYMShgCO5WzdthoyDNsDl7llRqK8M4lMzR3VxmXpafiEeMuV0CySLW5LCAX2lWhSbH7jb+dtjJ5D3IbrVoXxNsWeTMPvoE7 uRRu/gDS 9wH++IngO95nOH5i2nyJEX2Fut9FhO3tUVlhU+WlRQXOI5mDd9cstdU3OaxnZ3moBBy61bwm0LkmqycjClVj4ssnQaxq/6XO3HiSYTNxesJcRjMpT0nxebqe8InZLHcP1CdiCuvYQszit0fjNiJ6fw1vauvFclz5HWssUY35n6FcRIdJhmBOmhOtCVz0UBZ5e1UEmqy+eJFdb3bB42vGAMf8Wd64KlxezRJ+SLSYJA7ObkmyFFq97VNiYa/X/VCYU2W8r 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: Comparing pointers with TASK_SIZE does not make sense when kernel and userspace overlap. Assume that we are handling user memory access in this case. Reported-by: Alexander Gordeev Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- mm/kmsan/hooks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index 5d6e2dee5692..eafc45f937eb 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -267,7 +267,8 @@ void kmsan_copy_to_user(void __user *to, const void *from, size_t to_copy, return; ua_flags = user_access_save(); - if ((u64)to < TASK_SIZE) { + if (!IS_ENABLED(CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE) || + (u64)to < TASK_SIZE) { /* This is a user memory access, check it. */ kmsan_internal_check_memory((void *)from, to_copy - left, to, REASON_COPY_TO_USER); From patchwork Wed Nov 15 20:30:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457287 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 135C3C2BB3F for ; Wed, 15 Nov 2023 20:34:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B32CD80030; Wed, 15 Nov 2023 15:34:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AB96380022; Wed, 15 Nov 2023 15:34:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E65080030; Wed, 15 Nov 2023 15:34:36 -0500 (EST) 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 7898D80022 for ; Wed, 15 Nov 2023 15:34:36 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4938340B46 for ; Wed, 15 Nov 2023 20:34:36 +0000 (UTC) X-FDA: 81461341752.07.FCFEF2E Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf06.hostedemail.com (Postfix) with ESMTP id 1BE7218000E for ; Wed, 15 Nov 2023 20:34:33 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=JKsnlmqY; 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=1700080474; 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=mBEHNMnK5aXgU11e7B7vZsvrm9vZAb+q2WVIriQE/Yo=; b=lSYMYXszAZVPmxWcpy9I1LPeUqBCG8U8jEcRl8TmG5zoI5zasCdU5+khAPc9dEaT/IiRUR 0Hw8+Z6Act7Lu6Ta35JIvOIA7TTQJZr9C5iWHBpFXICu5WmW7Uk6VJLpzOnLw1Mw8JHcTV lTP3d2ecbpwwiAOwb//6xl2N7g6ng4A= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=JKsnlmqY; 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=1700080474; a=rsa-sha256; cv=none; b=PNaOl2j+bL+BUPau/sg+jfdLSWdr04An+iurL3TrD3XaQqe04BlAezBfZPiFbTAz17bgn2 utqTSd8mE5M5GVLCoQQZ/FSqfuZFFdpHQyLESXQOz5WFltEpLWVLERBEUXNE8Njs3butK5 quufaJR0/BTK0GFB+QTRDclBV6SEDFg= Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKFcUi004338; Wed, 15 Nov 2023 20:34:27 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=mBEHNMnK5aXgU11e7B7vZsvrm9vZAb+q2WVIriQE/Yo=; b=JKsnlmqYZGSFrgMSa8GXAbmayKJaXHgH55VLFtapzCOHfq0h+7IRk/iDmFHU//7RGif+ g+6XQmmnoxo+roDOupkc/AS6g12wyMWoqzylR8N5CfuZiVRJc++TWKz4O9eoAaFYUdKo e2SIkZN3I0IDOMcOwWPmSAurs/6bfolEy+2fA9FQGCM/9s0cCYoT+65tohInlaRWb6TB kB/EhGm2BDEzfNXGbM1bR6g8OtRAvBz17bCOUJLqO1D6ohxJ7Qb2lOprdH8W6keVQKCB yJYomRUggb3qnHjW9+lNbhkxE6d0GUBSkkooSMIi6/l2rhXRCsPG23vgBKm89fw5n+45 sw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v30cj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:27 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKQKK8001965; Wed, 15 Nov 2023 20:34:26 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 3ud4v30chr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:26 +0000 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 3AFKIuc7014591; Wed, 15 Nov 2023 20:34:25 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvs6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:25 +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 3AFKYMHI28639758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:22 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 496D420043; Wed, 15 Nov 2023 20:34:22 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E63E420040; Wed, 15 Nov 2023 20:34:20 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:20 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich , Heiko Carstens Subject: [PATCH 08/32] kmsan: Remove an x86-specific #include from kmsan.h Date: Wed, 15 Nov 2023 21:30:40 +0100 Message-ID: <20231115203401.2495875-9-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8cX32G095gCIm8Y6i1Z-p6hF-gO7JK8X X-Proofpoint-ORIG-GUID: 6fvVE8Mcwxt4i9yfIY7fICgUPY6nXNrE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 bulkscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 1BE7218000E X-Stat-Signature: oauf5xxmubnm9o9mkze77zsi81cfm8rp X-Rspam-User: X-HE-Tag: 1700080473-52038 X-HE-Meta: U2FsdGVkX18VpkyIBbRppqjHgNnDD8AS9/Ns8gmdG6nzxwgMhzesDbderZwT66/BbtAcqBRBlKeGfJ7POr3OH/4+245CwnylxpXYh+unpOd94Fb5n35Ei2wPpQ31/XTc/FvjlWY5JuEzrexdyc3BRbAuSbup8TMC5YoU45X6Pyu8brbmL5qFxABCn9G3lneZO+uuFjCyddZxxOBkLtt6uq87A3xh2QB5Ie/vkCy90xkZnTmFdikdgRMAeKQO5fBxJbOmy7znGd6NTtfnJW2yxUYDNNIUv7p14ifaTEiOpW/eQdKAbFOB0iZ1t/Giug45bszDOO3r9kufLpM85WqmfsD4LbdlFffAwk4b95XUeTDk0Q+6vbSSGxrKraJz/S3H/XxLaLXYhquHJZ00iXTSmwTNAsOpk7GoJvVNAZANSpstLzSjSzGPoVQ1D79SxYEecVCwpuM6eCRc/qVGopc+5TxFlNp+Try3coBXYbU9WOR6d91+LSdHf1mz0fRHnzDLTfK1fKR9eOBChjjnF7ndCENl5pLHUr8DjHhBXkL2a4iMApMPUSsFI3MjqDenX3Jk5pkjDJiMOFBHHKmJfdZEE4VazU/gf1+48KI//3/ZMDIdYKrUZpqqVVj96HPuT5vl+gf03xIaoTrt9LX4SoxdYfy/wsdatzGi38czE4wnRle7atflg/V8MktE5fOXsPmE3MXJtUSLcdB54SQQb/5/PiR2VhibHD47TgveHj3o8IB7HP9lOQ/9hrTtgmEWrqOHqGdMaeWnoA+bHgxNOcLMQJPHeus2hNFhrpqFGbv64AxugQWTM+D4QW0kFWwj9JwHDU/QjiuxtnpMmO+gpLXpNlOVRZRG/cvGrzH6/PyAJOKNS06KpOh1/C1/fRGE4IJuCUWswq1xGpmbdmyh0FOVaQ76PqpjiaDIdqyYW4CkhPLOEpzPZ0oSTvXnzPN4nQwuG+i9qj2g5pT36U+FEbD GJ6Jtucy bwmI4bj16WYjUB/N2epZzwPKhz1VoXMaM/B1yhpAuw3a1qFO4KZBffKcIFalKR4x7j9EqyMnZGBUZDCwIJVHUVUSu+DcMfAr5+uOK2MSPBXja6Hzqm6F9curOvCXRslyUZvXESHYPfbOLE8WIwPXBBbLHWS2D/3LQbDw9BnUAPT/0zQnX6K0onzakqzhS6qC8pY/+/3S9NZic4pQvMP+DX2yowSvdHYM8ZkAsoj+HkW/DfFeABoTDpKYzpOhkyeh7I036 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000165, 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. Fixes: f80be4571b19 ("kmsan: add KMSAN runtime core") Suggested-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- mm/kmsan/kmsan.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kmsan/kmsan.h b/mm/kmsan/kmsan.h index a14744205435..3c0476d8b765 100644 --- a/mm/kmsan/kmsan.h +++ b/mm/kmsan/kmsan.h @@ -10,7 +10,7 @@ #ifndef __MM_KMSAN_KMSAN_H #define __MM_KMSAN_KMSAN_H -#include +#include #include #include #include From patchwork Wed Nov 15 20:30:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457288 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 7BBF8C54FB9 for ; Wed, 15 Nov 2023 20:34:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6045480031; Wed, 15 Nov 2023 15:34:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5895180022; Wed, 15 Nov 2023 15:34:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3677480031; Wed, 15 Nov 2023 15:34:40 -0500 (EST) 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 1CF5980022 for ; Wed, 15 Nov 2023 15:34:40 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id F24C4160A98 for ; Wed, 15 Nov 2023 20:34:39 +0000 (UTC) X-FDA: 81461341878.28.48B004D Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf04.hostedemail.com (Postfix) with ESMTP id B0A5C40009 for ; Wed, 15 Nov 2023 20:34:37 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sw+mhheF; spf=pass (imf04.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=1700080477; 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=fibwjw/KiW5HEuIH+IZjTN+t/6WZNSSD23GOexOJS9o=; b=TfBj3B/bnQXUnjVjA5mt7VXF5BSfMyRXGk1iR8mdu2bl1bVfCnE35II+Xcvm9I04l/lIan IzZkyZDI4se4B7QLS18eIeEcKFLfhv/udprDJkDKnQUdt6IVzCH2lcO0oQ41dO9mMlBt3+ DlkzHRdWtSEvn77wshNLZ6QxO74+jgw= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sw+mhheF; spf=pass (imf04.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=1700080477; a=rsa-sha256; cv=none; b=j0n+kZmKag3QQIiMGFpjQwlp+dv+XyAUNIgGflm20IpVigLNpR5XeZikHdXBrQiMbXwLKs vUYtMAFMIHrVFxbQ6BcQpgwFGNAQKI3DvAl2skAbptzazFd1HSP3h7Ds0niBPy2z6b0mTN yVSXtPB6KQClEnVefveSboJkoSGs534= Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKTffZ023085; Wed, 15 Nov 2023 20:34:31 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=fibwjw/KiW5HEuIH+IZjTN+t/6WZNSSD23GOexOJS9o=; b=sw+mhheFpO546ZVxaJSKrJFRg8AXd4+11Wrj30ovKNZZ9E/Mu7g1CnCfgyHGLs+NYYle XorFNdTZ9SUMCEU8VpsYR1ey0KKHTaDYTG4SN1VBDulH0VKMS3vWqkIIlXo5HgQIBoc8 fOXPZpoe1cy+u+AQSnTgzPXfI9ye9fMcx6rt9RzoVUVVsZ9DfuWabDLTwgs/sBvLXBgh B7/z5ftBKwCTf5kRaAIE/2ZnsRDiiZq20CGcQ4O74RN7x8BzKeesw2LMMuDjMMi5MgAd EcK84wvyaIgl23J/9XJuWY0dVIJwhPZ3HoJrya9pFVQSs4W+JHp19O8QHD2Wl6Sb98w7 Ug== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud52r847x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:30 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKU8lq025130; Wed, 15 Nov 2023 20:34: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 3ud52r847e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:30 +0000 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 3AFKIvA5015481; Wed, 15 Nov 2023 20:34:29 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamxnj0jn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:28 +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 3AFKYPUT20906506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:25 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B405D20043; Wed, 15 Nov 2023 20:34:25 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6847620040; Wed, 15 Nov 2023 20:34:24 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:24 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 10/32] kmsan: Expose kmsan_get_metadata() Date: Wed, 15 Nov 2023 21:30:42 +0100 Message-ID: <20231115203401.2495875-11-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: F7flrmLyXJJJAcGqET6C8qzUnTyLkokl X-Proofpoint-ORIG-GUID: g1up5JlfCWsuRUJ_ZeEJ6SY9HrOevKDS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 phishscore=0 spamscore=0 mlxlogscore=864 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: B0A5C40009 X-Rspam-User: X-Stat-Signature: 7jpxczxm7apk8hz7uwuq8u7jiauxbn1x X-Rspamd-Server: rspam01 X-HE-Tag: 1700080477-289350 X-HE-Meta: U2FsdGVkX184wM9JxIrzma8GT4fOp3lH0/9jUVV6jugO5bdvAF8VcgWv7JHI2T/o0G5qQSvwNlCoEaA5McL8QEYyHb5PKsO/oQQerbLrkQH8BgqjYMTR4in9+GUzUSOxM4nSJQ/0yjAEZWsCEc8azB2tWe7AlZL7PK0CMSlJjuh4iMlTuDOaLrF6GOr3ayyfNlT6SCsGFvk/E1KMsQiCEPRiaAVVsmKI+CkKcwQcvimI201a88OvmXr5gy5ZVAa+BaQlIrr5dAICgsb9xkbRjpoYa3s4dXeWMxNPoI9LABgYa68d4UXV4ZQdMMELNKR85VVO0YWcOpce5XCQL76KSY8pXGgu0kzCpJMcWFSEuUHHaWmLEqUrkbfyM01Madr02ropEsa6V6h1S4NcqHd39LdpX8fHTHqlVl4P3qvvXapbwViTFjcqol1cvAGjQFmnWi0NCTUfXjJtbzjSy/i6Q2mYtAEQaLQ9GzE8/s8FelZ20YMST+zi8dru65YI5TIkyOuV83cmej3pIttPn8kQx2zSD7e7GOzGDm8ytdVhTvSxlTFvk8jrmUX5A/jS56ouHRfWZvvNO3NscPnx+UMbIXee+S1GNh2nLNqgNnNWDFkPrU+EavWb4gzEq191m18kiMLXQ9yTvdjbl7BNqauVo9I25SLD8pn+nHTfteUOeNFZL4iCGal+etF/uneziKEiirEoUp88HOv3jrbGqJBQWux4ZzLhGYf651SLh6l1SYjnDfV7Af+zqs/3BY4ZoO9OH/JS5PrlQQc5ZTDMCwhnjZzmWMKMMouDDS8HwWGzB0/W6VPd5H5zRrlD9IyDLaEBzO725OieE676/Cc0LebG3BbB4eR9QQbmLOfWZzx1fC37KOfGY7xi1/hXUSxeNETWyctfQ160KhztWHAYIJlUMQsQUTJCnf3Znh9NENKkPy2jQJ+22OhesRdfw5xiRV83ZSO/e26zSdZd81UdLTT ZWiPJdSG sMQdgOlj0Zmn/UoavCZiUIoszpOytv7P2zEcY2gVj+XlUJdDSox0t6gUuCDHBMWOjYjccgA4zqRV2R42FeHEpXtF/Ulk2ykqzMTf0B9CZlLqKWxoGDRvB5wawclZljpOIvf1bgwQN1VDg0g0GlULM//1osLuOdE0D7x4LJurH1KCyczL91RH/iSVht/L2RFHdURZyPtylLLl1bRI0CuL1xvEmwFaSlyhHeYa8cm6gYnFcJ6DYubQdKvSXEdmTMX2ZPL0tkzAnhwy70hQCRwXMAEBIv0Uz7xZqtEnEdFm26LLkm8w= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Each s390 CPU has lowcore pages associated with it. Each CPU sees its own lowcore at virtual address 0 through a hardware mechanism called prefixing. Additionally, all lowcores are mapped to non-0 virtual addresses stored in the lowcore_ptr[] array. When lowcore is accessed through virtual address 0, one needs to resolve metadata for lowcore_ptr[raw_smp_processor_id()]. Expose kmsan_get_metadata() to make it possible to do this from the arch code. Signed-off-by: Ilya Leoshkevich --- include/linux/kmsan.h | 14 ++++++++++++++ mm/kmsan/instrumentation.c | 1 + mm/kmsan/kmsan.h | 1 - 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/linux/kmsan.h b/include/linux/kmsan.h index e0c23a32cdf0..ff8fd95733fa 100644 --- a/include/linux/kmsan.h +++ b/include/linux/kmsan.h @@ -230,6 +230,15 @@ void kmsan_handle_urb(const struct urb *urb, bool is_out); */ void kmsan_unpoison_entry_regs(const struct pt_regs *regs); +/** + * kmsan_get_metadata() - Return a pointer to KMSAN shadow or origins. + * @addr: kernel address. + * @is_origin: whether to return origins or shadow. + * + * Return NULL if metadata cannot be found. + */ +void *kmsan_get_metadata(void *addr, bool is_origin); + #else static inline void kmsan_init_shadow(void) @@ -329,6 +338,11 @@ static inline void kmsan_unpoison_entry_regs(const struct pt_regs *regs) { } +static inline void *kmsan_get_metadata(void *addr, bool is_origin) +{ + return NULL; +} + #endif #endif /* _LINUX_KMSAN_H */ diff --git a/mm/kmsan/instrumentation.c b/mm/kmsan/instrumentation.c index 8a1bbbc723ab..94b49fac9d8b 100644 --- a/mm/kmsan/instrumentation.c +++ b/mm/kmsan/instrumentation.c @@ -14,6 +14,7 @@ #include "kmsan.h" #include +#include #include #include #include diff --git a/mm/kmsan/kmsan.h b/mm/kmsan/kmsan.h index 3c0476d8b765..2c743911a8c4 100644 --- a/mm/kmsan/kmsan.h +++ b/mm/kmsan/kmsan.h @@ -66,7 +66,6 @@ struct shadow_origin_ptr { struct shadow_origin_ptr kmsan_get_shadow_origin_ptr(void *addr, u64 size, bool store); -void *kmsan_get_metadata(void *addr, bool is_origin); void __init kmsan_init_alloc_meta_for_range(void *start, void *end); enum kmsan_bug_reason { From patchwork Wed Nov 15 20:30:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457391 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 5CC62C072A2 for ; Wed, 15 Nov 2023 21:35:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1B5E6B03CD; Wed, 15 Nov 2023 16:35:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BCB186B03CE; Wed, 15 Nov 2023 16:35:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6CC26B03CF; Wed, 15 Nov 2023 16:35:33 -0500 (EST) 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 9963B6B03CD for ; Wed, 15 Nov 2023 16:35:33 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 72DD5120529 for ; Wed, 15 Nov 2023 21:35:33 +0000 (UTC) X-FDA: 81461495346.17.EC82138 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf30.hostedemail.com (Postfix) with ESMTP id D62A48000B for ; Wed, 15 Nov 2023 21:35:30 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="Ax/r8INR"; spf=pass (imf30.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700084131; 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=MFebAvBrNyYRaTzmk1ztFiN5idJvQDPy2C+0jY17reo=; b=Vej/U9lDRWICH/FZgZTz+vhe5xHDbkUpnHf02ElaLUr/GU2kPwvSwyd3Dd7KfgOVvUKh0o YBm/RX+jfyiJ/aiSvzDQkffy1rXUUZjbMAW9B5H3z5B7XP1x4KFsmEaZtyy5+JN8NdMElm Ii9jIU6sNnzV8S1zbxn/3lJCzhYABVs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700084131; a=rsa-sha256; cv=none; b=2/lglZM+nLBkHKPL0KqkVcsv/78GYhhrUi9OtCDq5a/Pb+BByqlu47Rvwkq19trBJ+Gpi/ Va5geBTwTDCH7MaheZCRvegzeCLoLCyCWnnjhHekRMHwTfOs/D/JBsIQ2q7Sni8lErKE17 +L3pkcjE21ZwB+BNd3cRK3jTNAo9yYI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="Ax/r8INR"; spf=pass (imf30.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKJZYl002178; Wed, 15 Nov 2023 20:34: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=MFebAvBrNyYRaTzmk1ztFiN5idJvQDPy2C+0jY17reo=; b=Ax/r8INR4tPogmAiQzhyWtcfKBmxQVy+uab4FoTY5WC5CL2m+NBu+cLDz1LWvMt4Wziv GTUcu/CM7Z6uUI2xPbKs6a0kkMCNRaND8AoeYVXnriwu134sdP8fUBpJCNtHnA1160WY DqKyuHHJjg6LJefnlJOxqq75wbT2qZztjGg+LRnz2ONou0BhoF6qdj7pxSGgSlOf8F3s x4Bpl6WSzd3ZHLMaAW6jbXIw21l3NZCFikG+NGvuKaQEdY3Uf1LWA9R7FNp5vcoFpAVi DCClHYUOFku8l1x0OZzaz8nrZZRVrTR6Fz/pfVEYCZ5XE6voXusNcYRKAnKLYoKUuO/a Jg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4jtgubj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:32 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKJqnw003771; Wed, 15 Nov 2023 20:34:31 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 3ud4jtgub8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:31 +0000 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 3AFKIusL015453; Wed, 15 Nov 2023 20:34:30 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamxnj0jt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:30 +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 3AFKYRNf39518974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:27 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7464520043; Wed, 15 Nov 2023 20:34:27 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 280DC20040; Wed, 15 Nov 2023 20:34:26 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:26 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 11/32] kmsan: Export panic_on_kmsan Date: Wed, 15 Nov 2023 21:30:43 +0100 Message-ID: <20231115203401.2495875-12-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: FrroakPiKF2R0pV-9SgXrQ7N8s7ondQG X-Proofpoint-ORIG-GUID: DtTvJ7EVUczYgMPe3hqBK1_qhPzkipLH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Stat-Signature: batmgcfn68brhdaghdb79jdjaa9qithu X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: D62A48000B X-Rspam-User: X-HE-Tag: 1700084130-884862 X-HE-Meta: U2FsdGVkX1/2kyNNBM4xFhSrNiOdt98Y9EHDblIjWAHiyU0jokN1wlU3tn8MtYF1Gtsej0jNoIhDhO9FudzVqDolCrOGHIhQ0+85bjjqLVBKeIqePh/CLRdTNw4EB3gsGzuswi+E6lwv8+6opv/PhYAbVC+4hwuPRKlNurNrtgZkdJ9BDl7yf5vDPhhxhBiSUX1RDTYEkdwmFBkCrLbfZHY9qfQLfN0cV2QZ2T4N5w0wYLrY8L3w5PtUSRY9IVr+UXhEFPm+oVaIlXg3LOY+nYG7FR7BdWgJpgfSOB/qPKKR+yyOjGEoG0j7it0oUFFySTXgTZcfZL4yXeyjS65QyWTznU+A9+p6QlwMW3lJ4dn2ucJTvSIgbGARlcDPmJWNaz1Iupenk0Nzr15QE1nurjS7Gndt/xO8kpLCvpGKkw0ykgCTTWicMn/FsS00ldoF8VoAZn9CS6kKjGHI/wHLHYSynF5z8Weevw16EZHRk9iDx5FncwYE7cEFsXy39EXJNe8DEIvuDgB66vWg3a2Q8a9XAhiDTnt+vKLh7oUoc00AstsT8DD2I/wHr44nkF5JC+zOqQ/8ByfEKut/pYwWkVI8U3sPATdaeysS+5wFV1wEdqsVmHMRm00flDGidM79SziPZX5YEsZwxVjobPlQbbWTOn4joWMeJLB9Y4nH3CWo+B/hlU5aZCaUMLxnPNSbLgP5CepTPizqLVQYFFgcW2C2UYU99vAB9Yxjr2HZSAGLheKd44thRZ59FF+GETeJAVQpUALtyxM1cea7F+7m9ubiwh8svYGGyiHUkqYTC64oLUejqTtIrIbKSh22vB4kz+wLk/8gKxakCkZPAH9Gqmh8A3iggCs6ob+UBjMVVsX7d85jFj4xKsGpxDR/EYMtk+e8pxooUkNGQ+WOdJx6dsvYATEqYBLFXUBXsxSjMLdImZQxM+/Gh1V3srKIbUK7tk0UkwZ8gIE6Ge5AmY+ JPUVlbYI KeNjvwBrGnPcAhCdwkmFgFbS6qGIFcG/yTo7dcWGHETIkyG4Tpk2fIytGiigZtWMgigX0+sH3ysVfpl4pTnPZ6vEyzmBZQGY6abR277upXOw7skiKIEDsizbxVKLWawxGG6hhlIUl2jYWlde7aKzP7jJEE2e1WNFzWvFot9BjjO0dLsZI0oWe6WsrLjlfB6fgpVsMTAqxf1rKSZHbYIxIyJUz08WUADoVpNUtiXSEs3FPlZTriPeA2/3tlJ8bQWOjHa6d X-Bogosity: Ham, tests=bogofilter, spamicity=0.000787, 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. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- 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 Wed Nov 15 20:30:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457290 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 9198FC54FB9 for ; Wed, 15 Nov 2023 20:34:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11A6D80022; Wed, 15 Nov 2023 15:34:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 041D280034; Wed, 15 Nov 2023 15:34:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1D8080032; Wed, 15 Nov 2023 15:34:44 -0500 (EST) 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 900F680022 for ; Wed, 15 Nov 2023 15:34:44 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 67FD81A0B0E for ; Wed, 15 Nov 2023 20:34:44 +0000 (UTC) X-FDA: 81461342088.14.D800072 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf30.hostedemail.com (Postfix) with ESMTP id 01CCF80007 for ; Wed, 15 Nov 2023 20:34:41 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="axpKf0C/"; spf=pass (imf30.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=1700080482; 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=7CSL1yly+mfTewmMZpRp6TG2r/w75e0//7iE+NvfE7E=; b=NQ5GgjyZHKXfJSW5YPveEEPiv/eaYwX02w2VvWfReYHJ1e6mXlnvHkzfQ8c26FUUIcqyxT Zit6cLuW7rSnWqNW22FHs5pVGP/3Am8ETLsxJbsWTv/eS+Gc//vq5iCJFcSgVxJoj8QzSY KfdaHB9S1xfKMmOJiK6sPX0F6+Yfyh0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080482; a=rsa-sha256; cv=none; b=3ZRVceiGmwCQYXbUhHXn6wPr/v+OlbLdHsPZ2ydctH8wOYyP2BCf613i4+arr2Sz89vtC3 YcAEgyjF+JL7ghVGPIL8yjgnSBsYOIc3vlNOhJYZhPD9fjXn7YC0JVa94CvKxuZx9mHDu8 rCRWD6FqwstuHxa+s8oXjCDPLH7TxSQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="axpKf0C/"; spf=pass (imf30.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.17.1.19/8.17.1.19) with ESMTP id 3AFKWmer030721; Wed, 15 Nov 2023 20:34:35 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=7CSL1yly+mfTewmMZpRp6TG2r/w75e0//7iE+NvfE7E=; b=axpKf0C/ZK/y3UTVDuOPNB4zkPQc//qb+BANtaAjODsnGHwLBbs2P3W3of5diek/MTsz Pnthd+vfpolYybLS/DJpAM4eoztiGrZvjqYPNa5oOc7TW608nW5UbAsxDPf2eFYPCk8p JiiOSUs+eNTSVpE7U3Hzt8w8DCtSKI6HnsZgO6KgBkpZbTz3NxAYeP6te1/NnY/Q+9Zf MArD2wVJhbErxcE1rnIw8hvLBhIg1D24d6jWWrs53939dw8cpRGsbTNloROSzYX6hOf4 I4kL6jrqaAYhw23a5uT8MO6y30dLGEUKNUUj0Z/dmXd3VQuG/1INwiewlYLy00npd/y9 8Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud543g1aj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:34 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKXiCV001884; Wed, 15 Nov 2023 20:34:34 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 3ud543g1a3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:34 +0000 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 3AFKJ06d014625; Wed, 15 Nov 2023 20:34:32 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvsy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:32 +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 3AFKYTS916253564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:29 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DC912004D; Wed, 15 Nov 2023 20:34:29 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5CD220040; Wed, 15 Nov 2023 20:34:27 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:27 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 12/32] kmsan: Allow disabling KMSAN checks for the current task Date: Wed, 15 Nov 2023 21:30:44 +0100 Message-ID: <20231115203401.2495875-13-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: _iPe_nLp2MEt0BGzXvKFnSXZBmzon80R X-Proofpoint-GUID: zd4VFCqUaPM6hnX8Cj5Ti_7HDBuQLQCb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: 01CCF80007 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 4ed5o6afobpri8d1q7uboqqn8m7uc6k7 X-HE-Tag: 1700080481-398771 X-HE-Meta: U2FsdGVkX19V8edn5HN+pfWP6c6+QP/wv3iw96tJrIy0HzxADyXsSRPxBBkg6WXSXoLXgkTmXuKQcmhDB+L4OL8d22WQVilHUASd+eCA0dOjNCFTt59IiohaA2OGBFOOCIPhb8ttLgqvcH5EsTabSRBXclrviwob9gkEV5J669k3Lw4TYlpjrtrU1J+vl0tAdXE3gUdVvKx4u3B52uoCh4NQiqsouZrdim9Is56hVrAMhJVdgYOGzMSlDvDfq2HBLDQukbQW/mSqszIbjEI87Xkh0YHrdMZVQBDJ/hWWzR8G0E29+MOkxtGaFpu5Mem/JRIjUhQPXun+nuCYWVE6gQRt2vcpVWkQ2Z4LRHdZ5ziPLBFrJLxSGQNRAVf1RldsPWYXw1SrZwIWrJOTiGUpkqefI8swrOXGQWu8+HChbGGCwxqRF/WfwQUDctnAYtJbYRl2ZQHbv4dP91516For+xHMmkJYJ/PBoU2IJjfPHGwSq5JjRoHOBHBnAxCgERK4F4CEhrDAOBm/FTsVGGQ0TV5lohPM0WMBO4iiLrEoJ8P31DqAMG45OGONiXX0ATJ75Fx4mlYJfBvnrXzHZpJPuyFoiCLUvOvRJmO5Q8mB9FoPgdDLgJp1XPL/08BVrluGHqiEn14af0BHUbenjl/TMQySGE8WM9yCR3wte6ALJm/b+4jNB+XBTsQQjIuJYjD2hga8KqUl/9O5jJNDVDj8OZq8AA3PKUSAKRlgFyeh2wdKOTpz20v7Rc69gFXq+6bYxNzMbHlH8jtX+TKIDGY4wlYvQZ8x2Ob77fPm1b5dlccenpwIUTrgd5jECMckALyHOAcwKAy0+C5QDiYaH1h4MmCcG//C6D99mFyPQZczTXM+kHLGiFoxkaP+TfQJX5scAvQMhAEuLhGnvo9JxMNSLtsxi7UqAwn4lceLZjxgOLp6OmlCei1NGJh6cJXwM2Rx+Rihdes1NMCmAdd9FrC xyVUSjOS pXYRQaoSHfvK5A6cJ1xZfB7Zpk+agIFLhnYE2MzEBmvRXisRUwYXhI4mkySnzEx1gqm99KHwJf3A6N5MWulP4bjjHbS5KzAgsPbS8wCj2uuOcgsXlwLx4aLBq5GPtVodUMY+zoej9vbzdHMEp6cpWq14ovl1/kEwjoJRFj7dTqkycxMhmMPye7jRogdRcqoG6JoqRt6T6DrB+SJX3QsvaJJzruA== 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. Even though it's not strictly necessary, make them reentrant, in order to match the KASAN behavior. Repurpose the allow_reporting field for this. Signed-off-by: Ilya Leoshkevich --- Documentation/dev-tools/kmsan.rst | 4 ++-- include/linux/kmsan-checks.h | 12 ++++++++++++ include/linux/kmsan_types.h | 2 +- mm/kmsan/core.c | 2 +- mm/kmsan/hooks.c | 14 +++++++++++++- mm/kmsan/report.c | 6 +++--- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Documentation/dev-tools/kmsan.rst b/Documentation/dev-tools/kmsan.rst index 323eedad53cd..022a823f5f1b 100644 --- a/Documentation/dev-tools/kmsan.rst +++ b/Documentation/dev-tools/kmsan.rst @@ -338,11 +338,11 @@ Per-task KMSAN state ~~~~~~~~~~~~~~~~~~~~ Every task_struct has an associated KMSAN task state that holds the KMSAN -context (see above) and a per-task flag disallowing KMSAN reports:: +context (see above) and a per-task counter disallowing KMSAN reports:: struct kmsan_context { ... - bool allow_reporting; + unsigned int depth; struct kmsan_context_state cstate; ... } diff --git a/include/linux/kmsan-checks.h b/include/linux/kmsan-checks.h index 5218973f0ad0..bab2603685f7 100644 --- a/include/linux/kmsan-checks.h +++ b/include/linux/kmsan-checks.h @@ -72,6 +72,10 @@ void kmsan_copy_to_user(void __user *to, const void *from, size_t to_copy, */ void kmsan_memmove_metadata(void *dst, const void *src, size_t n); +void kmsan_enable_current(void); + +void kmsan_disable_current(void); + #else static inline void kmsan_poison_memory(const void *address, size_t size, @@ -92,6 +96,14 @@ static inline void kmsan_memmove_metadata(void *dst, const void *src, size_t n) { } +static inline void kmsan_enable_current(void) +{ +} + +static inline void kmsan_disable_current(void) +{ +} + #endif #endif /* _LINUX_KMSAN_CHECKS_H */ diff --git a/include/linux/kmsan_types.h b/include/linux/kmsan_types.h index 8bfa6c98176d..27bb146ece95 100644 --- a/include/linux/kmsan_types.h +++ b/include/linux/kmsan_types.h @@ -29,7 +29,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 c19f47af0424..b8767378cf8a 100644 --- a/mm/kmsan/core.c +++ b/mm/kmsan/core.c @@ -43,7 +43,7 @@ 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; + ctx->depth = 0; kmsan_internal_unpoison_memory(info, sizeof(*info), false); } diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index 4d477a0a356c..7b5814412e9f 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -44,7 +44,7 @@ void kmsan_task_exit(struct task_struct *task) if (!kmsan_enabled || kmsan_in_runtime()) return; - ctx->allow_reporting = false; + ctx->depth++; } void kmsan_slab_alloc(struct kmem_cache *s, void *object, gfp_t flags) @@ -434,3 +434,15 @@ void kmsan_check_memory(const void *addr, size_t size) REASON_ANY); } EXPORT_SYMBOL(kmsan_check_memory); + +void kmsan_enable_current(void) +{ + current->kmsan_ctx.depth--; +} +EXPORT_SYMBOL(kmsan_enable_current); + +void kmsan_disable_current(void) +{ + current->kmsan_ctx.depth++; +} +EXPORT_SYMBOL(kmsan_disable_current); diff --git a/mm/kmsan/report.c b/mm/kmsan/report.c index c79d3b0d2d0d..edcf53ca428e 100644 --- a/mm/kmsan/report.c +++ b/mm/kmsan/report.c @@ -158,12 +158,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; + current->kmsan_ctx.depth++; ua_flags = user_access_save(); raw_spin_lock(&kmsan_report_lock); pr_err("=====================================================\n"); @@ -216,5 +216,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; + current->kmsan_ctx.depth--; } From patchwork Wed Nov 15 20:30:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457289 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 56EACC5AE5B for ; Wed, 15 Nov 2023 20:34:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D398380033; Wed, 15 Nov 2023 15:34:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CBDFC80022; Wed, 15 Nov 2023 15:34:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0AE780033; Wed, 15 Nov 2023 15:34:44 -0500 (EST) 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 96DA880032 for ; Wed, 15 Nov 2023 15:34:44 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6971EA0926 for ; Wed, 15 Nov 2023 20:34:44 +0000 (UTC) X-FDA: 81461342088.11.791A5E3 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf15.hostedemail.com (Postfix) with ESMTP id 05B09A0023 for ; Wed, 15 Nov 2023 20:34:41 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=LLyi7dxG; 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=1700080482; 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=Prpv+ioyJJfZrf8ByIxPulecOh5L6EAjxoH7NJDKd6Y=; b=qqV/x3XdkhAOReymGjHdE0TvJJToqtKMRPJuaTpKpwtN5ueNBNL0BV+5ipvLrACybO7Jix whQzm99oDNttTHAfWfa1OPt0i4KorVRlm9m1MzlNIh5qKTe41QxmpBe5024lIa+TpJrvWo 0esQb1bgxub2jOel+jau8r1MN6x/Xkc= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=LLyi7dxG; 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=1700080482; a=rsa-sha256; cv=none; b=1E5EDpVRPzal3n9xoPdYtieLsxQBcDOvdGIBMH5OK3+NfN5vnZf+BK1jWbGjRFVnAPecEN 9sIuSifN5U3oLme71Es2S/ELPs7+iFfMIsS7yodmmLmsyJnFJ0RMdv8mWyf8cq4abhgWCl Eg2GJGhkZ4mNLuHi4bGDkdoDPM14eMM= Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKFagp016166; Wed, 15 Nov 2023 20:34:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Prpv+ioyJJfZrf8ByIxPulecOh5L6EAjxoH7NJDKd6Y=; b=LLyi7dxGghDJtCwcbzTDfPAfYRWuFYqoCzNZq+CXY521UhpAdBanrtkVWi2nQKT3NzOr HTgWqLLgi+FrE/mzwQtD84pNiS9Ls6XmkBvgUSKYBxP08wRIn8RynvX0JfUnN9pW6hwQ TWjJY4x5XO8czW1HFGUNhvxyAEx7NhDKHjuyZtbE4aCPyujBrr2c8PvHLXDFdOs7OQQ/ fIxjw3EpgGf9EZtYIYz+dHPurx9tvRFSzyGIcnhKsYmmz5cOfEfPB6DDGKm1APPJ+T7R rEMITFZFc7NUwSsXCKWV2CMz9cyk0g0h3cYReM28iNkodv0ZQYsqm28QpGNOQkk6Dvf+ zQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v2rb6h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:35 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKXhxg002277; Wed, 15 Nov 2023 20:34:35 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v2rb65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:35 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKJ36O017548; Wed, 15 Nov 2023 20:34:34 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamayj7a2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:34 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AFKYU8m22807222 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:30 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4F4F20043; Wed, 15 Nov 2023 20:34:30 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7867A20040; Wed, 15 Nov 2023 20:34:29 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:29 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 13/32] kmsan: Support SLAB_POISON Date: Wed, 15 Nov 2023 21:30:45 +0100 Message-ID: <20231115203401.2495875-14-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: VtMKqHRGouLJud_Z04fE9mTeehVK5PxD X-Proofpoint-GUID: 9JnYJ8nyLC98Hq0I8m7EcHlY1F4CxSFW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxscore=0 clxscore=1015 adultscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: 05B09A0023 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 8qbo6k4ug3ozwqxfz7ti5txufrphrwks X-HE-Tag: 1700080481-632307 X-HE-Meta: U2FsdGVkX18Eh8VHdgQ563ucAL1cLh2WUj5/Op6rqDDja5534E4qn750ceqnQPM9ZdxFE3zRvwopfy00gBlWUnRbLV8OVLPsJ4xJhq1E5suAVuVlRMKQRVnoQZaOA3CEH6FfwkzkAUwH4MnZm5kcfXcmZE2qeK6veTQ4zuln7EenP1gi3XsNLMJ5S2wdL25hyfJqVY/bED1u9/lOhM4XI9C4PTXPX7coJYAjJDdKIYrq+tj2Qds2VaBmQ1WHlXoM0DVH0JFM5+taLEpqY5yy3Ta6WdW5oKpk7fws3VruIoCNUJPujcYc5viERWzdy7A5jqlFq/E0syNEy/4DvDMIf178/QhcWJOuBNWsJWOxrM3MWCf/Z0jUzJyGwbT+SXBSrDKNQM/ZKzftkWVH1XNZW7W4iVR0zPTyv/johyLpLng7AOqKqeoTXl74BnmqOu/QE+qTgf/1ptwfkjWfngoAF7f1W0rHHby6zcAjTQgKD9yUmrT7kKF/F3dN0BceIbxY1NmtcC+RHxjuUK9QbUiWFAmM/woE8rBh4aX3mchVMkugN38XlegDWT/AyATxrnmW98gnn06jvIU36PVZ09jloBAo1EUNubaDOP5ttz3xkdh8acnPse+zLnQfz+39bJzC3DH7/FfBUvMkfzefMB5G0ako2DCNgA74V/uOb/8peo7O2WUTgTdzLpjdmetySuhKcUEbjP91gPW7LGqhyfbb9KoQ69xsXAy3MxvumZO+Imeh767QmtLDP4DM2IpIAH27y6yQhwIKfguwIa4SytE0Mm0zXxUvE3KB5wP/RAzR0a5uMpXys8YcmZH1HHTDKsRTX9G3TDw8Qf9S27M2uDgINgYAPNXjwkAiwnNAwBtKXKfVFJA/A00J9clcsZATeU0xTwLUIwIcKkfFvEp467jI1i4N9h2JYZQ3k8u0PaSYXLhegYBfpIXz7WPGdyriMuziI/Gw8gQrNvlX/ewmHW1 3u+MRrEl ceUD56alG4ysMbIGp0XsjqfEJU0efFpflEQF5GoIHMfXWxJ0RxFm0ePvT25qCOb9g84KxaVupY83YY+43gs9nlBnwMQtG2ST8B021IUodoXs4hibdFGXg6/DDPqeTUL9lmU3y8psCDbYC+OvvUCZyBm0P5cs4EQRMYGB5gJ1NPSZo1meCK8bOReM61PHGyfgkxpT1PIhueRv6XclUF5LsAGwUtJCdItYARptrq1Om3+HZBNlBylpTuk5q7LnZ6KcCScvN X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Avoid false KMSAN negatives with SLUB_DEBUG by allowing kmsan_slab_free() to poison the freed memory, and by preventing init_object() from unpoisoning new allocations. Signed-off-by: Ilya Leoshkevich --- mm/kmsan/hooks.c | 2 +- mm/slub.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index 7b5814412e9f..7a30274b893c 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -76,7 +76,7 @@ void kmsan_slab_free(struct kmem_cache *s, void *object) return; /* RCU slabs could be legally used after free within the RCU period */ - if (unlikely(s->flags & (SLAB_TYPESAFE_BY_RCU | SLAB_POISON))) + if (unlikely(s->flags & SLAB_TYPESAFE_BY_RCU)) return; /* * If there's a constructor, freed memory must remain in the same state diff --git a/mm/slub.c b/mm/slub.c index 63d281dfacdb..8d9aa4d7cb7e 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1024,7 +1024,8 @@ static __printf(3, 4) void slab_err(struct kmem_cache *s, struct slab *slab, add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); } -static void init_object(struct kmem_cache *s, void *object, u8 val) +__no_sanitize_memory static void +init_object(struct kmem_cache *s, void *object, u8 val) { u8 *p = kasan_reset_tag(object); unsigned int poison_size = s->object_size; From patchwork Wed Nov 15 20:30:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457369 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 7131FC2BB3F for ; Wed, 15 Nov 2023 21:04:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC7036B03C0; Wed, 15 Nov 2023 16:04:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E76DD6B03C1; Wed, 15 Nov 2023 16:04:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D17B26B03C2; Wed, 15 Nov 2023 16:04:40 -0500 (EST) 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 C49776B03C0 for ; Wed, 15 Nov 2023 16:04:40 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9E0C640AFE for ; Wed, 15 Nov 2023 21:04:40 +0000 (UTC) X-FDA: 81461417520.07.7DF6B94 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf06.hostedemail.com (Postfix) with ESMTP id 3DCDF180032 for ; Wed, 15 Nov 2023 21:04:37 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=L4vfRnZw; spf=pass (imf06.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700082278; a=rsa-sha256; cv=none; b=GY7xyLCfLy0oA+4SuCkVMpmj4c7EL92gl00ODQRDHOXSCM74VReVpXLOVTmA1xunKjkNKn QgcuFrOmHPOJvhEojFMxpoKRpW6fh8VYJNskuN+6xiYJxGnlSo9Ga+47Q7xi90/thQ4M0V CumBfNM0Sb3FJytxNYoDzFepNlNyKDc= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=L4vfRnZw; spf=pass (imf06.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700082278; 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=CdLKZ8qn4zwP446RCUpjk9jgcaOUrqtk3L/VG0jpav4=; b=fIeXTcJmW0QhcNsbkfGa0z6r/5cGYb7nuiTj4EgG0nGRbu6WP1y8q+gLrBSbQp71x4N48e Ref5R1pyygLF6AeNFQ2Qwf1aWNKiqjuP7X0bQ/Gben5IuAzMG2iziGHR+RwLPvs58CKqau LUwBiAAxfwcKkTA9Lf8cSuNislgP9us= Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKCEZD020041; Wed, 15 Nov 2023 20:34:40 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=CdLKZ8qn4zwP446RCUpjk9jgcaOUrqtk3L/VG0jpav4=; b=L4vfRnZw+uGxcpOsqqjyq5CRN5624Kzp2tNN8n4PxBcJ/OAfJ841PgRUGX2S6CtWH6iX TOzamQWSIylWufoTf4R348IeH9/fLgWdt6BnH6Rke8ieYwA0wDY2q2iTQDn5QkxXPzop 1RKGcNey8ZSXARkJEXjgkTTPVr/cvTNAm9J2lV+EJZEDJ7egUr1K7S/a5aNgC+S+Mop4 7cWNldlkSe1URRejUSF/DlPIl4rPL7iFsqHrr04DJZ03BdVNTr+g4lceMePlcPn2ztBR k9JKwUmbCsRVqVK0/B9H9NsUSKmZjtinmipZ3/8Ap64vTAwc0xw39sVO/5GraNnv43su lg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4thgk2y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:39 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKCZk7021216; Wed, 15 Nov 2023 20:34:39 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 3ud4thgk2h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:39 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKJ36R017548; Wed, 15 Nov 2023 20:34:37 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamayj7ae-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:37 +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 3AFKYYHx44434164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:34 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 415CC20043; Wed, 15 Nov 2023 20:34:34 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC1D520040; Wed, 15 Nov 2023 20:34:32 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:32 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 15/32] mm: slub: Let KMSAN access metadata Date: Wed, 15 Nov 2023 21:30:47 +0100 Message-ID: <20231115203401.2495875-16-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CXyK3LQ24vo0EH6joaIYozyRUtTOEyS8 X-Proofpoint-ORIG-GUID: qdS6d-wEuyX6_5mdxK25IrNeVjaBw2Cq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 adultscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 3DCDF180032 X-Stat-Signature: 7af4xgeppodjo7zjr87ziikot9bc67ut X-Rspam-User: X-HE-Tag: 1700082277-686757 X-HE-Meta: U2FsdGVkX18DLO7P99yC74RFN2wYUSH+Ib7sXoOOwHycALlQVvr4zFCTZAnF1nwimlReti5VQdXlsf+clGjjYVFwDyi5KhSKl0GjZoUV2kJWRtsxg4oTvkGrd5XhWoqcFJHKiPWHerZeHXBollcD5RLdaIyoYD2yYtPI7cyPf3+ZVUYOM64J9HVwB+UrfyonjtwLbaThMJIApKhMLC8YtTtcAPU9+EvBAsKN3H7haMseXQ54kQwH8ImUj/0wiSoYwP+0ZJbmeSDAoh6hBrYo5ExjMbNxIEcp2/8FrgP6HaENripjTYKOp0YA4OEih3Q7JYiRNQQfCzTCR978RjGqv8/DRxSYcaBauhXM5qck8J/ENwLnjFC4KXOX2fgulGb+7bkm0C44c1+XhUUMbtz+GCXiYy/0gTMIjj0yHlCSoB4ll1/f2iBKUUj1bcizq4Q8f9UX+4NSXEmhH6PWV+FbM9uW1l9dwwnnpfHMQC/cG1oZqJ5pYa5EgIZ73VpF7LkkNYiYaeyfrYPKv2hRM23WCq9ial6gbSZTmH72HttPntdLwDOWcBfHIMeMrkoycVGtXC5FbqP1pTzxBnZY/wYf6cUU79GTZDfMAp1HnB2oquPpWmKpL8N8+0lcuwwebnTgsdOFK11vK5M/SRyB0smgF86Kc8YV4J8GekshvaBcmBD5SklbLixKnJxmEGwlNtef0/P2mnJuY7DnzYcDCao+/pB42NuI3e0TmZLeymaBBJNAdhSXXI2cgByLWvIQYMMbOSQShbcQ01EIEiwqEkIWm/2tnPrBN7pMQj5qLF7JXPzrA23xhDzBR3V3Eqm95LLv/sb+Q5A9AIB3oETBM2cMKptvAcao+f9esJG637vVwIA+Zm9vPNbN+OwiCFwMmTkcajzI7EkEUvaiXL/6tJO/6yAb7xY7r0n4gJUNoBNtkxAU11h19Buhr2BlKDWkZvjKKJFW7V/jUy8L5vFi+vw kncUb0ya TOd2hwIr7LZTnv5zrYaUGA31C/rbCmAQhvPxOjUu76B5CbLqFWxWD22K1kUfTb4Ls/4YYT2ftlPV/6qhZ/C7kHwai+7a4h6M8TQu3cCWmem0mSZEPVZQoC6DBAtOdlTFQDgd66F4kO/DPdxsvgoMr+iPvfqEXxiZ2PZdQLLdIOQeYeW628lpxwnrxRQu9GGdRQtucK4lASh4UM2Jzp/7rFlP44Q== 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: 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. 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 8d9aa4d7cb7e..0b52bff99326 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -700,10 +700,12 @@ static int disable_higher_order_debug; static inline void metadata_access_enable(void) { kasan_disable_current(); + kmsan_disable_current(); } static inline void metadata_access_disable(void) { + kmsan_enable_current(); kasan_enable_current(); } From patchwork Wed Nov 15 20:30:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457291 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 3C9F4C072A2 for ; Wed, 15 Nov 2023 20:34:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 84DBB80034; Wed, 15 Nov 2023 15:34:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D64980032; Wed, 15 Nov 2023 15:34:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6021880034; Wed, 15 Nov 2023 15:34:49 -0500 (EST) 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 4752E80032 for ; Wed, 15 Nov 2023 15:34:49 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 16EAB8055B for ; Wed, 15 Nov 2023 20:34:49 +0000 (UTC) X-FDA: 81461342298.29.23F0D66 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf20.hostedemail.com (Postfix) with ESMTP id DAE0A1C0005 for ; Wed, 15 Nov 2023 20:34:46 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=emT9maAc; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf20.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=1700080487; 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=CK3CSFhKHiUxb3M2GZk8QRFPFYlA6+i6yOOL0Bh28Bg=; b=GT0Lr2WknJLL852y/QEK1AlhhHpSIJtUxcZW5/3gxD4Xwt82FDZ290haIEosLRXGz9Yklf CBiWlt+u1CkQi5xDS/JeLHQafR3cfaWjvINy6gp+mnDBfSdpsc3Cun/Ar9XRykcsiPZgYr R3rHEnLArRoLodHGHQPqF2IFe3ekjoU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=emT9maAc; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf20.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=1700080487; a=rsa-sha256; cv=none; b=pDdr++srOWM/5tKclKO3vWrY10fhyHHXVviEMfyGIkAP9eRpXQchsAd/DsQs8kYi6/n/bc Qnea0zAtAsyXUB7ExUlTXBpzV9PirGp0ffvwyk8LyVQom6zJpC4PhfW7jwXzAMt1CkOTy3 4TQn/gM//qKKtEuAI2MSTE1eQZ07kDE= Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKSANo032237; Wed, 15 Nov 2023 20:34:40 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=CK3CSFhKHiUxb3M2GZk8QRFPFYlA6+i6yOOL0Bh28Bg=; b=emT9maAcJzRM0G1DzNyB9iM8ZDVH2esBnEg/GihJ7LhUH2LLr25n4T16fwdyJps5Swbk wi4ydQ4vQY1dt3LHU3iEbPpDRQlK2WN3UgmbbuFpWQqA+NdbB1X1DTRjZDb79cxWxs14 l92PTve6gZdcBi+zTfFpznNCncAP5bY1O8MJRp6g0ZKo+7YKzVTEB37DAfMRevUc1q+d +eknBIA7PwtuOwMk5F3TMX2Uxm634QiwPtiNOYXcOzTFrM4zQMZuFhT8+4ha9MGLnPSb 339/RbJXkgFBm6wWvggkH1xF3nzhdx7IKq75wA+RnlnWIvdnE3fRnpaZkzLi2MevaFfd tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v38cv2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:40 +0000 Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKG6nw003579; Wed, 15 Nov 2023 20:34:40 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 3ud4v38cur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:39 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKJ1FS017525; Wed, 15 Nov 2023 20:34:39 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamayj7ap-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:39 +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 3AFKYaAX24576754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:36 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00EC32004E; Wed, 15 Nov 2023 20:34:36 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB2F120040; Wed, 15 Nov 2023 20:34:34 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:34 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 16/32] mm: kfence: Disable KMSAN when checking the canary Date: Wed, 15 Nov 2023 21:30:48 +0100 Message-ID: <20231115203401.2495875-17-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: A7EFZ5gScxsCuOEPrsIMx7XtWnrv7KuJ X-Proofpoint-ORIG-GUID: bCKwaI7qewBSCpfDoKVTIbT55i3gylk2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=0 impostorscore=0 malwarescore=0 adultscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: DAE0A1C0005 X-Stat-Signature: u6bihcowgftyxtekakx9njwn8spijmxp X-HE-Tag: 1700080486-360409 X-HE-Meta: U2FsdGVkX1+OAaVPR/wW04pcR2xC10A2YfO/IiC6mO2pa3n5OYLwU2/Fr8lGIjg09io2xYiJy39s8BT6RWyySsvv+6GVRIR+vFJhwY/ATKF4hxQiVHrP2ILLSlxKgSnYTLRck9TcVHKeFi183nLdopRHftMEbVZaMPB7mtor43g2Bf6xlAJE/CY2R/aMh9ZyjydKNYrfV9m1Tc/mplhKfOJoM1i9RdzZ/x65Mfq+Oz1A/eG69wihLloPVCwDsPfd2pJLfo3tJucqTKe54xvGuKOjEpiMp8wkP2f5Aku55xEe4vA+csO8i0u62JzM0BgnvzHhdmKBB3B0KOTGt+qgjqoyc0D5sYmkQn5OHYGbMWzPRdY/n9H8whMQZ+/jfBl4aluA6+pp6Y+nLCUT/eAeTwFotBlmljWF6wOeb3tGrhPtoj7Jjjv8wIG9rJPBoQL3T7ppA1DO52CLXAKMVOD5su9QEZQvZYNl5ToAuBSDkGvswU7oVJnhTVSac8pzwloBixCo+QkTajA6khMKdAutmM+Hk7Ikz1lpJTsBTXoLKyYSAa7WI2SdRl86Jx7wm41hYZT1qg/SBKu+E6pOf+Dsrq4+vCtqnqyrFWJUxeAXv7zMR0+CHx1UtgIykg4RHmHZKFDtHMjOh7LgergixTFFU/ihqipQYZT52bRnU320T3lBQKlFSKcMLtJoD03nMxNvnAGAf4UH80X1cBiAiwqrngeEEcexvuYsOg/Xr5ianZ3ORXTpPiiKQrgZfHIBlZQWolQLpceqgi6jBpR0Jzn4Yu/81tv042hwHih2b/LEiJERqmCVGddAeQsRnt95PdfwYRtKbtC3uIjkicEi9iQTHoH+cSVseXUJbYTv6m2x7flHF1gAIag1I6WkqoFJbD9bSFlFzdQxXRo9uuTaMHpdvJv7iXoNoZmigRsBlZSVQLYqCYnBGBiK/wRziceWj7bEYBpx0ECxxasRTL2l2mD toBDVtwS J5dc7balooWDs8bzSAzusUXfeaE+zksDwOZu1N6dtOixYvI4GB2bnz6Ozls6KfcW1V+1RkI6MUXusikK1431NZWrBIuYakAuO4/RUIdALDAjXOO9GMqpq/ONf2hMzDRm21gjED3zLK+5DF6wOPWlsEjgsvFTWO0MK5uWzgvr/EhzrTEDvI3u9Bd/YtP9ySyzolmTGhWijmp4KE2MPDc+1NZic1Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: KMSAN warns about check_canary() accessing the canary. The reason is that, even though set_canary() is properly instrumented and sets shadow, slub explicitly poisons the canary's address range afterwards. Unpoisoning the canary is not the right thing to do: only check_canary() is supposed to ever touch it. Instead, disable KMSAN checks around canary read accesses. Signed-off-by: Ilya Leoshkevich --- mm/kfence/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 3872528d0963..a2ea8e5a1ad9 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -306,7 +306,7 @@ metadata_update_state(struct kfence_metadata *meta, enum kfence_object_state nex } /* Check canary byte at @addr. */ -static inline bool check_canary_byte(u8 *addr) +__no_kmsan_checks static inline bool check_canary_byte(u8 *addr) { struct kfence_metadata *meta; unsigned long flags; @@ -341,7 +341,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) +__no_kmsan_checks static inline void +check_canary(const struct kfence_metadata *meta) { const unsigned long pageaddr = ALIGN_DOWN(meta->addr, PAGE_SIZE); unsigned long addr = pageaddr; From patchwork Wed Nov 15 20:30:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457292 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 DBFC2C54FB9 for ; Wed, 15 Nov 2023 20:34:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB97D80036; Wed, 15 Nov 2023 15:34:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C421080032; Wed, 15 Nov 2023 15:34:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A211980036; Wed, 15 Nov 2023 15:34:51 -0500 (EST) 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 8388380032 for ; Wed, 15 Nov 2023 15:34:51 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 541CC1408A4 for ; Wed, 15 Nov 2023 20:34:51 +0000 (UTC) X-FDA: 81461342382.10.5CF83C4 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf18.hostedemail.com (Postfix) with ESMTP id 0A99A1C001E for ; Wed, 15 Nov 2023 20:34:48 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Fsbw4u7f; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf18.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=1700080489; 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=FBHiR0R3HqDameObtBi5tDwt9B6xgR+xiaoV3r5rhIA=; b=BeNaaEw1mtAigDvaM07PFSTXwvT1XhbWmYJ5ewECG/sFUJjMExXkLBdWxjUgHooR1S3bMr 9ibwZYYSK/aCrfKTh/mUL4aLuTOcCyj/AQDY4vexP3JyaMNmds8qyECdQVy0ZEBPP0sjE6 8AhtYPHxw8E7a6fRogdyIoBNTPeCa0A= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Fsbw4u7f; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf18.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=1700080489; a=rsa-sha256; cv=none; b=nr+M6I6K84BbUEc+UdILd3pREDEmLDwF6vnBFS+CSd8188llz/SlQK6ewmoWUk5HTG96JC Tdg/iBl2olTQ01a/9QI8JG3z5vuP7k1OqEqPmFnc5Xh9AZ5HGV99nB+6CQRPaJHnXZZVN9 hIxgm34FcbHhpbIWoYZJ9HYlSnvpGTo= Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKGBf9020343; Wed, 15 Nov 2023 20:34:42 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=FBHiR0R3HqDameObtBi5tDwt9B6xgR+xiaoV3r5rhIA=; b=Fsbw4u7figkGz1teJMQ8day7onkmLRVQHzQQoQohRyi12JtEc4E+THn9ncooeU1blL95 BSNrmP6042dwc2gTk3PtIT3ZaPtRz5G3nE8fT130QRaywFogH6cOz+yX7seocVTQ3OEQ OLcP8i+gO/6updNe1Wh9Bcm6M3uTRMccbL90MJr6HJbHMQA1tEeaceaprV/0JDzkHyAO HHsf9P12TzXM81H/2ksj4UK5laexB6lxpNfnRFikO5/v5KPh3CFSqfC1zUm/LZtmEJDB IbsVe3RBRne0bOE+fKv3osgoJD4TfGRisBCHguVl9A33hlBA9duhPIg2UJ++MxrN/Ipw rA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4ch9bv2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:42 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKGRQZ022066; Wed, 15 Nov 2023 20:34:41 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 3ud4ch9bun-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:41 +0000 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 3AFKIvqo021610; Wed, 15 Nov 2023 20:34:40 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uap5k9kay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:40 +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 3AFKYbWA23069318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:37 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9EA3A2004B; Wed, 15 Nov 2023 20:34:37 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5288420040; Wed, 15 Nov 2023 20:34:36 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:36 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 17/32] lib/string: Add KMSAN support to strlcpy() and strlcat() Date: Wed, 15 Nov 2023 21:30:49 +0100 Message-ID: <20231115203401.2495875-18-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: WE4fc2MWwcSfv1ysVLGFiuvMJSpg76OK X-Proofpoint-ORIG-GUID: Mee9YG8eX7q6Hn736J-ftydiuuw4ftdn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 priorityscore=1501 phishscore=0 spamscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0A99A1C001E X-Stat-Signature: xafw5j186hi5d7bxkjrgde4owbgmjd5h X-HE-Tag: 1700080488-16216 X-HE-Meta: U2FsdGVkX19issUrsk0iYraa7LX+nj1ppTpJddr294s6TTTwXbVpcNMy7ZP/rdZ5vVcMo1t7uAKMgkLKaTekgJf+i7X5lEiPUjZfjKX/90lSYFu9x2ZIWO4/3iyYVCJtMbF0XvkOl65zPBeeJ5jeOtpIqTF6dhi9W9lAwjyQCAaTldnJ6UDiWJX/a6zvXZRuXGQVZlq3Sqf0wSHMgSRaVVapsxUV87gU4Y60rnT+f9c3pxpudU8nRykwA5FVdpO74O51jPZErJSbY7WDIQLdxLSQSaeIAGMudBZUWFkRT0s3lyW/CDsxbh4NS11qt7r7SNKzJOLrAlqhZdMfNMd6YR068A9GFrFFmy6QojD8oqJtQoprtOheL+KxxeP/IY/muYldupoDMFEiNjIqTYpYDPzPf3C2QQ7vkgUaXhV3HZIUiyDkGZ10CCPecslZxlW0/mQel99XZouJmz1T4Y765e24VQ5vlLFwIbC6zSKm9zk2eHvVTt5+22/tsRRowfTHw2DQh9JDWwp4HwpTnn9nM4CRR0ed+yfMDitFfhYqQX1R4z/h2XAZ+bdQsiMSVgiG3+lYEPXusxWlCO7z6L9QQcBUF6anQAoJCW1d5OUbg5OHERKcZ+cudQQonzb00r2Pa2JAivxXhdho7TTJRxzqvE31rqzSgn+W61rWq4QzrTJ3Pd3KH9HdzAFrV/d39mCPmaco1XClfG0tBKWQHfcZDtFxebkKd7Hh+wj+LZ/vD650BVxaF3F2FhREd46cRl4Ty9TsS27CnXIvjvjzickeI0gR+c4/M1bMRUWB99lVn7tmYHNu0uB275fwahtyb5ha1XmSdaAZRRmFRSfGu12ZZaFPgfqsEGp21nm9xFHxgBPZBX3i696I7T33xJXjd7JkT0RXmlvaBTsrUorDK5wgRR95l/NRiNSd7Q2qMbymZk6LOZ8iaEVczDbdcM/vNhE7h+9wFbWgCVRPAB0cQrb Mly76oSY c3apuFoR26N+bfG61+Eo71a3Skx9vAkcDQ008LmqDEIB0xE0dgFj6Y2T1k36TMgU+nQSRQjI7q5EGRKEFuluVXixOz2RLmypNxTBXoNdIn8Z0zppdkDcE/n0iy4ybQcBzbMXaLtH8MOQ5XJ5/WGiwBdd5AxcfNIX/RzceV9YyouBwP8dO+iCCXTrOTtzlI2YzVxk7T39mpME7w1BbLsXhKuLhMZa/vWYJZVVK2cgHOD+GT5P/0LJs04ql+bDh3VKushFbB1K2G6Wf+U0M2juAG9jZ/cbBxUwtaTc8lQHcxItcSVhERt+fCDFJdA== 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: Currently KMSAN does not fully propagate metadata in strlcpy() and strlcat(), because they are built with -ffreestanding and call memcpy(). In this combination memcpy() calls are not instrumented. Fix by copying the metadata manually. Add the __STDC_HOSTED__ #ifdef in case the code is compiled with different flags in the future. Signed-off-by: Ilya Leoshkevich --- lib/string.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/string.c b/lib/string.c index be26623953d2..e83c6dd77ec6 100644 --- a/lib/string.c +++ b/lib/string.c @@ -111,6 +111,9 @@ size_t strlcpy(char *dest, const char *src, size_t size) if (size) { size_t len = (ret >= size) ? size - 1 : ret; __builtin_memcpy(dest, src, len); +#if __STDC_HOSTED__ == 0 + kmsan_memmove_metadata(dest, src, len); +#endif dest[len] = '\0'; } return ret; @@ -261,6 +264,9 @@ size_t strlcat(char *dest, const char *src, size_t count) if (len >= count) len = count-1; __builtin_memcpy(dest, src, len); +#if __STDC_HOSTED__ == 0 + kmsan_memmove_metadata(dest, src, len); +#endif dest[len] = 0; return res; } From patchwork Wed Nov 15 20:30:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457293 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 8C178C072A2 for ; Wed, 15 Nov 2023 20:34:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF75B80037; Wed, 15 Nov 2023 15:34:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B808180032; Wed, 15 Nov 2023 15:34:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95DCC80037; Wed, 15 Nov 2023 15:34:53 -0500 (EST) 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 771A580032 for ; Wed, 15 Nov 2023 15:34:53 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3BDCBB53CE for ; Wed, 15 Nov 2023 20:34:53 +0000 (UTC) X-FDA: 81461342466.02.D75D311 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf04.hostedemail.com (Postfix) with ESMTP id B71F040024 for ; Wed, 15 Nov 2023 20:34:50 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=YKFBdcKb; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf04.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080490; a=rsa-sha256; cv=none; b=tudU9/coVbS8dwxbzoBtduhUwgY7v8cKevfvSz9cANFCB6aHtfGng048kaJfjCTssDT8e2 oSXf8ex9AJ2hBeAVQKPRFWAIT44NXl8od2sHaCA8/xyOfwOEZKldNRQbQgOax759cZvjkW wXnYBZraSkTlJgO14uyP+nX8DiBknYE= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=YKFBdcKb; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf04.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080490; 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=JR4hU8usmRDdin50s82nkAgu6ZMVd3+rhBewhZJH1Ks=; b=6wGqoU9cN2YAbSLiMX5H8N05fNsNPAHflzn5BHmPpV+z3vzC6DIXtHf3s0bKxt0XR2bouw jWYYsi9trKX7SD4h6BpUziwDye2RN4rxPx/CO7B2U7QQM592yn+he6Tg5A2tDUxZHgFjp7 0CY/lausvDhBi1lt2kj7RcMeZS5SzDs= Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKRoBX004604; Wed, 15 Nov 2023 20:34: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 : content-transfer-encoding : mime-version; s=pp1; bh=JR4hU8usmRDdin50s82nkAgu6ZMVd3+rhBewhZJH1Ks=; b=YKFBdcKbdSJgTB+aM79PQbFV4a0TjU+i1B/9byBiNFmDJRLCYX8tYRTHpuPlpdOK0adD lZGVr/mLGa3f4zozDmKbjjECp/fBHUf0DoO/O1s9D2KPXx9ksLl8013dSEg3AQeqHXA6 j6+HjT3q4CCtfIeivsmA9elAr+XfUGrB5ozyixaqgr4T9GcF38xZW81o3NQZkMgx0nl0 53KuaCWsxD9k29VbGkRBlrfL/nHrx37OvaSGR8f9KbjClX70YkzrFHe4ZWV8gW6ERXLD /p648HsVC+k/G6ABvWtA9NSDxiQChjuORdtNqTwgldfiIUcnrgRT44EYIxS2EGBEeyyT cQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud51q060w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:44 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKSEvw006055; Wed, 15 Nov 2023 20:34:43 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 3ud51q060h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:43 +0000 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 3AFKItrc010007; Wed, 15 Nov 2023 20:34:42 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uakxt2dv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:42 +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 3AFKYdCM65012072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:39 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55E0920040; Wed, 15 Nov 2023 20:34:39 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA6ED20043; Wed, 15 Nov 2023 20:34:37 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:37 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 18/32] lib/zlib: Unpoison DFLTCC output buffers Date: Wed, 15 Nov 2023 21:30:50 +0100 Message-ID: <20231115203401.2495875-19-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: FcmPA45PTLlNdzoYRSKo5ivTe4t5LzGg X-Proofpoint-GUID: 9RBqKpW0ebiKf9o1-LJaYDwqoA8WDNjK X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 phishscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B71F040024 X-Stat-Signature: nh3u7tgqxciemicjxm4169n1b7mq1m59 X-HE-Tag: 1700080490-551126 X-HE-Meta: U2FsdGVkX1/3gjDoeGX9E7NJhOkR+yfgtPFbV1Oiv0uoJDWv4G7w3mNtLhv+vHOEL3h1nyLIGLNZM+wR75uerYcLx3Q+g9ji0UiQnyAo+g9br0Xg9+R3GyYTb7t0tuC5yYYCkbFoTSyL1VN0J91pjB2vpUCxQWAh/zemgLlPRmY0owBt9hYDKDehE2v3idkfRSwY01lUJ5Jc1nca1bIoiDEWByucSXWV4fEWOliZo3TWW/6PodGXOshqdAfX0/O+h341xi79TYhaf8BuPduf1KHfMSpH8ZRl1OVTVmXssYM25bANt3jyjD0oWD4DyOa60PyiTnYBXAECBz+IxDFKnAiM7zmywVPRArY5uFim9hFzdoXIX0AQcQMkUAFpuXwpYD10OPqShJwvZoti1vUy08Sqxl3PaJVD1FTwiTiQdF1nXxsYvMclsy3hARL1uV4UHikyfDqmP+G5+UOyniDa14cKL7Vo9klXik6ilCjZWzJ41yjHoHRPfL/L0khKkwNuPgDkHFeLC989AUKukYaBGuOLgoO7MmmaKS6xSiAh5fjqNlMRS2NuQG5JuWQPC2ld6B5rG2N/k/UF6XCmrrUskEWZQbk7o2/ckVrYnaM1v/RcMDHz1n1eFTXf1zWAAi6nEXP17mGGjUiEgMx/OFyPMYWN7VmWxowv1TBrd3Ogi9jVYSqpO8a+vXpsySvHyRaxspIxK9z3Yxq4X71bbJHMSf6z/xJYKYNgm+gMpcKBpMjsE4x6/seFW0QoQy14kKePmKYoRU2zHOqr2he7rYKji/9sb2MkpzNg80SML/KoDu+IJasNPjNSQzYLzrOjshONsKljo2+iAo1YlgTuChGvfo1zXrKvzIcouv1fSyQPreRChLmyYup2rkgdR7Lr1eyFqFA88TGvw/XjPSfVIrEy2PoLCWTYSDOXuQCRB99pX49HWhrc9KGgX+U/nAxL4pCVYbF7lAFn2Jcx/8Oxllx +hc4U7uG fInn9uaJW+GZP/GWkbvqlMm7k0JzXnLX93lLuGjdgthBPzJZFF5Eu/l459h3D0hCp74Vlf2BADwzBkzzorg2IFWUOuA0Wi6c2tSVvnboNmNFsnT+/9Y55s94lVJhWhrCLMYsUsJg/Ydw9NhtLvvq8slKqqwHsdjG7AhjpXnvpADD+/oMShJq8LsobZyvbgBDcIPmMrxhZKxY2nId5jW5puqHFrOe5TQbuL3DtZu4R/1Oww2yMXQkKIIfqWc0zVsEFrcY1BNQsWul1JKXya6H6yf2MkeFP/cWGwy4Y83JGmYGyzV2GyWlE6VH6J48InHIVO9e1LEzwiuPQM4A= 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 Signed-off-by: Ilya Leoshkevich --- lib/zlib_dfltcc/dfltcc.h | 1 + lib/zlib_dfltcc/dfltcc_util.h | 23 +++++++++++++++++++++++ 2 files changed, 24 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..ce2e039a55b5 100644 --- a/lib/zlib_dfltcc/dfltcc_util.h +++ b/lib/zlib_dfltcc/dfltcc_util.h @@ -2,6 +2,7 @@ #ifndef DFLTCC_UTIL_H #define DFLTCC_UTIL_H +#include "dfltcc.h" #include /* @@ -20,6 +21,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 +36,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 +62,26 @@ static inline dfltcc_cc dfltcc( : "cc", "memory"); t2 = r2; t3 = r3; t4 = r4; t5 = r5; + 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 Wed Nov 15 20:30:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457294 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 3D8A1C2BB3F for ; Wed, 15 Nov 2023 20:34:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A70680032; Wed, 15 Nov 2023 15:34:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 230A380038; Wed, 15 Nov 2023 15:34:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0338880032; Wed, 15 Nov 2023 15:34:53 -0500 (EST) 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 C658580038 for ; Wed, 15 Nov 2023 15:34:53 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 90BD3160AB4 for ; Wed, 15 Nov 2023 20:34:53 +0000 (UTC) X-FDA: 81461342466.22.17B0A6B Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf24.hostedemail.com (Postfix) with ESMTP id 5469418000E for ; Wed, 15 Nov 2023 20:34:51 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=MKmcWWar; spf=pass (imf24.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=1700080491; 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=TskbhcdErPcFfha1b/s0fcuykpiIcbkPzbroc8ZK1SI=; b=ZyeMldsFbopxbQD6H01uyaQqTodcmEwkGaSlhZdGCtQ26sk7Qgo2+bKv/FATwRdBBdsQEr 6+17V9TkV4XND5DbC1yrcHc7mWdXAj+2/mKmeva3sCAxHccaoNZD39zNv6PhMbqYYFfxWd oWaIVu30OvX13/duX+Q/8UHuGnpaHuI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080491; a=rsa-sha256; cv=none; b=58cFBwLxFpSqp+ZLm6gR458rBXvdt1vn6UpRMQm7r6zjb1kDdkb4cU/Tn5NTwlXgzzwuSO 7iFPm0EsAYGii72Y0xOZ98dELmxqLORrAnko4v0sdYyt/UrO4P17uqM7kvAzvyYNSPqJj1 m+B4tjEYb3PXqflOnj7OMAaEV3/Y5xk= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=MKmcWWar; spf=pass (imf24.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 (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKXdxP001484; Wed, 15 Nov 2023 20:34:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=TskbhcdErPcFfha1b/s0fcuykpiIcbkPzbroc8ZK1SI=; b=MKmcWWarJyHYTi8ujhRAoBImQJlnNvjIW5NXFdOCWwrgCjU4Y6aPXpp48XNsEBhToLDY zddeK/mwzvHQNZdRZ4CEKekbT1YOZnQlG3TLMrEOxb+EiLFLb95VWHA//rSppiFGmndd pIubiWBmWh8CjUH81vDNMpJ9oOtg5T3+WPtlkwC6RFso0Pn+CiHKkQdHwuec3of84LPe QcSOx5x85W9ZwCk4qAfd3WKCCY0STTsEyQBf32Knuai5SIYe0ySKvmlzbepfvPocgYuE SL2Ym5Ij2uDPB3oOy/ADK6OcbOmyAfOElVYsAQCnks2SIk6vbzBjws2rVTmuVUDLI3+Q gg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v2rb8k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:45 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKYj4B005400; Wed, 15 Nov 2023 20:34:45 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v2rb8e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:45 +0000 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 3AFKIvQS014607; Wed, 15 Nov 2023 20:34:44 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:44 +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 3AFKYfsg31523398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:41 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12F612004B; Wed, 15 Nov 2023 20:34:41 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B854A20040; Wed, 15 Nov 2023 20:34:39 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:39 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 19/32] kmsan: Accept ranges starting with 0 on s390 Date: Wed, 15 Nov 2023 21:30:51 +0100 Message-ID: <20231115203401.2495875-20-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: NqSGEOhYCvXYjJ2gmAhd8EZAV9lDeRqN X-Proofpoint-GUID: fI9InjhahjWpUFvyF7-N6n0DC7cim79b X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxscore=0 clxscore=1015 adultscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=981 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Stat-Signature: hrd6c6m78e41in4row6cbsfnqzbw9z3z X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 5469418000E X-Rspam-User: X-HE-Tag: 1700080491-619394 X-HE-Meta: U2FsdGVkX1/32i1sfXTBZJIAo02BfT2nGDpXkLr4lzcdxjH/4FBuJNQzDHC3iNmj54AGoi38vvVeK+YAg9mVnemyXshcy6hHBCjhJ8GtJI/syAQzK2iqPQDwLAi91Wa1RFCkztvaqJkGfVk5opQmIYGxeugSckt0aV5dQdjPCVMYt1O6zw305sSALnFUwI7kVtvfcJCgOd+dW8n1tYXcWvtWX4Wjr4Fp6vZiqg9q1Yhf0yMvAG1WVA969K+Srm73T4uo1DP4HeemQLV9PAtnyxf8TiIkvWDd8dNpES0EBZCT8BBrWXQ8nH6KRxPxObS1fYCOnZ4ZPGYIJrO3Sw2nw55SuNsZZG7HWs34FZyBYu/uZlkWbCDdPuQTc2X3Ry5sdti2gQDiMP116xQsxqWsFxJPMDfXfXxs05zwSs2BTq4r5Djr0vnQpgklEO6fr7CaC/cQuA6elnkIFdAZdgVVAX2ewmksLKtixVBlpZrRFT+yMyuCEO5dHYh4zEfYs2BlBsjVMs8IyYYjW+Qkq5khPUDxRw8ZZ5bSr6XA+9Ap1LNOp7QrFvKz4vzEkHtKQpuknd+i3zuNC025Jkm0MjrQSEWXUPtKceuMIoVNczvzpYObHYI1a+dEbGo2MjvhBHR/9Klx2DSeqFVLpZhFPR0nlc82ZaWAzufkTwE3zE1zOBK+ESFLmElEdxN51YXsIFuqBl1zGoTy5bZdQIhthxPrKnshmxwM3Mj73TzbUoFioh3lj9v3QpFheqJWTie1WUugB/Qo/aKw8oHdNTE4w4kJxMTwQSLcv6HXJdZA0oThjEFXP9m9CJDa6Mp7WySWTbEYBdhYyShDhrFlZV2pcGZMmPUNRwp+cxfoUF/oZ7mqwa9NhE6aWGwpm2w12mAn4SwL1U87Sv+uw3VM6lwXxp8gTa9tzbcrcg9vdFzTSokF/XXVV01pS+vooPh/wOXhG4TRShJWOMxDg1g8O68SOXY 0A7Sjruk nwWS75tyOPlbj28H+y6cvE1k4pEc9BkotKdEi9Vdb5d2cvTX0ZT2ERpPM9YSijjygfJWsePiIr/GKexJ5Xq7lFtAPJ4glcUgRYQE+h68yWluaAVrZpbF3cngwAGlGADFU/+Hz+GOcy2RK8u2nFvxUM49H3NTCdJoPsARSQq4y7kUwqfi91dSRmBAMWmzdj+Bl37Mc3G2BU3xPebhhg2lEzcCrRg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On s390 the virtual address 0 is valid (current CPU's lowcore is mapped there), therefore KMSAN should not complain about it. Disable the respective check on s390. There doesn't seem to be a Kconfig option to describe this situation, so explicitly check for s390. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- mm/kmsan/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/kmsan/init.c b/mm/kmsan/init.c index ffedf4dbc49d..14f4a432fddd 100644 --- a/mm/kmsan/init.c +++ b/mm/kmsan/init.c @@ -33,7 +33,9 @@ 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) || + (!IS_ENABLED(CONFIG_S390) && !nstart) || + !nend); nstart = ALIGN_DOWN(nstart, PAGE_SIZE); nend = ALIGN(nend, PAGE_SIZE); From patchwork Wed Nov 15 20:30:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457295 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 0601DC2BB3F for ; Wed, 15 Nov 2023 20:35:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CDD180039; Wed, 15 Nov 2023 15:34:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BC7680038; Wed, 15 Nov 2023 15:34:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA89080039; Wed, 15 Nov 2023 15:34:55 -0500 (EST) 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 C261280038 for ; Wed, 15 Nov 2023 15:34:55 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A28DFB48D1 for ; Wed, 15 Nov 2023 20:34:55 +0000 (UTC) X-FDA: 81461342550.06.C9D240E Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf01.hostedemail.com (Postfix) with ESMTP id 7111E40018 for ; Wed, 15 Nov 2023 20:34:53 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=SQHhPpvO; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080493; 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=7EA0rB7Lnz119cXET77DqVvo3LoXQifKy9ond6IQu6w=; b=XsqXE2LkbYIOjlF/8sUiNlfLqdk7ri//wDOyUJBAw0obnTTeW1AbX1BI1w8fy6bHCNMyuf LtSSvsp2XGBnStY+ZemN6HZro8hsaljhdWamtmhbn/s6ZheWlopCQWs9+3USc06GNsSyKW PDqDd7m3GLRhrdx966wFZfsgD9c3KKU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=SQHhPpvO; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080493; a=rsa-sha256; cv=none; b=T6uRKwwSCfAOpU8z/XK1kKffgkzPhGqJUCT0iprsmm6FXqaB9DabovpEDrVawNoPv4uyKk EzcbzOarDmhcWD2Bs/KhoNbTsyQDOXJ4J4AjoNGkNCisyBQEfAgAKMjWrWh0gVHKkqp4sy AhFp9V6v7p+0DPRy7OsUBuhUR6JjVic= Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKFaD7001501; Wed, 15 Nov 2023 20:34: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=7EA0rB7Lnz119cXET77DqVvo3LoXQifKy9ond6IQu6w=; b=SQHhPpvOy5C8/CrRMGo2ik4gciTn5gO1RM1AvdDxC76egg3OXGxioGISNJwtO352/Q4G 1pQIMcI1YWAOMTAH60eh+WeJMClruwJEPyDRAvt7krgSyv1bP0oW+fV8T7ZjMUkHSqH6 FZi+ymcIFCrhZVcYhty3fAMlxNluU+50qVx5nNi/w8lySqNcSMOT5V3DQswuK6fse15T t9WCttN+WRDiDcCiPu9ElXUhjsZY1N6xrzIMUyj+ZFyuHAvcWLD1WTrcIWWd5fKeKNz5 /L5wI//E/ESP5N10f/XVCUy93U7e/SHpgXbu108vFj2/xxnIoyvv956PYvffCVH4MJQg pA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v38cxu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:47 +0000 Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKSBUm032287; Wed, 15 Nov 2023 20:34:47 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 3ud4v38cxe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:46 +0000 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 3AFKJ06o014625; Wed, 15 Nov 2023 20:34:46 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvv7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:45 +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 3AFKYgHK64946494 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:42 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C055020040; Wed, 15 Nov 2023 20:34:42 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7150720043; Wed, 15 Nov 2023 20:34:41 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:41 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 20/32] s390: Turn off KMSAN for boot, vdso and purgatory Date: Wed, 15 Nov 2023 21:30:52 +0100 Message-ID: <20231115203401.2495875-21-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: sORo9VaUfpyXlGPcINpF5RzPmD7I3Yie X-Proofpoint-ORIG-GUID: BZ3SG3oEyN8wfwQEeBvu4En7U_68x4iH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=0 impostorscore=0 malwarescore=0 adultscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 bulkscore=0 mlxlogscore=758 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7111E40018 X-Stat-Signature: 84m5t34reac1jpm3dcefpfszr6ugj8ge X-HE-Tag: 1700080493-881958 X-HE-Meta: U2FsdGVkX18EOu2tzI1+aZz9WIUutL+zLt8RYCr6Mqh8WXTzUC9GXLZhNe0DzOFoex2Pg9AqORbYhmDmPK1UGKqaaMFyvimriVlNYtRwwBY+OyK3fdTwNnKSUvsTIdRU8nWZgEnkFehIRb+r68QsNQq8QIAmrUsK/3AuziRnDNYnEdvAp5zI7GPhsYT2+xCXImeAh4wq79/x0YF6L2iSGBMR+hdYeA/nDz2kg5Auqwxc/bOIXJSj2DEz6gxLyy1Zn02XBCGRtxoOL+dbwHsgADpSlOoA7gipHvffcnVpx/kIa/5qvNefQBMzZLrhGc1oZO55/IVlzDRLUTb7iz0Bdhf74pw7M5jKagivfWnVhj3alDCfNGOVE8Zz39/kDbUdi40L0D3oWIbAd18nKf3qnTXG0+7Bn3RxDW/XI5U5koyMnRWdLn11gmgMt0oDR4CtiCdWnxg5KaU8usRt6WKQwAyzVeL2vPC1d7YfhRaCFc0KXB9ktFp7fTN6SfpLUyVVkdf1hgdaO8DDvbaIMUgrONXkyxacQOSc0g1HNWGyFxWjkRmxgYF2eCMLFCRzZ4LsnScXSrHlRw2LFbid07sopVu7OrBSvBZQl402kFrMH4sD+T4G5HsxjrzGWoPHGnomL/Sm4U60dOEb7RdPhNLa1CA4atj7a+4992FkpClp0LGcRNS1Xrk2O7Qdp5HtYmP4ZVB4qD4ZkszR0wP+i+O7dbFdkJzXkrn22MKmUrhZ5lMerfGKcxDsgArKiTt4RY/nAtvqdfpqSsQEGN1d7dessctbCU2bi4umEODg7JK5tfyX/HQHM6S9WGL5in8zQ6gf1VEPY4HcJaH673UomnrUtVkSmy6SugbANMo3gCFEk1BrIHzxBL3FJev/Ztbua/FKnugAFxyH492qPpsVPRLa3kH3ZMSpbkFdGXv90as8roYjnqVlxQygFnLLOPuEO61K4siTdaRpxMsE5Illsy3 3KwkSdkG FW1GKb70Fn7lsUA80If3FqDs+Up4PnnOzECAz49GqRuHYTiI5FegqE/6KftFxwapOOywHBRUBbvQSW4AXwqzAlH7CTVn+iD7PAqJullqFiEna7HMraZIGdYgOu5b7nh0J3hnchS1xMgfxsFEMNVxKIHPuXEXJkZBmrYxi94J+ktUyFtdMHkFYmf9AJoDIseIGjaQwgWonwn0OC3Cd7ymlQJW1rA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000014, 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 these components as well. Reviewed-by: Alexander Gordeev Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- arch/s390/boot/Makefile | 1 + arch/s390/kernel/vdso32/Makefile | 1 + arch/s390/kernel/vdso64/Makefile | 1 + arch/s390/purgatory/Makefile | 1 + 4 files changed, 4 insertions(+) diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile index c7c81e5f9218..5a05c927f703 100644 --- a/arch/s390/boot/Makefile +++ b/arch/s390/boot/Makefile @@ -8,6 +8,7 @@ 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) diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile index caec7db6f966..8911c55a7f07 100644 --- a/arch/s390/kernel/vdso32/Makefile +++ b/arch/s390/kernel/vdso32/Makefile @@ -37,6 +37,7 @@ GCOV_PROFILE := n UBSAN_SANITIZE := n KASAN_SANITIZE := n KCSAN_SANITIZE := n +KMSAN_SANITIZE := n # Force dependency (incbin is bad) $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile index e3c9085f8fa7..f4f75c334d59 100644 --- a/arch/s390/kernel/vdso64/Makefile +++ b/arch/s390/kernel/vdso64/Makefile @@ -41,6 +41,7 @@ GCOV_PROFILE := n UBSAN_SANITIZE := n KASAN_SANITIZE := n KCSAN_SANITIZE := n +KMSAN_SANITIZE := n # Force dependency (incbin is bad) $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile index 4e930f566878..e8402287b0cd 100644 --- a/arch/s390/purgatory/Makefile +++ b/arch/s390/purgatory/Makefile @@ -20,6 +20,7 @@ GCOV_PROFILE := n UBSAN_SANITIZE := n KASAN_SANITIZE := n KCSAN_SANITIZE := n +KMSAN_SANITIZE := n KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare From patchwork Wed Nov 15 20:30:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457296 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 16298C54FB9 for ; Wed, 15 Nov 2023 20:35:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9ADC8003A; Wed, 15 Nov 2023 15:34:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D16080038; Wed, 15 Nov 2023 15:34:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 825D08003A; Wed, 15 Nov 2023 15:34:57 -0500 (EST) 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 6706880038 for ; Wed, 15 Nov 2023 15:34:57 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3E033B5358 for ; Wed, 15 Nov 2023 20:34:57 +0000 (UTC) X-FDA: 81461342634.22.28CC798 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf07.hostedemail.com (Postfix) with ESMTP id F0ED840006 for ; Wed, 15 Nov 2023 20:34:54 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=BBqatkro; spf=pass (imf07.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; 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=1700080495; 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=P1cjC4XvfBd1ePaZbVyG74nHU4A0jWJVPPxmf/C+hLA=; b=mHur0hWfzbW7vYpez8FCWi2k6CP1Twuh4yZj3azdLaMGID5iayTC49GLusJT3AjpOtxWSr Y5Ekv0Xyraq27lXt9gGlxRPww485mBrtp+6LxpsZNzaqL2Ey7EhppmXEI9NOUxrBPVSa4I ojnqXVZhsDAsijGDBE066J7alORKid0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080495; a=rsa-sha256; cv=none; b=zMj7OWoaX7PwKxb5/sw2BTY8aYbkAUE1hTu6KqCB/+lZ3k7UJYlFlFjlqDwkB8U4sqLYym Skq27df//asVhVsauQssXM2rqq8ZRkd7efQ2RMsUd16g1Jz5SX7o7dCr9kYqEqzcZioU6+ hXYCzIMtHxwOXIa7l0MzTErvXeAhVEc= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=BBqatkro; spf=pass (imf07.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKFduJ016274; Wed, 15 Nov 2023 20:34: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=P1cjC4XvfBd1ePaZbVyG74nHU4A0jWJVPPxmf/C+hLA=; b=BBqatkrohvMlJ0ZVdGnCtZFdEh9QifqfuosrJ5enUrOyRomCmLuHkVHew+XBeCgt+5YV 4W+vbG1oZDmTcDF0zwOmdk5SLjeLU/43009ocryPdPXPSDXsYmRRLHTvAEnsA8oJKcSq 5TdPQfCSqXXmLfAI41R0oGktWUf5zHTlVHXYrfYwfvPfmAsekEzmdmpp9v0WHw0OQC70 Kioo8/OU6VmiOrEJSh1YV3fjf8niq8yUGuTkf3aGLn+JphTIfidM8xYz4tSFDTJ7b/Mj cNniSHa+6Z7ISUnS1ttJGr15qHKAysk7bZnv5iLihoP8XMWdMFqPQqzg+BWhUGlwMSXQ 3A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v2rb9b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:49 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKXlFH002863; Wed, 15 Nov 2023 20:34:48 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 3ud4v2rb93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:48 +0000 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 3AFKItQs021588; Wed, 15 Nov 2023 20:34:47 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uap5k9kce-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:47 +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 3AFKYi6N22348502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:44 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 984B020043; Wed, 15 Nov 2023 20:34:44 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D66C20040; Wed, 15 Nov 2023 20:34:43 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:43 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 21/32] s390: Use a larger stack for KMSAN Date: Wed, 15 Nov 2023 21:30:53 +0100 Message-ID: <20231115203401.2495875-22-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: HoxbfhrfP30Lz0w1WSeNKxPtFqv8h67h X-Proofpoint-GUID: EtmFvFe8X0_C13hfBo5WWBLzEHggaJhJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxscore=0 clxscore=1015 adultscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=905 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: F0ED840006 X-Rspam-User: X-Stat-Signature: h5abn8huxx5xqoq6rp9htzficusqcsuz X-Rspamd-Server: rspam03 X-HE-Tag: 1700080494-318945 X-HE-Meta: U2FsdGVkX1+3FJH/ywP1jcgpPFlUg6LfWSpEO+c3J+eGsvlLX7ja5FVKeE4AAxuld3JJ+xPMLwPp1YI9TMDmae8u3DWXRpohgtpc+34b6eoY2anyHycpPdaoCgLFs9jcl+V8BNL4h5kB6fXjjqFd6Ke7TJwSxBcFJw/KUOjNYENtp6HJ/vCvnDz1k+PqviHrjAEjvWpxz1Z1wP/inUwJbJUBHluc2xR2AHj8Z2HVpFejl/XKmsW1lXsvDgSmw96N8RgEhF3hmz26tuEincCygfVzNdJQIOcnF2cVWWLmtOREU/HbguUI70RxGrUfO20hOEXohN3Iy7rQj0XZqKst+CUZ+8uvWMp3VeaOOl9bl14ZpBZ2QCd71S0EQTZKBhQqlbyAKZZLZjW5xqR/CKsoXe3Ht66qKTdz6yw4IvHe3QkMtRDLvAeq4frTP5Qq9eHrwWVG32rlMSSCh68EWnkaoVCmaURhpoocikWUuG/rbsCgZl5YUlw3z8d3BJkb4lNRMp1S9Mvedod/8ptDjQDa4i99fONvFHhweRGXFVYV5bFGa29iubNqXFbEO8JP9Ed1yWgWivwmHUdeBZfddqj2XXetuq3Rn4z4swO/BytQi7YapUnSv68WJwDGuy1aRqtCMEyhr2pHOCk8tt+cepgDzekcXuUyL/AX3nFVJIKIaMuGydqn4vVAj+6nIsxVIl04+ny88JhKFwQ65JGS0see6oHm3xf5NI+CWpDjrkCVtzObmeiBXLB+28CmRaZwp1YbiEciebT2xvChH7yP5JPzgGJZ3Ykz90DsUTAgvef3sxT+IyS0/MAuhLSJqw16SQCq4LKl/KK7ezoFeFrMDSAeC3H3qnFCtT9t7eIIKW0mA6+foc49cO/tDZNdhhA1CO4PKXSLcVv1uPYfjLJGIKq4ZqAGdaEOj0euek6OABpAx+AaPVPiQ6emlHzys5QnuhrtMhZZK5YF81VXWcIadIn DA0v0W4z Rm7VMjVATKap6x3FmYH/eqV2hYcZAAFQTPJZ9D0n1yGJDmpv4JNsupUObcOU4yTE8EvNqOqmbjlAXx0C0hSn8maVCyuFTBb1icY8uZbJ8aYswpH83JkPkql/dB9ym08pk/vUFvPTfr9myMuZFzQmJd26wXTiEghjRw4o6mD2hZvaB8U2gAl8HAFZXbvglmX8VH/CeLeL7SKkJUGsnbkJpxNuJPfSbwduhGsnZohwqcQl3diqltomEHd9RFe8ETMCNR+705ldh1Y6fa7zr9KDgQbBTN+N4h8zXkYamKh1W56rU5gO2Twn8QxeTqA== 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 Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- 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 73873e451686..a7f5386d25ad 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile @@ -34,7 +34,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 Wed Nov 15 20:30:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457297 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 5E731C2BB3F for ; Wed, 15 Nov 2023 20:35:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A265C8003B; Wed, 15 Nov 2023 15:34:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A83B80038; Wed, 15 Nov 2023 15:34:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D7098003B; Wed, 15 Nov 2023 15:34:59 -0500 (EST) 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 6278180038 for ; Wed, 15 Nov 2023 15:34:59 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 43193160AAC for ; Wed, 15 Nov 2023 20:34:59 +0000 (UTC) X-FDA: 81461342718.07.267FADE Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf27.hostedemail.com (Postfix) with ESMTP id 0271640016 for ; Wed, 15 Nov 2023 20:34:56 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=EXuxBFfm; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf27.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=1700080497; 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=NhhCYesztOa7Jqvt4x0Jdgg/9LLiWk0vF6FRHTpFEGQ=; b=GQtn81JPbLGsxB+guyQI5mNKMDjLZqQA1pdSOLM0uPN5OsQxoFh1UBvUA7mkDXgP2Y8hyw PQRqshuaY1OFUKx5oo4sKCG98QdxxHBmKewA249J26JgWm/zPiZahVdptycflVCQvitNcW DCn0/vgMG4IbLGTYTjdk7vU0kFVP5RU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=EXuxBFfm; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf27.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=1700080497; a=rsa-sha256; cv=none; b=VERG0eu1VATLfJMTt3E8MfDEI/hdygytaami98uVSJ7RTjpWF2tmVnQhirytqtyBCoyuj/ 1UgZ2NQuyOSRz64k/2obaoJ8ABEp1UVKS5j1Bnsqm7VLy2k3wJW7GmVZVSZzXKK4B6qZ88 CSVXK8S1GUJHlUXGSpjwfd7acTMW3Cg= Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKKGMt020174; Wed, 15 Nov 2023 20:34: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=NhhCYesztOa7Jqvt4x0Jdgg/9LLiWk0vF6FRHTpFEGQ=; b=EXuxBFfmlBxmPjShKXyWRnqdsbxq97IsJbT/Ks6kWrcaswZ6w0ZpMUCZ+yg7uoG3ILdk Mt0m0AtMCHIDaAgPHVErnbPvnAwe6KKpRm50cCb4EG9liRFF1h+N1xP4T+nQFifkXvi0 qe1glwAzZKXeHJOqs5iItl8C+vCOEQHKN2o3miCs/gaxQjkxDYNkFoCKsCP5AQUKhIYX aoM0vLhzuZPCYdFf6Xg2vrpO6pLSfLTRDycsiHi+EUnAR5gqjmIQJ4iJm7wOheGMogGu q93nD8AHnhTCLdZlJ5e5ezvm8s65u3LZuX+6bwqr7Zo0ZPa2KL+rWuajwsRQj0HTngmU 0Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4xc8cef-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:50 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKLkkX024302; Wed, 15 Nov 2023 20:34:50 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 3ud4xc8ce2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:50 +0000 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 3AFKItQt021588; Wed, 15 Nov 2023 20:34:49 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uap5k9kcq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:49 +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 3AFKYkcm23265800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:46 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F4CC20043; Wed, 15 Nov 2023 20:34:46 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01BB120040; Wed, 15 Nov 2023 20:34:45 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:44 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 22/32] s390/boot: Add the KMSAN runtime stub Date: Wed, 15 Nov 2023 21:30:54 +0100 Message-ID: <20231115203401.2495875-23-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: fkncNkpgvEQiGUZcGTO_3XR7T-3cRmrK X-Proofpoint-GUID: 4uSiq2gXcSEbCiwoTCWkXAyd40BPgJJa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 suspectscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspam-User: X-Stat-Signature: 7rc6rn1u5hyb5patkmnn1bsrqp9ecqia X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0271640016 X-HE-Tag: 1700080496-843160 X-HE-Meta: U2FsdGVkX19pSb8l2R2nrIt+LqwtjRCNkyStF/m39q8A6gawJL3qFQvM5144L97DmqraAl6KemmbUw7xOAEjGrggWEKhi+BRJx4RqqPELFj5cJoDlGzthEJUTj4BSU/SS0aw+QfnDIIiDgh4RKqMdsiPpR1qAMGuHf/0235Vnf15yZNJ2Z7D8q4cDiDSFwbo5aYoLWmaiBK5CLG571nphRO9naaOI6Xq3iHVlOZ9FwIXgfxJRgSb1AbFeskwAXm9e5L4bpAYSjoDePPK3hPKpRa7+nChONkHfR1FN6yDSDcBc2IcVsAJIqBXHjXSopXVXdHv6gYbX06Dk7Abgh3Jbrx1zSlR6/W61coFxzhGSqc0030aCVxbiv3ZyhXWurMq83UD+oPJFw1i7qE+c8iGqhYJeztqKekU6Kma8wtqFthLey9zjoaoHTs8/f8eVWd50rqAGMwjQJhFC61eOEyJcW4vKY6E09EDxFmtmRh3giTiDs4xPEcnGobU8kCU6+Pug2KChd2V11WYrUwCU29NP55TpaR9uH2iVfXFNQ/92Vfrb0yBlQMI0NmsYp7bhqe49KBd7sxS0/eTT86/t8/P2p74ZWxbHOvjFZwWCR04Zxpl0afes+F7Wm2yWmsF5lOfkUBz6s3/QMmYR1fbE4dMQl9dTNDQfmmQ49t5+JaNLrmG/uje5XzRrq30rHbXV7DXk+O/UJ5asTfKGhjpxUfGWMv8DFhB0isdxzL+OjMkbC0uUoJtrFEaVQxozFm2HXCP1Qyu0aPfPT12mxLEGxmX4BIgUOaE6BXdVdQeev4gm6wk7yFr9Yi1AybUiFqBtaek/PREnrRuQ+9478SBKJOzdJP6ZHzMtl3PsmHkI1CxYuvS2VVvP+F1w/ywh4b0N0nhiN4/JqhsGuxQ/f3wMCopUymUzZerG9s3vyoh9Ve8fXtSR2W2DLErsZmM/J6Jmm62i6tMtRMwf9FxsbdyoA3 efg//gYz FuUYbKziJz2lnUnxG5wAKa9HHLiREmZw25U3dqk0b/we5JAbZN1xLpfGiaO6xCvMK5nOqMR2HasXn+m3RRyMrroJJdMahW0EPz2c0/l79rwxgU4CgTERJYH/7sWVFey84xImpbGLDPDs3gfxGJpDcsnXoK71KfqnwcxauF0DhzhxK8guxbpJ7BrciHg1/rGa5Gvw1qpfoUkLa+xhQ34al4F8gzUxh2OCoFsD8qqxKCku8CIthUCo6PpxbBq3ElYtCercDJKWHBUP1uGxmJgIkAqARBuxQDfkarO2sinbWRSECxya5KTAJibe34w== 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: 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. 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 5a05c927f703..826005e2e3aa 100644 --- a/arch/s390/boot/Makefile +++ b/arch/s390/boot/Makefile @@ -43,6 +43,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 Wed Nov 15 20:30:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457298 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 B9C92C072A2 for ; Wed, 15 Nov 2023 20:35:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FC578003C; Wed, 15 Nov 2023 15:35:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 78A9480038; Wed, 15 Nov 2023 15:35:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B8738003C; Wed, 15 Nov 2023 15:35:02 -0500 (EST) 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 3AF3B80038 for ; Wed, 15 Nov 2023 15:35:02 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1B505160AA3 for ; Wed, 15 Nov 2023 20:35:02 +0000 (UTC) X-FDA: 81461342844.08.5EAA080 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf24.hostedemail.com (Postfix) with ESMTP id C547F180008 for ; Wed, 15 Nov 2023 20:34:59 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=E5bEhLE1; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080500; 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=kfW8KavvUaBQqtKF5dduUkWqnOOlkspXX2HeV3sVIpc=; b=cjATC3HCx1Mwe4H8dlP3TIOMs1yBB5xXtGU48tETkcc9k0Ek5RcAcomuI86u247K5sZZf0 MjitJCv98jvO1GZ5dTYZJ5+VKl+2ytoJreWC5KvS8Blv0kYotUbzaTka/mmOpCblRhMAIu 3RHV1K0RZUGR8utqF6dGFz0jVf1qKK4= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=E5bEhLE1; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080500; a=rsa-sha256; cv=none; b=3TJRz01PcNA8rOvamcMFiPTftCYz0/2BTU8ZJXQFOiKVVNdHr0ezDdo3qYpU02JJAsaXGP D1fzj5kP4KWrgFB8ToWVd9n9I9QE/t+R96luLfOG6p6L8xATkaPed6Ju884F89jPQhMKO5 vWJ046hMQ3fHpOklUZwp7wZUgZGVADk= Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKHxQH030223; Wed, 15 Nov 2023 20:34: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=kfW8KavvUaBQqtKF5dduUkWqnOOlkspXX2HeV3sVIpc=; b=E5bEhLE1k4gQO/U6SLkjqzBZ86Y+12JJisdA52XFFQqUs3KwSI2TnPbZQtM5iRIsKNXG sY7cKYE7c8mMeB1jWX9dyiogeaZltQhnu7jl5w2d1Q6nElbiPyMf009W4Ve/a/0O6EOG 5gT+TeYSQP5BA/dJxTnH+E5zMnoDU8XM9enaJMW6HZFPL1KRz/Lw6sq0qSfZ22+lkgHG uAdABeJ0IxFT3wY63sQdhV1x14OGYmqElEn2i7sQMmXefUtGGcQWF7XF6TzBV6b93D/7 0TeIBhbQTD1zsn10luiFaq06/lC49dnyMUc2ZnwQZud2RYeBOFtOj3CQ/F/03IpmLS59 Dg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4w2rc4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:52 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKJPjI001881; Wed, 15 Nov 2023 20:34:52 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 3ud4w2rc4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:52 +0000 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 3AFKJ1Tk024874; Wed, 15 Nov 2023 20:34:51 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uapn1sj94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:50 +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 3AFKYm6042074868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:48 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 108EF2004B; Wed, 15 Nov 2023 20:34:48 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B4B8E20040; Wed, 15 Nov 2023 20:34:46 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:46 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 23/32] s390/checksum: Add a KMSAN check Date: Wed, 15 Nov 2023 21:30:55 +0100 Message-ID: <20231115203401.2495875-24-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: K4Rwon4YSH9HOVwscBn7CFE6ESwPGPsU X-Proofpoint-ORIG-GUID: J_mHkBdjQbZ597hhWyOrstqRqqNqOBMX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=864 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: C547F180008 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 3d6ohtdckat61hkrgehpx6r9ykjk3e7k X-HE-Tag: 1700080499-892585 X-HE-Meta: U2FsdGVkX1+5TBqLYwNmo5wRBMNMiRNJHS5t14S5pDoPDwDNSFOWyeVhUn/x/N6FWUoG5VbpbKFx6bffHsYge5fzMViOxSYG8p8orODBJ4CiGMko+BO46w5tZGEybNLzHMwp6mfg0Fh4Bz4ESNJeFFJ0UdxqYm7u4bO67zILPt71BkCK8/yoeBhzSYJldNYMeFlW8/GGQ945ZO/yhT5Ls/AU4pED6NV9sf5NcpaP3Hfo2VIE7y5SMXIC36ZmvFpFJYkdban0MIN0GHwx6XGUswMilKs3BPzCN2fvKvm5iwDVRzcvaUCuQv0ymURflSy4geZ8h8zgvgtD/U7cccdXt9LhJ5PpiIkYbUICauyCpn1Ree5N1JRiTVbPShnh3dwgSZq4ZgdKfGAbYYvz7mLDddllcJGEIEmC2KHfZkiflXUP9qfIczY+4fPbgsYIhn0rzaICFhPqVMhT7NmVl+X0AJ/TTVTgkA2sSi1YRXwarNGmkeMORQulDAjt7X8KLJXjhjClIVWjj53rc/0Eo752Ok1FFtJY2libb1TJeWPKIiO3AJDmeo9tSWI1CdlUuGJLkxUSbLnB7iDEC9I6ozeKRj1uuPDWBvacB8hpD33F8zToXT8LRE3mu1L8opPsD0wVCOe3OBizEKb5X96hNhoZ+wZwIz/MbQYaaWwKLdo327PiQxxIF2vXwOB7oc6zTZSSKLQk/aALpG1QUpTi9P9sdezLjAg1xL7uDIc+9KIh6d7WBT4ke9NyKJa7oVv9Qjp3IiU33BhMFGiIGHBVKAhjf8Dwsxv3AX+AJuDP3c4CbyfQpTaxhwf/vsoiPBaKNEjUb8vu80ieFmlgkirepK1mWJXN90lPODuZpYU7K1ZXO6XLlqgfrgWu7DsLcLtc3j0lN+BRJN0UgbEXh3udBqbon9Bbaak7ARPlvH09TRp/Vz5bXXbQDAfmF8q5Jjhv7buwgswo3MvXN+exNP/alHM mzzbjI9m glI303X6790QpHI1jhEBanA0+RKVGiFbQTKbh1wpAW/U57y6MS0IHfsEaJ2tHF0BM1nkdu3S1waSJ81x2dNyFD4tKUwXjU2KTJrWeCbDINX0lpyK5PlYxEuLPw1hGgCfdp1Z2Ck0jpJWonLku+FFiG5d00YzqMVaShBqcbXknZhxfAtVEwMlvt2tSfqrP/eRZZEluYdR3ICAtpz8QDcJIlRtMh+78r7qcj2oYVc+JQN/0tNN2VfcKJ3BG0YEZ0noViLp9xSIiveIT/8pXhJ6y2vqzSROGqnMvjjwY7iDaoQBmILE5N9kNHmn3JrPgLq1hPhn+EPCYidwqkHJG4Xc7md98XTSX327UKMJl 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 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 69837eec2ff5..55ba0ddd8eab 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 /* @@ -35,6 +36,7 @@ static inline __wsum csum_partial(const void *buff, int len, __wsum sum) }; kasan_check_read(buff, len); + kmsan_check_memory(buff, len); asm volatile( "0: cksm %[sum],%[rp]\n" " jo 0b\n" From patchwork Wed Nov 15 20:30:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457299 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 1AA6DC54FB9 for ; Wed, 15 Nov 2023 20:35:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36ADE8003E; Wed, 15 Nov 2023 15:35:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CC7D80038; Wed, 15 Nov 2023 15:35:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 120538003E; Wed, 15 Nov 2023 15:35:03 -0500 (EST) 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 EB04280038 for ; Wed, 15 Nov 2023 15:35:02 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AC641140982 for ; Wed, 15 Nov 2023 20:35:02 +0000 (UTC) X-FDA: 81461342844.08.C5FFB63 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf23.hostedemail.com (Postfix) with ESMTP id 70A31140019 for ; Wed, 15 Nov 2023 20:35:00 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=tM5UQApw; spf=pass (imf23.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080500; 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=6cPRly3Y0R+ewW/cAplLp4HHPc78tqbgSvA9QXIrbXE=; b=c3xbSF6Xg4HMMAb3nfP2yY+hR3F99uwdorkT6rxjDA6dpHtn3kMwLGEhJo7VG5UKSwoa85 6qrKHOWhKKWOdv5ujlteFDrNQCcjf/caCRni64LW4MIBHez/pp2WdbiWJKwUP6PtOOfpHZ lAvjPoogYXMyCEsl116MmUb1KXlW5fI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080500; a=rsa-sha256; cv=none; b=hT1R6tNStUG1+35BBSy8rWxNAj5Rvzo1brXevs47fd9O6LYlnxqHbRSMvBMSVdoETXiGpm 79A1QkyVI+ej89BxewTqDEQp8W5W5DKrMGK5ZxAWxvvKGsYRNn/2nXREYMQAjhClqEIAYr 6HyqdKcExxIaJC0WxI7Z9nXHL5gdi4s= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=tM5UQApw; spf=pass (imf23.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKKJKW020415; Wed, 15 Nov 2023 20:34: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=6cPRly3Y0R+ewW/cAplLp4HHPc78tqbgSvA9QXIrbXE=; b=tM5UQApw2refpHW+H0do8RKQirmGTqP9fYnuojZ7XQm7M0IncvcAmhUe5V8UKDO1sK2f RIK1MrFM+Clr05LXq9XzM1QHKxDTXYWm+uHGeeXHQB1l7TfvlekNBb0mLIumSHIwuNIn shTRbnnZcJ33cGr7q7R7KeK5D3biE+VhiUghbSo6S39us/9OAz6BbFbRVYDz7PbDKRVX GDSbMjo9fR2XAk+53u7cW5KEzJd46z/BtL1al9Fi316cf+bhCnKJ8Wuwo4UVEUtKsovG QB14V3Li+kq0SSwHv+1evsflEHs1bstYubDzStqdxNjasvzqz/y+CD9emucah00Z5oAE FQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4xc8cg2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:54 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKOWKf032664; Wed, 15 Nov 2023 20:34:54 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 3ud4xc8cft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:54 +0000 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 3AFKJ47T014688; Wed, 15 Nov 2023 20:34:53 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvwk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:53 +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 3AFKYo1122151934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:50 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F1E242004B; Wed, 15 Nov 2023 20:34:49 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A265920040; Wed, 15 Nov 2023 20:34:48 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:48 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 24/32] s390/cpacf: Unpoison the results of cpacf_trng() Date: Wed, 15 Nov 2023 21:30:56 +0100 Message-ID: <20231115203401.2495875-25-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 2hiXuR6P650rcR9fEXOk8WJoi9cn7Ipv X-Proofpoint-GUID: bdGq9jciuCrxPjpJhy4v0KBztKvLqzo8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 suspectscore=0 mlxlogscore=766 spamscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: 70A31140019 X-Rspam-User: X-Stat-Signature: beuog9e1iw63ii6cadog67j9gqqmpcdb X-Rspamd-Server: rspam03 X-HE-Tag: 1700080500-789560 X-HE-Meta: U2FsdGVkX19o6fm2KK/Nh5+CjO/QCC26Lb8K/k2ItuAnqKYGxucjsHhJ0eoOY6iLOnnjVQi+V3DE+kpguMkDLx2KX72R9oSaROKvF/WY9UUrCeF85Nni5em9m63Xr4xRw9UcCZ2UgRaMrcHWeTPrsg/aCQM6NdlnmxCffBidsRIYQJ0h00oucENyPSdNVjgNldSBIj7jJPOgtQANb9SLptaWntxL6aNrbJoiROuMQwaU9K54Y0KF4saeRD1zQujhhyr3xmWMBnH1F7aL6oYZL6ZvU/DdskW3BesJ0U0S1ed8SJv4m4+hn4L1KJdPhCnXbCpaJe9nZVobfwuxaRk9G3QtscD3kk7/Ed7EHSfMEdTP8kG5bji8GYEqa44oupCOOnuIeLCA9GL01dsveIe5fxvXmR4sCoxVqdrC6zSw1TvBzm2bsCWNI8O9VFdYZVT4YlNNlnJXPPbQIjjBnktf8bX0abXi8+AXk6qJIjZGJcMjEcIwabmk13+XxH8QI6OCYOI0Ew5Mgf8lgHIMCtACwdrZo5HirBWPDRwWz22c7WLwX2Z8+ttnJWBdgYpQV3OUCzvEmWk7mCg2SOUbsKdLa/vQ1qvkmRyeq5WDUQZ5lehzCHcXjsvAZs/S3/KMsr1NOmdM0KCxdV7nrwXptIR819M9rKU1b393pq13LlDflFW439fRVuT7BtMqIg3QgpfYwWYbS5LOgnYDU0WPGd78js6p83m007IXxRNEWlQK6wS/nxK+3An7ixsSJUvAqOZ843uCEauTD3BYEkpnFjjJ5vSmiHI1Agslk7jG7Z0Z2bEhcJuPifd7yHbQlzuSG3QsIhg8SzaIl4fcTUyI3B/jR+26wycowjsTFyAxYj8W1WQ1q7mJb2LxuT9TYI1YaYBtDQjKt8T7I9L8KKdgFIDFxuHk9T1HRdk/INE/h7koWQTLeouw2UzDoMF7MLvtuHvQ4RySSAyhO0swoDg3S+T sk6cGLct Hd3xPdc8H2WVoVws0HduWyFdTTM+NASGWpC/yXCEYBCBm4/vqgdQUS5chGfntbJaFpIFtm07Er7s97HTECTKvLzWCFEZpNsOPS23HxsnR58PnvH3jj1kzE8GKMz0Vt/fuIju5CoI7RVEv3/cRzG53PWeQIkMe84tTwC2/0KUa9gLmKeIVpiI3hdAB10PAMTqDVIIi8bYJiGsiMUvN12fd+4ERAgfGitGVThyTlZvMmThdKbgOSwBQZxvkSdNu4nuvQTSVYYVVeZsR6KU= 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 Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/cpacf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h index b378e2b57ad8..a72b92770c4b 100644 --- a/arch/s390/include/asm/cpacf.h +++ b/arch/s390/include/asm/cpacf.h @@ -473,6 +473,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 Wed Nov 15 20:30:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457301 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 1AA1BC072A2 for ; Wed, 15 Nov 2023 20:35:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7CA680038; Wed, 15 Nov 2023 15:35:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A1ECF80041; Wed, 15 Nov 2023 15:35:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75FD68003F; Wed, 15 Nov 2023 15:35:08 -0500 (EST) 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 380AE80038 for ; Wed, 15 Nov 2023 15:35:08 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EF83E1204BE for ; Wed, 15 Nov 2023 20:35:07 +0000 (UTC) X-FDA: 81461343054.23.DF98808 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf13.hostedemail.com (Postfix) with ESMTP id A482E20023 for ; Wed, 15 Nov 2023 20:35:05 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="IoV/CdLK"; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080505; 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=asdPuKgysJe4FAig3LXjVvUDTsM5pyq4fMAhQ66oWUQ=; b=zRRHVlDnP/DNXKKOwm7eMh+PHu03Enewt/4ASET+K+5o447T7qP8w5O3PT52fbKblPK7EM aoASTtWk0arTgA5SY4Ys7LtgoQ7jGmtnSwUMriW9Hisae8HZp/0JN5W6nABf2FfCBthva0 589RGqgxXbWI8+3EX/us7Pka821Mu6k= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="IoV/CdLK"; dmarc=pass (policy=none) header.from=ibm.com; 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080505; a=rsa-sha256; cv=none; b=TMi26ni3fu0HJFS8lhU0venbbT1ksYr7ZuA5oQKXwmDj7YbHbsXInvUkyWCSbSyjdb1vNE jP3jZ06dcXYYm2xpnZWc/BOa3dqBzvonA32eA5GxPE5C80BpyJ5PSuYVTHcfz+nmlsUytT hBTkWcZ33fEoXbTbQxmZSEaRgxH/3ZQ= Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKQk3x031373; Wed, 15 Nov 2023 20:34: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=asdPuKgysJe4FAig3LXjVvUDTsM5pyq4fMAhQ66oWUQ=; b=IoV/CdLKOtJ8YS59KWbuPK43v6ToOxJkopuPBHzHX1OKEI6lF3VElkjKEuF9Kbs0PJsr 9PY1PEKVxT4j5R4qXvmbaNaHHzqfwQew+POtTAn+FxQ+Pp1rLjk5BR/ywGWuQ4XU1eT6 /zmfHYCIeE3GJKaS0pp9Q9WvrHBJG4d+O93U8UxYaNqnuwCMU1zu1JVBf7JjS0rtnIcv Knh9USFDjtE7XzVFXo+oAMwqoYJeOWLmiVYSqIl0w2Zx9a6S21qA8c1VATKwTLx2mRsv CvcfN77GmQpgw88twaU1JZS7bda0zKJSW/qjoARMYLaZvUcXEsOdj/Jqpun8/jmsBqIY xg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4tk8fwx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:59 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKQjbM031266; Wed, 15 Nov 2023 20:34:58 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 3ud4tk8fw9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:58 +0000 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 3AFKJ070014625; Wed, 15 Nov 2023 20:34:56 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvxb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:56 +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 3AFKYrrj22938112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:53 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58D382004B; Wed, 15 Nov 2023 20:34:53 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0BBD120040; Wed, 15 Nov 2023 20:34:52 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:51 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 26/32] s390/mm: Define KMSAN metadata for vmalloc and modules Date: Wed, 15 Nov 2023 21:30:58 +0100 Message-ID: <20231115203401.2495875-27-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9rXu4AjXUjT1J9zSVl2CpI0z2C-CA11e X-Proofpoint-GUID: s4ZHT-IpHSSL7EXtoiGwwWPzfBiMndPZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 adultscore=0 clxscore=1015 mlxlogscore=839 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: A482E20023 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: jsnghemyrmxpijyg8mcxtm8uwppc6e1u X-HE-Tag: 1700080505-840636 X-HE-Meta: U2FsdGVkX18pwY6VewIrTPZDSeH9WLfnCG+S3v37CPhtImycYUcddhImgfxy1WNZlFlLC+3kuaKuwcPuyr/baA3gPr2mA/GYeVUW6lcHw5LEn/tYXuVgmUPEvWwFKCFtueEJ1kHAEHVixXt5ks8jLCWQ2SY+2hGZ+1GeWetbUP08oHdapI4U9VbQ+79RDdufWMdGZR+hupi/XXAdwFCa/4PTr9C3/8Y50ukYtsOZE8jE3Zj/7MXKG6F3XoXo+Nnga+HHWFmn77kPKEAPiXHXvOPS+NcktH+arS4K4sapbAVziT11LBouZkcc74R0tgKiXVHe+QSxLdd+ZQvsWtlmqkaghagKbbh2c+U+lNICQZKh3b9Tgx2+YnaNI4guJbN4jTjpfDWuOzXvUi0fN1BkLdne/OkNmKdENCbbaYGXLiW5mdV8QmfB53y7QajCdaDtdP3UG7BvFolDQHK0QZU25xYBAVssVrniPMKeqAmavRdazcqUuSIfQNQg6ymwpqZ2k0rBGtNMThE+Lewkvz3AG9J9cBBl6DMIp3skDNeBTKTRGiVALVdDbaHL564yOR/DGfxvwJtGRSpaHsx3cDOQ1BDtysnQHH8m9ItEMkzT16kxUkenI30if9lx6nl0NRVtvjIwdp6B/D/1y+I7+yvrL6k7+jl4Q4BA/N6Sk6SyyGb+auelW9OVg7wlHvd1gobDsTUdZx1Zqh8j4sX8Fal6kt1ACoPxt6b7vy/NmS938C2WYH3EV82/FdND66SvhIWGSVT9x/hAMu5oGTLOY7mRsbUXtCsisqzy0fd1nqWbCmTVj6yidN7Senx3m06374yT0I6ULKMUOFWRLKLdHSwlmKZZYyF7r0icKkiKdQnVABlu2vdOpP1LWJi6l6FFyRs9+Ut9XylCZ5qsxHtRhb9+ANzFt7y1upR+eJ0aGL2BkORWmduuSOejNTnuh4THZQWzP176sgSauzjvwHhEOEs NO2ChuNO /+Q0M2WyOkbuEA1xa1rP+0nER9RGfDpWa0M9Ztg2OVFleDHI5ku6qBzT5qRBhEAZPeCvstG5wdDuNVBwjVxS92h+k6EZlZwTzNUWF2SQtLlTVC9alK8mnqxKLiNG2qsOeaaoAuTvG0nfOyxYnJA6wUomebQoND3TiESJ/gShwbrHBaXYK8oOMet+jCsjjkV2ZUhH6HjVEfjJsSu+nHelaj5xfuw== 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. Signed-off-by: Ilya Leoshkevich --- arch/s390/boot/startup.c | 8 ++++++++ arch/s390/include/asm/pgtable.h | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index 8104e0e3d188..297c1062372a 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -253,9 +253,17 @@ static unsigned long setup_kernel_memory_layout(void) MODULES_END = round_down(__abs_lowcore, _SEGMENT_SIZE); MODULES_VADDR = MODULES_END - MODULES_LEN; VMALLOC_END = MODULES_VADDR; +#ifdef CONFIG_KMSAN + VMALLOC_END -= MODULES_LEN * 2; +#endif /* allow vmalloc area to occupy up to about 1/2 of the rest virtual space left */ vmalloc_size = min(vmalloc_size, round_down(VMALLOC_END / 2, _REGION3_SIZE)); +#ifdef CONFIG_KMSAN + /* take 2/3 of vmalloc area for KMSAN shadow and origins */ + vmalloc_size = round_down(vmalloc_size / 3, PAGE_SIZE); + VMALLOC_END -= vmalloc_size * 2; +#endif VMALLOC_START = VMALLOC_END - vmalloc_size; /* split remaining virtual space between 1:1 mapping & vmemmap array */ diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 601e87fa8a9a..d764abeb9e6d 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -107,6 +107,16 @@ static inline int is_module_addr(void *addr) return 1; } +#ifdef CONFIG_KMSAN +#define KMSAN_VMALLOC_SIZE (VMALLOC_END - VMALLOC_START) +#define KMSAN_VMALLOC_SHADOW_START VMALLOC_END +#define KMSAN_VMALLOC_ORIGIN_START (KMSAN_VMALLOC_SHADOW_START + \ + KMSAN_VMALLOC_SIZE) +#define KMSAN_MODULES_SHADOW_START (KMSAN_VMALLOC_ORIGIN_START + \ + KMSAN_VMALLOC_SIZE) +#define KMSAN_MODULES_ORIGIN_START (KMSAN_MODULES_SHADOW_START + MODULES_LEN) +#endif + /* * A 64 bit pagetable entry of S390 has following format: * | PFRA |0IPC| OS | From patchwork Wed Nov 15 20:30:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457300 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 2093BC54FB9 for ; Wed, 15 Nov 2023 20:35:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BB6D80040; Wed, 15 Nov 2023 15:35:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D2F580038; Wed, 15 Nov 2023 15:35:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B25580040; Wed, 15 Nov 2023 15:35:08 -0500 (EST) 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 406D88003F for ; Wed, 15 Nov 2023 15:35:08 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1CD601CB61E for ; Wed, 15 Nov 2023 20:35:08 +0000 (UTC) X-FDA: 81461343096.21.32AA0E7 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf11.hostedemail.com (Postfix) with ESMTP id D43EA4001A for ; Wed, 15 Nov 2023 20:35:05 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Um1Q9Qho; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf11.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=1700080505; a=rsa-sha256; cv=none; b=35b7gSm+jVDHIHejVSy8h0YkHT6zonwTM3FSqiO9drRx8pB6KJwh2e5zJpiha4P9TPrphW yWUN74GDSxhS8aQVnpzqNdR377a62N52y5lqsJyL1AwjAV49tkURjGOJWs/oudJCM5Mpsv COO17AjUo4nofXg4lcYLfgQDcXp7odw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Um1Q9Qho; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf11.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=1700080505; 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=nq9e5Kh1g7nUcH6hHoYLD2BDAEyO/grN3klBejPwfzM=; b=DZt2nblggeHhisM26/aCfXNBpwE+Rvx8nzY1iLPZgWSpSe1Eg29tn8ZnWJHLJhxXMD8V0n RQ8Y8cD1cJx5rbn1ZwdllklS8Psqf/ta/WT8XyI4ZzMm1ydC2cvQfNVihBIrXgYxkQLLok hvzUqO5SA8TTLN9XQ95OC/GpSb7Dp6A= Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKKGTF020216; Wed, 15 Nov 2023 20:35: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=nq9e5Kh1g7nUcH6hHoYLD2BDAEyO/grN3klBejPwfzM=; b=Um1Q9Qholsw0ojBN6dlk7AT6jZ6hU1TGcl9R0e2Pzr0R4Sr1cTfoFznAb6kOACesvz9P pE5ItJ2GD3cWNrOMSlPSpQlWX/UGHivgwQVS71xIgVX+3qxj+4D6HDxqLWC5mgYx3Db+ /3VARMtbx7BW0+xDGLvueDZ3l3vgA75iW/oufkHI8iQXQcQJduEazYnXeYwjNFf51cmv eKwt/HptZV9/jttbT0tpVOCwOtzrVkoomnrDCoyWzufLjy14QPn9tFr+ioProi+NvAfT qfv47VzXcCzJXyZcbAc8Dc8lntbalZc1g3fJ+UXUTzYtALSgIFsPhM2RPubXHJbtYFg7 zQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4xc8cje-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:00 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKMA2V026068; Wed, 15 Nov 2023 20:34:59 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 3ud4xc8cj2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:59 +0000 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 3AFKIusa015453; Wed, 15 Nov 2023 20:34:58 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamxnj0qm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:58 +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 3AFKYtlr42074872 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:55 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC46F2004B; Wed, 15 Nov 2023 20:34:54 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A57520040; Wed, 15 Nov 2023 20:34:53 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:53 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 27/32] s390/string: Add KMSAN support Date: Wed, 15 Nov 2023 21:30:59 +0100 Message-ID: <20231115203401.2495875-28-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ui8k3Y8VmDpWZcOWLfPqxXUDgEJ41dXf X-Proofpoint-GUID: UXrJJp2IUCZ86lgkxA4hnMPl1rgWzyiC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 suspectscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D43EA4001A X-Stat-Signature: bt414ipj9shaxhe7fntkzki1fpp46o7p X-HE-Tag: 1700080505-703186 X-HE-Meta: U2FsdGVkX19V2n+v5DClyhsG89adVAdd2LHK5l39J2CrvuKlJI1JMqJGCtgk+9hSnvm4KDB6xCHVhWthLjSN7WbVUYL0iieIY9Zra6JQbPrF1Kmn5eQemsmkflFSeVXmZu5zzegKZfs1vqalI9fWr5Ct2bZup69+fgkI3s1DzpDqEpCVp1HjzEXa2z8dMOmuRUes+VDB5o5CJIMOiHbEekp1VoCs7wshgmLSRatAwUSEaAbHoUsnikhtQRcvv3OjWxPxTKJmIYnm544yleAA6FiTgR3xQk56lWTUQyav6o9Il3mtjstAXN4D2KmmIsLlpkccShCf+x+QNPIje1Ii1WyanC+/p8ipk7Kc+/Y2o2JvcfyulLeGeyx0/1lvmqdhiGgHsduADmHgStgqQEwUC9BuABSSVLx16uMdJ65TbZ671GuCs8AkUJ9WmBlxQ9Cpbadn5+20hn4Kni4EpVGaCDpWKshKe9dc5rPDuwIxD7tFN/H9yhkCaQaE/Fbx/c3c3tamgQsVl1PjMP/4qeLyqRPGM4pedaeztytOmoQw+cKcufL3s/N7IUEmoH8fajqyvDDdVDeAOgLOAZZ4+r5Vju5GuwdhpHsZJAI4NxFzAIauQr0xBO6Hk9sFaJGbEiThcBhB+ISjVNCINyv7A2kXszVdRGjJTY60pOl1LrXCrpw5Y1UC+GgsAlOOuozIvBLPr9VoRG/LCArnmR564hS2vqkdUzveRtRlbS/NjTdTs1kDIhybh52/Q/xUUKXNngGL/rNCrG7KN4Qj1t/MI1g6M5DxoXhhNL1lbVNqRLnsw8pOSY7OWnga2G3iJzTS02k1FWIZAxe1KJqmprF5d0zE6lRB/xNQrRKolERZhDFjWglytrJvyAp7/XX+Wvf9AHTEVhVHqhnV7crDBMREnEoww6cR2BexWJGEetXH3/23MsqVvASk8KcpcKg1pbORia91XB6ZnJJ3PYG9txnGnt6 Q/Gu+1DL LQAXu1BOYLJI6Ro9ZBs1tSPiWZCqWRaREJwZuGYWL7A+70Zvb3Rky7iL2Vq7xVs29zTW7b770gpfdY/0jn1kK0pI8tth5y+WXM321StAP9VpKeL8u8GHTIp53vzqTEUE8VUno8FxwyEZ6FWYGIkiU0dp5OkRtSzTwSoHM8V8MY048j0Zw8Qzo//7IeULrp1tGz4kH8oSEQ4aATAgbCzZTgykA9Q== 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. Signed-off-by: Ilya Leoshkevich --- arch/s390/boot/string.c | 15 +++++++++++ arch/s390/include/asm/string.h | 49 ++++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/arch/s390/boot/string.c b/arch/s390/boot/string.c index faccb33b462c..6d886c84075b 100644 --- a/arch/s390/boot/string.c +++ b/arch/s390/boot/string.c @@ -4,8 +4,14 @@ #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 +28,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..94925024cb26 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,21 +74,6 @@ 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); -static inline void *memset16(uint16_t *s, uint16_t v, size_t count) -{ - return __memset16(s, v, count * sizeof(v)); -} - -static inline void *memset32(uint32_t *s, uint32_t v, size_t count) -{ - return __memset32(s, v, count * sizeof(v)); -} - -static inline void *memset64(uint64_t *s, uint64_t v, size_t count) -{ - return __memset64(s, v, count * sizeof(v)); -} - #if !defined(IN_ARCH_STRING_C) && (!defined(CONFIG_FORTIFY_SOURCE) || defined(__NO_FORTIFY)) #ifdef __HAVE_ARCH_MEMCHR @@ -194,6 +179,27 @@ static inline size_t strnlen(const char * s, size_t n) return end - s; } #endif + +#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 +static inline void *memset64(uint64_t *s, uint64_t v, size_t count) +{ + return __memset64(s, v, count * sizeof(v)); +} +#endif #else /* IN_ARCH_STRING_C */ void *memchr(const void * s, int c, size_t n); void *memscan(void *s, int c, size_t n); @@ -201,6 +207,9 @@ char *strcat(char *dst, const char *src); char *strcpy(char *dst, const char *src); size_t strlen(const char *s); size_t strnlen(const char * s, size_t n); +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); #endif /* !IN_ARCH_STRING_C */ #endif /* __S390_STRING_H_ */ From patchwork Wed Nov 15 20:31:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457302 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 E0316C072A2 for ; Wed, 15 Nov 2023 20:35:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE32380041; Wed, 15 Nov 2023 15:35:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A6CDB8003F; Wed, 15 Nov 2023 15:35:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8980880041; Wed, 15 Nov 2023 15:35:10 -0500 (EST) 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 6E0788003F for ; Wed, 15 Nov 2023 15:35:10 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4681AA097E for ; Wed, 15 Nov 2023 20:35:10 +0000 (UTC) X-FDA: 81461343180.30.6FCC570 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf04.hostedemail.com (Postfix) with ESMTP id 13C2940011 for ; Wed, 15 Nov 2023 20:35:07 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=fX7J+qpY; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf04.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=1700080508; a=rsa-sha256; cv=none; b=xVDBfH2gPNXP3pzLRBsbeXXsTLZrzdo5zvtTSVVLbzE3P8Ho7ZzIBgQXQjeh+1Z6p3r5x8 /zr35sJQs/kaxyhgHBS9lxPi2dI5VE8H+cWuWIKSlg0WLx8dX/fnLNK7rx5iz1QNcSyph/ +XUbNQSLmegtRIVkR+K6L7YEH26RRG0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=fX7J+qpY; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf04.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=1700080508; 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=vyPRs3NEGlrSEI4OyP/kyugJK7kmBP/avTMvzRTf3tE=; b=cPLIbUfHC83xk4D6Tdva9DRlqLpNDcUvZ92JO6XWDBU8H6QHXUmtvWrmhE6DmyOYRUwhQu 4804rC36txPjVcXnMZPB83FRZGd8NHkZ8JKyHhA35ovKcWzgwIjDO4aQnyBLbxVaY4XbVf 1gtz8acDEcAv8l1s79HRPUymEDjXOYA= Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKFbGw004184; Wed, 15 Nov 2023 20:35:01 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=vyPRs3NEGlrSEI4OyP/kyugJK7kmBP/avTMvzRTf3tE=; b=fX7J+qpYXrsKl0WhCw3SJovIUB8N1Lwj01ujK3viO6O7XZNCFJw0WQ8XfQHzERI33W// j+jUpWNZJKyl+I31c35IJ0yr5UFwG5RsUEAM+E/L8Owhv0s6xavhXhlKW6hxNoW1XDcC u719TVJzYC/LZSNOKorAUUxjzEy/F3Q9uiUG07EDpSEmy8/z/Rf60uv/QY+12KeIhiWq wUSo7MK44DbEJhCuF4GyVtUjkDCcR44drPNwM8tTeJGuokSn8vPowbZyY0QB6l7oOBBW vEVlgEdIPd+FGz6rF78YLaeaA9GlV6cnddAfH70PAM8FhjzF8nJhfR8NX7ovbteHbX6v 2A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v30d0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:01 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKQNNg002471; Wed, 15 Nov 2023 20:35:00 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 3ud4v30cyy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:00 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKJ1Fm017525; Wed, 15 Nov 2023 20:34:59 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamayj7es-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:59 +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 3AFKYucL4391432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:56 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6F6520043; Wed, 15 Nov 2023 20:34:56 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 59DB820040; Wed, 15 Nov 2023 20:34:55 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:55 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 28/32] s390/traps: Unpoison the kernel_stack_overflow()'s pt_regs Date: Wed, 15 Nov 2023 21:31:00 +0100 Message-ID: <20231115203401.2495875-29-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: dnaNBt7krqikwNotd3HVlCqxFq8337Jy X-Proofpoint-ORIG-GUID: 6zt5GNmg5wfDE8GufZyKD9mMXoFyxLx- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 bulkscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 13C2940011 X-Stat-Signature: zcxrmjze3nmo9fzmzhwrp7whppamkz47 X-HE-Tag: 1700080507-434812 X-HE-Meta: U2FsdGVkX1/shb0wDIhfi5ZButGNK3lXgHJi432kRBbgelnXq2kIztjCCANVseNPe+477wgYadXhA7yU9L2J1IIcoOK219fX29jcKYEmCQbSLuIUwsNDRIN32e3xJbUq3ISHcVW7bJtv/C2U5K70Zt9pkQOOSr2gFOVGa03AOHsU0PvDWN567k1RtF7JKDz4X9yn56xYMA1Xsqdl6AYELaliETwJYOX8jZ2LouHI6I2RYiVvaXnlXU/JHvi9aK2XbkKCpm7oSYYXJQ+SXukECHj8H16ZrUMofQZxE6kQRA3K+Fi6PMOcSBqOnjOLRNKzetQgr+2WlwZhr8XWDiP32ydwpIWilTORl2Km75PQVpCGAO8A8R24JCAgjcEo50Sr43WHylnbQTMDM3914PgPGmiWhHhTmov2JTIPonnK79M98LUad5Z71k3YcTHosb8mCQds1wSYdwNtLF/FsimH+QWfvW3Jz2ZG5PQKar8NK4q2vcXzM1DqXq4gP1mOkcuNpj9VjmuMgmXQ5kehmXO5rdrHOUKKLW6sppIby+T+GrsgZY2KOADTkX+LJnqwmWMEQ9Cd9RG7+1efzj+fBIJVI9qhYMkgGfBeBq+af7SFtmFGRwNFTXeVx1AV+hdHcM/ixqzdEaOFrpMUdmh1DqNmyeYOp0hL9B65HRxs+AAPEdxp7TTjApDV1uQCE0AhfPq4bOQTnm5sx0B8sp1AKgVo5HuOIuBr+jhNQDN3dXscEC4a+vrOGwL8MwEiQ4iZx4PZl9Dhmm4vgqrbAA9Mp5cPHiuIo/wjWD5YADyKK/4TM7oS77Jg5K3eAM6REtr6ldTeHFM6iXTWwF6HDTPufNEc2KAwMcoW49mun3dB3WBQQPynnRWIT8fqaUd2dbKyaudkjJUelb3Qy1TMp+UOEcF9CuDm94gN4GDHy/ThrkmNN6ze1JfzLJPnlyQj06HD65iHWBYY6cBMBvhCLW8Zi79 Hv9Vqrs7 /r2LJM5WUl3agJKkFdE0aWgRMvpitqe122WQ/HwolrJOx9T7SiI3fEXvDTrw25Mbp4Jv/7GnEEzI1cYOqcE97gIay/ZTcVxAxFyyDoj/dnCWnB+ryYmikEpzxjbm5MGhQA1XPP/q2auShczXyAcrItpk+6dpzZ0Vkq3rtZ9+SI8BTsJvV604O7Whu2cTypqESqcrbtnFuDfswju9hy3qtDhBrWY1N+/ZafD/LGwRjS03jDYjqZuVXv8+9TXM85XhYg+eAuQw9F/lG2+xsHkCvWabQ8V8l4oNScoypdvv64QUaf3DISZffocRzFYK/JGW/anaLnSfEaN45GXw= 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: This is normally done by the generic entry code, but the kernel_stack_overflow() flow bypasses it. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- arch/s390/kernel/traps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index 1d2aa448d103..dd7362806dbb 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -260,6 +261,7 @@ static void monitor_event_exception(struct pt_regs *regs) void kernel_stack_overflow(struct pt_regs *regs) { + kmsan_unpoison_entry_regs(regs); bust_spinlocks(1); printk("Kernel stack overflow.\n"); show_regs(regs); From patchwork Wed Nov 15 20:31:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457303 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 98AFAC2BB3F for ; Wed, 15 Nov 2023 20:35:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC23280042; Wed, 15 Nov 2023 15:35:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A206C8003F; Wed, 15 Nov 2023 15:35:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8230F80042; Wed, 15 Nov 2023 15:35:12 -0500 (EST) 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 61E418003F for ; Wed, 15 Nov 2023 15:35:12 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 44F38A079C for ; Wed, 15 Nov 2023 20:35:12 +0000 (UTC) X-FDA: 81461343264.20.322BA65 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf29.hostedemail.com (Postfix) with ESMTP id 20B4712001A for ; Wed, 15 Nov 2023 20:35:09 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Cdrh1ziV; spf=pass (imf29.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=1700080510; a=rsa-sha256; cv=none; b=y+kOEo3O0aIT1+nutoGqDbO+VaU0kfTgiSdfGxFcKvJrzAEJfH0H8d4WSEHF7K2sYEvL8p /altDpDXY6QqTNcCiMtoBXdcZxroxNSqt+k6At26a297WdRB6hEmvpD3qPlyIXpQndIuM0 r7/EAcxZpmvW9XthfX8jE2J2fXHre0g= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Cdrh1ziV; spf=pass (imf29.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=1700080510; 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=hT5UecKAWHuvfdgWzoNOlmnaeKK0+U2DmyJXTmInAXM=; b=5PI3C9UgNPqBFnV3jwZd+4TKx6OSAlJPtup0EvfevrBI48q9TEGoJufo3vIfbaKl3dGgZO EhThKOBy6MFTqOKw7n9cI0gLpaspCql5/7z7kUM8LV2SEn+KVAxl2MDUO8+GEs+33ASVr9 go9j93izG+DwHTxMASe+ej86osWVrYo= Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKFbK8016175; Wed, 15 Nov 2023 20:35: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=hT5UecKAWHuvfdgWzoNOlmnaeKK0+U2DmyJXTmInAXM=; b=Cdrh1ziV/An604xeerh6X0d4CuAtVyp+uXxyXeMQPoUzr2D8vsDpvFn7hEH9MtscBOhK nMFmOu43T3U+GmTN5QWFZFPySUQww7sPMQ0VZG4yXVeLpkQYro+9bYePU5jbl8O/L++5 PAOoPlLeDMhYwL5hwibM5skvW+UcGfacvD9o1kntnA3oFWakcEnL6ggRPsyV5l4Kt2ZG pFr16whcppKe0xZfXVK57KijCRXEDMxmtLJibIoTLWpb0bFAHs5giaiHNkW+c8fbvFEk g6rqk2bBVvztqSBji5HKI0dquyD/od+HjREvpGdE/3ZSC5y/24/sJSg2O3gTqJkReToj OA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4v2rbf1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:04 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKYHPq004462; Wed, 15 Nov 2023 20:35:04 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 3ud4v2rbet-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:04 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKJ36m017548; Wed, 15 Nov 2023 20:35:03 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamayj7fc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:03 +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 3AFKZ0rK16581344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:35:00 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C05B20043; Wed, 15 Nov 2023 20:35:00 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C41A720040; Wed, 15 Nov 2023 20:34:58 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:58 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 30/32] s390/unwind: Disable KMSAN checks Date: Wed, 15 Nov 2023 21:31:02 +0100 Message-ID: <20231115203401.2495875-31-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: b1P77HZr7B8FJcQWaHk2afHxOWLhT2Yq X-Proofpoint-GUID: o4JJc2oTUm0AoYvcRNRv2r_nas_qMHcx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxscore=0 clxscore=1015 adultscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=769 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 20B4712001A X-Stat-Signature: 1z845pywqg95x6khnxuww75easuo91hc X-Rspam-User: X-HE-Tag: 1700080509-401519 X-HE-Meta: U2FsdGVkX1/5Ul9+rBodxpiR64Ib3kXQjLkd25ld7rduv7Y3ikosyADn3POZjLVid8iwV9+o/E7ipwf2XUjAOfweVJRRmG92wUv8UFO3VBmZw9GriRQ0G39OtGW4dzEQrCGFkwuEk6XV1XdOI6c1+q5R0UEyVcZB3hMvmymn1Uiv8AH7vXJfBm7torM1NBq96G6HV3l7a/WJVFgNIYmewprRmZhqCznu2rhNvKWdUCsO8nU5CHf90z2OieELGPRDUbdFn+ingBCNekn5oCoyx0GM1BSGOKaoVC1OBfIqEnvhPrL3WLFj23vgcVAT2mlxisBB07gcsFZluiGM90s2VbEPqbgGMZR9xftad0oMVIfAeOL8QSFSajMqSB/RdyjBEaUdfuhXEwmWs2RYDe53YgCws25gLVweSHZxYlWBhO94rGVCKocq2lk2e9Sx0ZjyiREAUFD9OdUlNYUW7aPe5qv4vfsSbI7A7dTaL0SaFhDlFvAzciz4W5/nXTDi2m3rYuYR5k8OdlBH0RgEXIgD7x5MzmJncv62I0Tom/rirO5sd7cHlLl9TQF60+Gt1Xi7U9odMJ/zq8OZ/4FpbHayzVzjVMdeC+kOWVUJpkaUl/pFpEkiy71NTWeRm5iNp9TrfiOB+zdVVyj9cJMAeJubpLwDzCqSJ/pD3/m0pfn0Mpv0UONLI18inkoQLgv1bQeHYeuYKkYb5EPoWJY7rBiEZ8pw2HrSzvPzWY1gNZRkGu+HuA9CX2WhhHdQlevlyMouERPQwqq0BO5W2YtreERMWXNwm6Dwm9/UC9kXF5U/eJwJ+AwvaITLiUvtTXo6dNrU2+0b3+Gg7qBmbVtfLoxKUpcwZCLI4WsgpOMNxAfsXlXM8QIrmbJ3kBBZx3GeXw0YgJAvi1BIbS1ygvin2rJpRi6GtZiClNt/iVjWQf8jXzzdOeUw1as3f6+kSuMLAQq/3NBIl9SXDfLjA2AFb2F BXHwoR+1 d3jqn8BrHIIQJed4DeJYqDcMzsuNi4foVuiOnyioWt5NAqifJzvsGMfDmcGWOZjcijQFZVCdXMftKxbDaOcPWVeoQ6CYA+NaCGKRW2b/WMUlXmMO907O1bjw+2rcXtlr8v1BeIRytt2BLkKUJ/bwhja6jl42x3+gTv3wC8k+LYVpMu2P0PGABTISNwtj/UnRKaD+ZdXBQ5Ak69sHuGzfgDk1EKw== 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. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- arch/s390/kernel/unwind_bc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/kernel/unwind_bc.c b/arch/s390/kernel/unwind_bc.c index 0ece156fdd7c..7ecaab24783f 100644 --- a/arch/s390/kernel/unwind_bc.c +++ b/arch/s390/kernel/unwind_bc.c @@ -49,6 +49,7 @@ static inline bool is_final_pt_regs(struct unwind_state *state, READ_ONCE_NOCHECK(regs->psw.mask) & PSW_MASK_PSTATE; } +__no_kmsan_checks bool unwind_next_frame(struct unwind_state *state) { struct stack_info *info = &state->stack_info; @@ -118,6 +119,7 @@ bool unwind_next_frame(struct unwind_state *state) } EXPORT_SYMBOL_GPL(unwind_next_frame); +__no_kmsan_checks void __unwind_start(struct unwind_state *state, struct task_struct *task, struct pt_regs *regs, unsigned long first_frame) { From patchwork Wed Nov 15 20:31:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457304 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 7A0A6C54FB9 for ; Wed, 15 Nov 2023 20:35:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DFF680043; Wed, 15 Nov 2023 15:35:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3439A8003F; Wed, 15 Nov 2023 15:35:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F76480043; Wed, 15 Nov 2023 15:35:17 -0500 (EST) 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 EB99E8003F for ; Wed, 15 Nov 2023 15:35:16 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id ABABEA0896 for ; Wed, 15 Nov 2023 20:35:16 +0000 (UTC) X-FDA: 81461343432.08.4FFD6B1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf10.hostedemail.com (Postfix) with ESMTP id 3BF0AC0006 for ; Wed, 15 Nov 2023 20:35:14 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="Cm7X8/vx"; 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=1700080514; 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=Z9QhvajxwNq5SYGaSMflClifwELAA5o+VrikMt43NLQ=; b=0Xo3Q3Ojsmlc7GhwWyIDpUQ2TuLaCC8eAkTPCbQ+KsVcT1fvVgk3SB/y82RUJXAl1+ShnX oEff4tqAgHY/qoU24FngSSuUCIijM8I3QKpJqQX6hmjPEHQIXocaOKDw45WXcOdZRqAZoW 8Npi/yP0KjBvbzvr3tTFUGEgAT8DE3s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080514; a=rsa-sha256; cv=none; b=jI7v5PUnblZ7Ai7rWFIfhvPY21DjirP5L7SFZwLjsB5uKAiY+r0zBm4cl1R+zt9iCDdkdf SPRNJ8Az6Uio5r9Todb4JqnyayNG1zWNe5nFvaP9qtHDnbfmJsODmSwu6ia4qdiFBehjxX zpcYYXplg4yNqND5EnBcmLtCpFQnQuc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="Cm7X8/vx"; 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 (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKGBg7020350; Wed, 15 Nov 2023 20:35: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=Z9QhvajxwNq5SYGaSMflClifwELAA5o+VrikMt43NLQ=; b=Cm7X8/vxvTtxaJWoFkF9jnWecr0V6l8l2xTJG6o7VdsEsU84lWrX/cWSA/PlQPp4PQ2D X9b77e9wnTajqjR6TYS7npJ3ADymLNwW2C5SmJjm8hYNyDRNHnSnxY0Be1vNtLUSQF06 h9whX9frOjQXZxlDkt+JDJDmcdVozDYOHEm6hPXgoS7l+Eh9Re02y6JbkHWk2YDUQOMS sutit7Hror9wtMS/nVkO5ajro1E7OX/hdZ1u4e5usYdND84i5ZH93tIfYqtqil6cDNhY z8QKRZ3pZ53n7yLXybIsWVSf5WdBtAzBeBTJlm5pVxPgxVzveUbvBi07sIJTdygcJatO 3A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4ch9c3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:07 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKGQp8021574; Wed, 15 Nov 2023 20:35:06 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 3ud4ch9c2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:06 +0000 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 3AFKJ079014625; Wed, 15 Nov 2023 20:35:05 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvyw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35: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 3AFKZ20918350786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:35:02 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDD232004D; Wed, 15 Nov 2023 20:35:01 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9051C20043; Wed, 15 Nov 2023 20:35:00 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:35:00 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 31/32] s390: Implement the architecture-specific kmsan functions Date: Wed, 15 Nov 2023 21:31:03 +0100 Message-ID: <20231115203401.2495875-32-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: UhAhQFn0oBvTc1Pv6N3SdNg7x4kktrNk X-Proofpoint-ORIG-GUID: LEZ4uk_CRb6VScTTWyecjTAHWTBHOoS1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 mlxlogscore=783 lowpriorityscore=0 impostorscore=0 priorityscore=1501 phishscore=0 spamscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: 3BF0AC0006 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: oycwmdgm9f64afgw5hewynas1whsq8sy X-HE-Tag: 1700080514-511279 X-HE-Meta: U2FsdGVkX18YRGefb6drTABrQK/oO3H08W1Z7bXuZ4IqiIrsK0QKEvW4aYxTtzbAr3R3YYSUfwZmIWET6ZVMy+KGTF4TbqVo+9jyDg58VXpnsSWV/8y+H07SHNGSUyMzt0Ia0UWixKO/BRcjWK9b1SxBVLNoGEINaQXk/lIrSvdxo+/mDIDc0CqbT0ke9psaHdu3zpgOd3ZDCtSDSdtqDYS7EwtMWrCdQC441eIzKuYR+NyFkMh1VCIQPbVtRaexZWhCL99RYDgh1zAVPm4quCt6FxoZKCugkSi0w9P7HvTmO0qDgELvDkCk8OEe7s0Ndi+iD5Sa2h+Di19Ynpq+/bilhq+7WNOoTOzMdqWt+HLyYTHe10lo6UhcERTn4kJM48DIOZGIe2nfCkJGKyIKRBY1HQg705eiJ1HlxIZC2n65GiM9LVBWkCYofaGWKmOCXpdcVBavxaBlnpRaEhuVN2h2dVRLxrBQbZEB4UyqaMr3pQMx4kvcbgsjTWAYHV947Dzhoz5XSlQ6qSlRO4LbPNtQrk9S7IL0gS1k2qUxVpQBKHZDQD1O7+2HTEIicyLjJuLjaSon4Falj2Oz9MAU0v3idwPlK8IejgK+WYe7OQbMbGSmhCOAOpGW7NG1/U7CSRCKm9SREeVrJykJN0jx1AxF03mnKlDtgJm2ZutIbJVQXhAyIb3M0GcaYNP+z+fGyyTWXYynnTwtckgkftekLD4FpM72SuEDqy9v0GSKjR/oP8voIxEsXpRWd9A89Ad+c80Eiw2I25hM6FCujBcjONAgDP99uZ0FBKQ2BVZfhy5PKz1AHJEPkavQ+21SKQ00Gq27iMt7TN7HKjM4l96ro/mqmMAfpFa/b6AbAuZPRQ6lkS0BmxRw2wsUY5ntk6iwL82dfSU208ehx84PtPptTNOXEViwFwDgzG3FNeq7m1DVjplDLR/a7KIoc7zBkvlxa/R1lLdRSyvZ2kgCTc+ Np/nD2i9 0DaZrNVJtVgtf+siHp7PyYDVtvGEGvdDg/tBVLs58ZkpsLP8HmmvGeOM3ZsS7cbSpT5yHaJb8Tg3t2HdfqVN2WETqVgEJAbUq5hIMQ4QSjisTBFZq0KGFwE8UUp77KNlguZ0+Hf1Y3FS1twq8fU4PnrdzfI/+AOF8Ydps5xMAV7vHflzyGSP8x2SH6To5SeF/q9HkXAp7Zyck7yqOaJghT8l1Bg== 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(). Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/kmsan.h | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 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..afec71e9e9ac --- /dev/null +++ b/arch/s390/include/asm/kmsan.h @@ -0,0 +1,36 @@ +/* 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 void *arch_kmsan_get_meta_or_null(void *addr, bool is_origin) +{ + if (addr >= (void *)&S390_lowcore && + addr < (void *)(&S390_lowcore + 1)) { + /* + * 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; + return kmsan_get_metadata(addr, is_origin); + } + return NULL; +} + +static inline bool kmsan_virt_addr_valid(void *addr) +{ + return virt_addr_valid(addr); +} + +#endif /* !MODULE */ + +#endif /* _ASM_S390_KMSAN_H */ From patchwork Wed Nov 15 20:31:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457305 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 74AA6C072A2 for ; Wed, 15 Nov 2023 20:35:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4CCB980044; Wed, 15 Nov 2023 15:35:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4524D8003F; Wed, 15 Nov 2023 15:35:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E2F580044; Wed, 15 Nov 2023 15:35:19 -0500 (EST) 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 042C68003F for ; Wed, 15 Nov 2023 15:35:19 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D4BD4B5653 for ; Wed, 15 Nov 2023 20:35:18 +0000 (UTC) X-FDA: 81461343516.24.332EE58 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf03.hostedemail.com (Postfix) with ESMTP id 8144020008 for ; Wed, 15 Nov 2023 20:35:16 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=cbZ558kb; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf03.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080516; 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=VRISF6fjkFQLGNL8R/C4iEGZtM1pujBZILDlqB1XNVQ=; b=pO1J/R4oGPBNazl/CviXYACSmWOml1N7aU4+NsXoV2G1I6RfGXqsQbkpxe7KnD6E7Pq21b 1MI95yDJFl+dJYGKM0ZG97QjSs8ohz2ctjqgfBsKO+l4rygmFo8tey6kkI3sXA/cWIa3hY Urvm+QnVo8u/SldHmUacc7TdVgunwas= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=cbZ558kb; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf03.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080516; a=rsa-sha256; cv=none; b=xaQ9aBFHxqJQNtEJlfwaljxrVn9puL0hk/9Trh2bOSySEEGbp+hko6EEadEjagaSkNOUkp LfXf7Axr132967vNzdGC3+QsbH7H/TD9YuWO67Pr8oKQscxH4zGnjMB4I/jVPOIh4Fhmes isYgmGmvMiquBn7TXuUaOxeRqxHuBWI= Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKRwnS004994; Wed, 15 Nov 2023 20:35:09 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=VRISF6fjkFQLGNL8R/C4iEGZtM1pujBZILDlqB1XNVQ=; b=cbZ558kbkz+lvQnEYWC1ngCMStUJHTDlYg25M4oKZtFhWfPybISSsjJfHTN/qTa91433 1vNFrQf5alhu6p3rB4h3HBiav7eraPYQSjO1SnzvYUZn8l0jxGOX5Kp/XzLYYPtbquyJ rMJTnM2vkiz3dStl8Tkyvz3/8XNu2ovq2675WFNBEDrjXjgecDrez93DxyHhknwzrZ5x FPMZoGqU1JDjtY8jcZmFtITAak7dx4eYD0nFUyFRUFkt2viz7eb+grf3LePzN70glSmz P7EMROmHW3LLpZHqzJEdRmv+482d8AvbjYmz64N0pf8ytqO3ETRkCZ9TsfzVQV8fXCGI tg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud51q068t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:09 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKSttQ007862; Wed, 15 Nov 2023 20:35:08 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 3ud51q068a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:08 +0000 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 3AFKIxYd014619; Wed, 15 Nov 2023 20:35:07 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksw05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:07 +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 3AFKZ39F14680708 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:35:03 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A211A20043; Wed, 15 Nov 2023 20:35:03 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 530C720040; Wed, 15 Nov 2023 20:35:02 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:35:02 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH 32/32] kmsan: Enable on s390 Date: Wed, 15 Nov 2023 21:31:04 +0100 Message-ID: <20231115203401.2495875-33-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 2vgw_DyCu_LXf49xJoaLzSkmo0C_QjrU X-Proofpoint-GUID: jsb4NvqZ_AbBoKk-uNmxqfZ0Ve_6hGBS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 phishscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=767 mlxscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 8144020008 X-Stat-Signature: ncgm4kixb3wfmarjpdzpt8dqgg61pfof X-HE-Tag: 1700080516-562044 X-HE-Meta: U2FsdGVkX1/QD5jZaGMIwATz7DQhj/TkjkmEwGYZSk977WeWs9I/2cYD5eNz5s1vDnqkc60RPm1PPWgzNXqI0fQCVDMS7GCNTsKHKt2pm3kUCy6D701pJ16leFd3GBg3mioVK+G9z05bj6/sAD6KqCwehyTS8vzlFpemkrkF1iO3IomHrEllSmCmeIJqWjZCz+RDdabJRr0ZD4wzmE+SzPRiHaP8qvAVof07JjX+/9mVVBbLg2wD6aO+BaVexX/XkqUh5+FVBY7IawS+xAEh0C5kRQIpQuz9leo8vyvEDTri9dHRApeqKsJhoeKtDEpiXKrzkPThABGfv8qKfymsJrWNgZyhe4ujKx/pkCvFli4ZhGVAEJ4KwYnQ4qqLo89q+gCoV5lJi9+QvuK4YvjH6pPUGG+CmU92utbwWSH0g4b62cmJj2TYXPQcCui6KbYrZQJIDgTz39OXlAjQ9buYIy/bidhOpO8yojZpC4Xr2vL7+HIXPmfOXSCUtcLmDOnBTDWEbk7lM6K6QKXa4fSDHbNLBf2UbZtugMMEm4G6t085OhV5iT8ZXolmk0ehmrLVoP7qAG5lgi19NMvTQVqgJba75ODBtJtAZb/L7cPF8URF//zSsvXVWmz/G1jVLuqr/53Mf0XFMHL2xoVZGXgVDURzWF4ixnRRl+61JOyBPFkdVPEQDSMn/ISkZ94RWZVMdopXK36Crkz42Zptf9a+vYMEJt/oSmMqj6VjwFC4CTHDnXgWOe+TcKCHhIuuyv0CfwfaCrJVh/Y/YaPFRhwkdi2CDIij4iYuLJNXuf5mB0jMd8CcG3Ld83voh44t7p3h+eBD761nGjMuCpdfJRtfmwze69hwwuhFUE76j1UY9bINFP9tDKCM69W+zm1UhBeDwr7D74ECczZ92w0NizARl2z/AMC04ukpTDokrAAo0QekpxI0HxO8IsCgRVU2RdmF7psCqzynlz/OOwvxNXl J8a4+n2v V9PJu8HfkRbWWz9WprzZ2kM+O0/sjHDYtMDSlgeIvmbtshHmBZI5uq3x8kETIMMCJoA5u6VL9Seg+YHz3zXp/WGM7DtDAg33nmWb0wyYKsu5NlUY+47v7DIqTybEsPXs3V+usa+15PdBepSh1/aC1NfxjUqhl2imXAfsSmZ1CXyCnEi/CgyYV1DCXzPOJ5jcA9BAYOy8xOLackLOn8wbUUBvBjw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000819, 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. 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 3bec98d20283..160ad2220c53 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -153,6 +153,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