Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5783696rdb; Wed, 13 Dec 2023 21:57:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbs71U6JLrdNsXXK0Hl4Y+IUltKdyzLfqKx8Ng78BenJYZAFEf/++eMu/Xkzko61dHdBI9 X-Received: by 2002:a05:6a00:174a:b0:6ce:939e:bed6 with SMTP id j10-20020a056a00174a00b006ce939ebed6mr11252453pfc.34.1702533429824; Wed, 13 Dec 2023 21:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702533429; cv=none; d=google.com; s=arc-20160816; b=o3dcGFARxZf6KMWOS9QuLARAwJ1CZ3YMMnKiKRMDrMohZGkY2q6gpPV/HdCeM33fx/ 764JC1aL8syg4g8dpAFH/vuZDOJ9f+XVFaHNH3EraSLcmQFZNYG00bigazoN86tfJ1Dk QvXP7caF2jMvBlO6Csj+wv33OKsRcc4Q+yj7kwz++2/FLHBpHEo5k1P0uzhyvpH3dhQi cyk4hRejtNJqqgg8GQsTK3V7oAM/LzRH8s/dlew+wqlo09onten06DyiO8heJAyACT7a 78al3svDzC68ztOzfShVqHjizk2qWucG4I6Ge5vrFrjuW5FMvVmMA/pC2L7/KxMc0bs3 GfDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/mQKPh+Q/+oVqTYrm5JhFDCdjY5bZbTlHx3Tfk9a0cM=; fh=JZjI76tHrPFh9wXiZ9caJKwSuDkcoMAMvZd7/HZf8J0=; b=O2r5Uxt/ccbFXFjhCYW9+KGE7XIfbJac+nJ8uGwtiM5Hfuy+IjbXHwjkXabg3dCBr6 KSuDg+4pGxxvHR5h+5enGa46N7GfShT35jkL2UHGh2S7Yvs3ahb+fHFEw6DdrPB8uaNu 6qdcC3mwvWux2QUja/LCFiC1FS8UObaiuUodgJ645uVIqDfhXnWg70YtB6UkyHMnh03L +7fKnfSVMXjzqU3DI1YlHoyoPGtm7qRBJuT4oeCbEBdRgfLADE7BPMogsEFgBNndd2EG +J5moG9daVVIz80eSFDwdTLfVQJGDyqQDFNE6WA6w6ESmvjzn91dDH5UaJSk09Ms3N6u LYGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=HviIdLMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l5-20020a656805000000b005bd85b2f231si10539755pgt.298.2023.12.13.21.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 21:57:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=HviIdLMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D70BF802A826; Wed, 13 Dec 2023 21:57:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443221AbjLNF4y (ORCPT + 99 others); Thu, 14 Dec 2023 00:56:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235361AbjLNF4f (ORCPT ); Thu, 14 Dec 2023 00:56:35 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B553610C for ; Wed, 13 Dec 2023 21:56:40 -0800 (PST) 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 3BE2Uej9022139; Thu, 14 Dec 2023 05:56:28 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=/mQKPh+Q/+oVqTYrm5JhFDCdjY5bZbTlHx3Tfk9a0cM=; b=HviIdLMX+gGsWGnJUfcgJ1zEBu48XMwnVfecoXiEmf6Tv6qT4swY5ic30eZT4ZCJaK7F 2tVgJWOTwb1EQta+JtuvXkYe+n0LoOzO0x4ze5EeVexeEV/A7fH+4kL6KDkGSsOgKjCj n3tZsn8S9GAuTnCSmmgcNu1Cjo17RPYnwC/nKQ8EkuxfFKe8TLi/BQ2ZF1BYfO2gJBt2 kK3hoq2EcfsjQfS67rq0cjnQe2/6PR3IwJUEIKI3IFGLHTIqHrioiAHQmyNZO+BxFiWr NcMVBwL3zgCKwv09Az1XFXvrpqEHElxwIXHgRZHZXQQqOjeTyQYS5IB1vpQm9hJaNkfS LA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uyjg3cj8s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 05:56:27 +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 3BE5r8A1026718; Thu, 14 Dec 2023 05:56:27 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 3uyjg3cj7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 05:56:27 +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 3BE5cXLZ013892; Thu, 14 Dec 2023 05:56:26 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uw592dwf3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 05:56:25 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3BE5uOb944237272 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Dec 2023 05:56:24 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C18920040; Thu, 14 Dec 2023 05:56:24 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B55CF20043; Thu, 14 Dec 2023 05:56:23 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 14 Dec 2023 05:56:23 +0000 (GMT) Received: from nicholasmvm.. (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 92302606DB; Thu, 14 Dec 2023 16:56:19 +1100 (AEDT) From: Nicholas Miehlbradt To: glider@google.com, elver@google.com, dvyukov@google.com, akpm@linux-foundation.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: linux-mm@kvack.org, kasan-dev@googlegroups.com, iii@linux.ibm.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Nicholas Miehlbradt Subject: [PATCH 09/13] powerpc: Disable KMSAN checks on functions which walk the stack Date: Thu, 14 Dec 2023 05:55:35 +0000 Message-Id: <20231214055539.9420-10-nicholas@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231214055539.9420-1-nicholas@linux.ibm.com> References: <20231214055539.9420-1-nicholas@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: bbcuSHGLeoKEVuj7srCG-ZCZayTjEdOS X-Proofpoint-GUID: KH91wVFkQGDFAZOFPfyiwzBaXkKHaRsA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-14_02,2023-12-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 priorityscore=1501 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312140035 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 21:57:09 -0800 (PST) Functions which walk the stack read parts of the stack which cannot be instrumented by KMSAN e.g. the backchain. Disable KMSAN sanitization of these functions to prevent false positives. Signed-off-by: Nicholas Miehlbradt --- arch/powerpc/kernel/process.c | 6 +++--- arch/powerpc/kernel/stacktrace.c | 10 ++++++---- arch/powerpc/perf/callchain.c | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 392404688cec..3dc88143c3b2 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -2276,9 +2276,9 @@ static bool empty_user_regs(struct pt_regs *regs, struct task_struct *tsk) static int kstack_depth_to_print = CONFIG_PRINT_STACK_DEPTH; -void __no_sanitize_address show_stack(struct task_struct *tsk, - unsigned long *stack, - const char *loglvl) +void __no_sanitize_address __no_kmsan_checks show_stack(struct task_struct *tsk, + unsigned long *stack, + const char *loglvl) { unsigned long sp, ip, lr, newsp; int count = 0; diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c index e6a958a5da27..369b8b2a1bcd 100644 --- a/arch/powerpc/kernel/stacktrace.c +++ b/arch/powerpc/kernel/stacktrace.c @@ -24,8 +24,9 @@ #include -void __no_sanitize_address arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, - struct task_struct *task, struct pt_regs *regs) +void __no_sanitize_address __no_kmsan_checks + arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, + struct task_struct *task, struct pt_regs *regs) { unsigned long sp; @@ -62,8 +63,9 @@ void __no_sanitize_address arch_stack_walk(stack_trace_consume_fn consume_entry, * * If the task is not 'current', the caller *must* ensure the task is inactive. */ -int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, - void *cookie, struct task_struct *task) +int __no_sanitize_address __no_kmsan_checks + arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie, + struct task_struct *task) { unsigned long sp; unsigned long newsp; diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c index 6b4434dd0ff3..c7610b38e9b8 100644 --- a/arch/powerpc/perf/callchain.c +++ b/arch/powerpc/perf/callchain.c @@ -40,7 +40,7 @@ static int valid_next_sp(unsigned long sp, unsigned long prev_sp) return 0; } -void __no_sanitize_address +void __no_sanitize_address __no_kmsan_checks perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) { unsigned long sp, next_sp; -- 2.40.1