Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp263408lqs; Thu, 13 Jun 2024 09:21:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJ8q4qL02/jT9ulIbFDu4gVUy+M4i5Sx6+dG8/c0yGk9Leb1LwagaiRWAjSldmDXyTWGhGhkhw+AVK2pLz1HhXVgy3gHIwJM7DHqq3FA== X-Google-Smtp-Source: AGHT+IFXTwl8qBADRDvdPSRIaREYTjvSFI4Dc1rrlHokPuurKlTXdkqdcWRrq+rkM2lsQz6zVUhZ X-Received: by 2002:a05:6870:164b:b0:254:88ed:c9b0 with SMTP id 586e51a60fabf-2584289345amr81868fac.7.1718295693771; Thu, 13 Jun 2024 09:21:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718295693; cv=pass; d=google.com; s=arc-20160816; b=l+DMaNrzjZ+XuTWv0jtvSpulKr5DlbrSIU0B1mLDZZX/5K0MV2XNvbH3Y7cyK/cEjF CZWfxEyTik+m5JTpECe2QX997yT1PtBMgs0yXmCHS3rUv5/OlipI+krG+0WR66TfHRLD MQOl8HQOUOPs+r6G2e1sTJAfCUSpOqMAHgLdQpTCpTJbPBrRItbAW4hQVogaAaCBMeIh 09zJ6d2NzDlGimbrdZsCkMCQbzIWPFhJZ4DaTrA1L/Pe9Zr9Bz+IfVxzgEei2XAqPyU3 Z2On6WKiy1vEt1G/jocsBtv7UhqgYonIFFMvDKAFDVH/2gcu/2m+WnIRJhysQ9Q4luOx yafg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=Pk8TjR44mVtu2x8GczkKUnp/iceWRQZ53zM5FWeztZI=; fh=KkKQYtzz6I3Fheaqbs3DScUynHU4Y0XBjEVlwCNbTnM=; b=GcHPq38q5wy9A01sAVogzhyImRmrQS2ZG+DNkSK107CeU7u9Kw6pRlVfMkKmAm9YpU 1skTJgutKJDHLOKAXKec0vJBdtvGIpwmi+BstGDIY3miES5y/vij/AKFJnjcQfpxVAkD nxlWdI2betJGGK2gDJl8Z7YTPNAJTM/V2KPBX+Wepj7vKMig8T7PfKJlha4Ny/tyrAV5 OfY1ww0AztXlR3ff72/KwrRDhjV0S3oYgdI0dyoLRXbFj1846A026J42kJQ0EHby43VX jlT+aBee7AYnRiLlN8zT21lTGJ9Zk+m7nST2Q1In6/6hlZ+D3ZP2/jgaBvdu6JfHsnkk rZ7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-213637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213637-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-798aac9dc19si12724085a.48.2024.06.13.09.21.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 09:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-213637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213637-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 78A7F1C24A1F for ; Thu, 13 Jun 2024 16:21:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 852DC149C61; Thu, 13 Jun 2024 16:21:12 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0102A1494CB; Thu, 13 Jun 2024 16:21:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718295672; cv=none; b=i3AnjcufR2HHzNAZhtKGkifSThaJzFEySgM1CZmgs2eVTRXTisHkHUAvjTcYk+gNeIG8R/sOSblZ1fSsuPR1hnTDyQhoJE5xPjMzNP7KVsCNuOKV4aslwtqq/ELJWcuvQPe+kJWc3pPMgrnhjFo+ipXRDBSisWeasT0RxuABpxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718295672; c=relaxed/simple; bh=KhG6p1G/vl180lQCXn0UUW5xYEylfaMDqhz/mseFLpA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=M255Z5ALTJadfFvbZ0AlBHjS9+dbToW/Z2lRlwQbarFZbY+nEDdpCHyEKRZZMDwsHh6a15rOMwRh3SN1dKRn+f9GYgPewpIfVnSMkvItnywU7B8KUK2s/+jK7GSZUfuZuY2GE+K+fuobRLOi/SWS858si/eZEZ3j6z+ubK9Gix4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA525C32786; Thu, 13 Jun 2024 16:21:08 +0000 (UTC) Date: Thu, 13 Jun 2024 12:21:07 -0400 From: Steven Rostedt To: Ilya Leoshkevich Cc: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Vasily Gorbik , Vlastimil Babka , 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 Subject: Re: [PATCH v4 01/35] ftrace: Unpoison ftrace_regs in ftrace_ops_list_func() Message-ID: <20240613122107.6e9299eb@rorschach.local.home> In-Reply-To: <20240613153924.961511-2-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> <20240613153924.961511-2-iii@linux.ibm.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 13 Jun 2024 17:34:03 +0200 Ilya Leoshkevich wrote: > Architectures use assembly code to initialize ftrace_regs and call > ftrace_ops_list_func(). Therefore, from the KMSAN's point of view, > ftrace_regs is poisoned on ftrace_ops_list_func entry(). This causes > KMSAN warnings when running the ftrace testsuite. > > Fix by trusting the architecture-specific assembly code and always > unpoisoning ftrace_regs in ftrace_ops_list_func. > > The issue was not encountered on x86_64 so far only by accident: > assembly-allocated ftrace_regs was overlapping a stale partially > unpoisoned stack frame. Poisoning stack frames before returns [1] > makes the issue appear on x86_64 as well. > > [1] https://github.com/iii-i/llvm-project/commits/msan-poison-allocas-before-returning-2024-06-12/ > > Reviewed-by: Alexander Potapenko > Signed-off-by: Ilya Leoshkevich > --- Acked-by: Steven Rostedt (Google) -- Steve > kernel/trace/ftrace.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 65208d3b5ed9..c35ad4362d71 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -7407,6 +7407,7 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, > void arch_ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, > struct ftrace_ops *op, struct ftrace_regs *fregs) > { > + kmsan_unpoison_memory(fregs, sizeof(*fregs)); > __ftrace_ops_list_func(ip, parent_ip, NULL, fregs); > } > #else