From nobody Sun Sep 14 01:38:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF11C54EAA for ; Fri, 27 Jan 2023 17:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233728AbjA0Rfx (ORCPT ); Fri, 27 Jan 2023 12:35:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjA0Rfu (ORCPT ); Fri, 27 Jan 2023 12:35:50 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A37AB7C700; Fri, 27 Jan 2023 09:35:49 -0800 (PST) Date: Fri, 27 Jan 2023 17:35:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1674840947; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hDCVHcgK+5QGw3h4UBTActHtpbx6bnknI7Ks7TAo3Vo=; b=fKEsIHJXHjDUvuIAv0mQerG9U1D6vyc/omJ+p6hLpNwU+kbp302Y9DAr0BCfZ9O6eGcOFL RA0WF8mqt5EmBAJoO4S9UbuoTdueFO3y+gOjAji4WpTwNu5CY7PLQ5PlLpq4BRhrNZSA99 TfUhqrovp3mYX/Tmv10AMpJZXeBgVWkvMQpQ24U9RGczD4gNnzCXxyGNrHeApxVP79F4zm IHB+w52uSHD49CeHilB3NlzSZ2YD5hOXmZo9pjNLxmYHqN3RhX8Ur5ZmFsNepQLTjtC82t wIXKOyIj9t45sijHwMzj0dzbdaKvh+dSs2gAB/WTOxoGrjThUpUfcX0ouuWWPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1674840947; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hDCVHcgK+5QGw3h4UBTActHtpbx6bnknI7Ks7TAo3Vo=; b=nLzW51Q9QhCzPYVN7OmuzGC8D0SG+ZnwNTwWB6FeHcdOw9dhmoQmy2ofQPLCVPZweddOHb c7ldt6dG2cp9aDCQ== From: "tip-bot2 for Alexander Potapenko" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86: Suppress KMSAN reports in arch_within_stack_frames() Cc: Alexander Potapenko , Dave Hansen , Eric Biggers , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167484094672.4906.1078127795504041641.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/core branch of tip: Commit-ID: ce3ba2af9695e4bd64d797e0026321e5dca29dd3 Gitweb: https://git.kernel.org/tip/ce3ba2af9695e4bd64d797e0026321e5d= ca29dd3 Author: Alexander Potapenko AuthorDate: Fri, 18 Nov 2022 18:23:05 +01:00 Committer: Dave Hansen CommitterDate: Fri, 27 Jan 2023 09:00:56 -08:00 x86: Suppress KMSAN reports in arch_within_stack_frames() arch_within_stack_frames() performs stack walking and may confuse KMSAN by stepping on stale shadow values. To prevent false positive reports, disable KMSAN checks in this function. This fixes KMSAN's interoperability with CONFIG_HARDENED_USERCOPY. Signed-off-by: Alexander Potapenko Signed-off-by: Dave Hansen Tested-by: Eric Biggers Link: https://github.com/google/kmsan/issues/89 Link: https://lore.kernel.org/lkml/Y3b9AAEKp2Vr3e6O@sol.localdomain/ Link: https://lore.kernel.org/all/20221118172305.3321253-1-glider%40google.= com --- arch/x86/include/asm/thread_info.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thre= ad_info.h index f0cb881..f1cccba 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -163,7 +163,12 @@ struct thread_info { * GOOD_FRAME if within a frame * BAD_STACK if placed across a frame boundary (or outside stack) * NOT_STACK unable to determine (no frame pointers, etc) + * + * This function reads pointers from the stack and dereferences them. The + * pointers may not have their KMSAN shadow set up properly, which may res= ult + * in false positive reports. Disable instrumentation to avoid those. */ +__no_kmsan_checks static inline int arch_within_stack_frames(const void * const stack, const void * const stackend, const void *obj, unsigned long len)