From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 386B722156F for ; Mon, 8 Dec 2025 01:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765157705; cv=none; b=MlZ0Zcw8z/Ex3njBHnhL9NlXo4w9j9b7TkDzc9kP35+Xlo1zjNBMBPSOscGCwKai7z+btn5rrddsPqQ5TYpOVKZ+LlXAeG9JFoowMj6zU9sd5ODUErg0OMZqEr9b3T5qALsu/5Jbbcr7IwA6zEhI7X0hBpW/6OdrBTC85qwJpdo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765157705; c=relaxed/simple; bh=T9HB6vI7Yc90v+b5JO4UtrN0928qnQaXIVtCCIgeHRM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=kOSKGXvlc55G6x4gHU2gpbzVDnAsLY3PZPxqexO9/Kr0xELJ3DpVzeyEBj+alV7kK1ATosZdC9XdDnpKYAoMVBUkAc+5OlQ2rwvAwOA5x/8g1BjTsA6i8pmdhgjQG8jW0wJ2B2VVNV300NcB4YNqyugj8stAvvJv3fDf853FtNE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rXSFNPiE; arc=none smtp.client-ip=209.85.221.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rXSFNPiE" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-42b30184be7so1856594f8f.2 for ; Sun, 07 Dec 2025 17:35:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765157702; x=1765762502; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=p5d1/KP4GxMhsEhwScdwPIgTBK+KcZfvdYekHvom6ic=; b=rXSFNPiEOxpQkxHHXoik31I6g3LmCHOEAX7GBUsA2aqOcu9WSkJ2EASZ+bnsoFG4iW edqI//MzKJihi/qLSyqx0HBZwh+APYklYtvOugQ58khdAyr9pjLvbSAOgx/9o2A1TRTZ ZutG7blsf/iU9Iyq7PmR814enFfgc9AR9Lq8UFkawdo6qsy//diUV1Z6RYDHYOJCbU2R t68t0n83uwswmPcIhVDJqqqyc7CUolcLcfPTa4jdzfyZi9fZBIdKbG3Pr+uyKhTTjEJj /bsmi8cQOeA3GMK6JaUkXirm9kED2WxrSfxGMq8zbZP0foKHyT0A/ZA3oWyG3yklj0vL bclg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765157702; x=1765762502; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p5d1/KP4GxMhsEhwScdwPIgTBK+KcZfvdYekHvom6ic=; b=dFbGcAh3dfReZdPe6EJiu/ktJf39TYXtWg+SZeEdig99GP19DDWlINvAuuXSEPG7eQ fH3r5NJghTmZWYPzmslCZ6q3RyuUnUh5ZRUe5FI2ArG5H5wPS/hBHDIcpHcqwZJk38Lg iL3KjUOpPKBJdHSEft/8/dUMNF+wkKSWyJG0Nzd0yehsmjYaCwJ+GTqovwnlWSs/5ZjI CAZra6no+1X0qqyMCmBrAbKecisApbVR87OO/WC8pkJH+90IS1eJBOZqIFI1G7nv2DVb 87XxTK/3jx1Ofp+4EGO/rjdJgZKKaJUi5BiqTcP+nxSuihlcexU9PYwu0mRG61A0BPLZ vW+A== X-Forwarded-Encrypted: i=1; AJvYcCVeoIeXdUBpCtjwzCPZ6TVKwqPCfJtpNVjy6EmMTenBFoF3BhjdMUjIyUDSaxxmS/gi1GcNJKKVpzb+jz8=@vger.kernel.org X-Gm-Message-State: AOJu0YzeuWHc2DvnSCD7ujoSQ6pHhZK6Y/dbRfIXPjZ7djLH5Vt71EKj pAwa6ZbbhlrFLE7y7CsF1tfcGGQ+BZ4gBjsqOL7u1/kmAKlKQ14tPgKvjgyUC2x0/H0APDWRf0x gLFBl0TIdxX4XsA== X-Google-Smtp-Source: AGHT+IGzubu4+j4Wm71gbOmjK++zW+K5G1tJhZ31ZLEKts+FoujmHMCGALeFVIBAjlYDJOU9iVo1j5mmNPGzAw== X-Received: from wrno14.prod.google.com ([2002:adf:eace:0:b0:42c:c2d6:29a]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2f88:b0:429:c4bb:fbd6 with SMTP id ffacd0b85a97d-42f89f48525mr6497770f8f.31.1765157702413; Sun, 07 Dec 2025 17:35:02 -0800 (PST) Date: Mon, 08 Dec 2025 01:34:59 +0000 In-Reply-To: <20251208-gcov-inline-noinstr-v1-0-623c48ca5714@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251208-gcov-inline-noinstr-v1-0-623c48ca5714@google.com> X-Mailer: b4 0.14.2 Message-ID: <20251208-gcov-inline-noinstr-v1-2-623c48ca5714@google.com> Subject: [PATCH 2/2] kcsan: mark !__SANITIZE_THREAD__ stub __always_inline From: Brendan Jackman To: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Marco Elver , Ard Biesheuvel Cc: kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, Brendan Jackman Content-Type: text/plain; charset="utf-8" The x86 instrumented bitops in include/asm-generic/bitops/instrumented-non-atomic.h are KCSAN-instrumented via explicit calls to instrument_* functions from include/linux/instrumented.h. This bitops are used from noinstr code in __sev_es_nmi_complete(). This code avoids noinstr violations by disabling __SANITIZE_THREAD__ etc for the compilation unit. However, when GCOV is enabled, there can still be violations caused by the stub versions of these functions, since coverage instrumentation is injected that causes them to be out-of-lined. (Note: the GCOV isntrumentation itself also appears to violate noinstr in principle, but it appears to be harmless - basically just an inc instruction). Fix this by just applying __always_inline. Signed-off-by: Brendan Jackman --- include/linux/kcsan-checks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kcsan-checks.h b/include/linux/kcsan-checks.h index 92f3843d9ebb8177432bb4eccc151ea66d3dcbb7..cabb2ae46bdc0963bd89533777cab586ab4d5a1b 100644 --- a/include/linux/kcsan-checks.h +++ b/include/linux/kcsan-checks.h @@ -226,7 +226,7 @@ static inline void kcsan_end_scoped_access(struct kcsan_scoped_access *sa) { } #define __kcsan_disable_current kcsan_disable_current #define __kcsan_enable_current kcsan_enable_current_nowarn #else /* __SANITIZE_THREAD__ */ -static inline void kcsan_check_access(const volatile void *ptr, size_t size, +static __always_inline void kcsan_check_access(const volatile void *ptr, size_t size, int type) { } static inline void __kcsan_enable_current(void) { } static inline void __kcsan_disable_current(void) { } -- 2.50.1