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