From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.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 9DC77314B8E for ; Tue, 16 Dec 2025 09:41:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765878077; cv=none; b=OFrzDhEYCtYZtdQFxSlbsk0NTzmLJbeRskGl0vZ+srpNlY89jo7WFjTzg24YXM4kT569vBE3nRxIQzdwVmX3ybZHNxUO6Fd7kTXpp6Ghi/oI5jqbdTDNeefDPkKEo78CB7jjOaAB97gVODVj4ODbR6xC+qc2aH705LwX2h7i6+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765878077; c=relaxed/simple; bh=m80j35KMhFVGk671vpwVN5HnZRHSgext1jAZLmUjQOg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=De9atPQg8wwdIXqwC1nOP9WnD4XpGmxGLxczY/SozgffGb17aEF/WTRmOlk5Y82YUaLe6OkwXJY9aW77Bu3/foAFgOoK/sPd7jgPAqKEMutRmyUlYBERealA770enaHkjBTnjvJyC7Z68d//0EPqP54qfd2A6KgXygD2KYxMRvg= 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=VXkoDzb4; arc=none smtp.client-ip=209.85.128.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="VXkoDzb4" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-47a97b7187dso12839995e9.0 for ; Tue, 16 Dec 2025 01:41:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765878074; x=1766482874; 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=kzxpi320fuDlWVEdLz2y5J46WN58k2cyto0/t27GRCA=; b=VXkoDzb4Ijm3xwdTLOcWOlDGRuKxWkNm5pmLbRmz8o0IvcT6q97rTCSTgSP1v2w5wM G/Am8XbMF5XuqsmR454Ir/Ftyby+M2wjAoqGaFM+66PUkL5V/LMGBdTJnSx/XJIrivRA zzblcH5BZekCLUVGqRsKfgTPpkm4dKHDZKvG/x5ygk+482ZJgPj4Gf7CWC2t6VD252zW W8J89JS0x21WxEpPWwJURS2T8Bn/jllwdf1aSWlW8hsvZJV8Pv1cYAsOEf1wE+mVSo+J Eota3hNJPLP63NOdcYrw3RhtYgU6z2EAgwUY5RYOh88TgeFMeTqUZW4kuGLm4eCQGtv5 v6rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765878074; x=1766482874; 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=kzxpi320fuDlWVEdLz2y5J46WN58k2cyto0/t27GRCA=; b=MRfmuM6X2fCStGS5siArqfvwIu3BDbvPJD1sb7r6YUN7uicKdGe6FcR8jnoXRYgslY yMRaAcg8qWgsXlUi/2L93q+VoTGuva6miXyEX+EBnVHS4al858GsyM7W9iRhBcIWyqpv LiVHF7/69jWJ0D0qqFVNO80RRt8Hqtg48CyW+1NiWREBfK2A7xOF5K26xpjz1AzqoXdD B2qjJWy+V6ELoaoz8sgVsvX4Yt/IYb0qwFOVrkw9bpOjqUMZ5NgQhdIeQF5MHJ+hTLLl ZZvgfzIldpBBip92lXtAbqNzdE/611JGCXKVlxpIIUSHX8xA1EpILRp4ZECopeJhGuFj iPWg== X-Forwarded-Encrypted: i=1; AJvYcCUBos8IcgGHh3bD906BKGDrv9phWjDxWlM5oeP8NgxGMVs9lpUBeWz+OjFQ5e5Ts9ksCZAxczWUx5WB3LE=@vger.kernel.org X-Gm-Message-State: AOJu0YworkqHmZX3G8FXv/yPrAshCCYP/J7eC7y8AiNK6B5bkV4cGqZG dTTDzsGt63+Y+CsDZCYohHWnh+wR3oBAv5d/LtO+i6sIwvy3pyFJ881yjfSqtWgdvisAkJhhwUb sq8x74KmiZ7xuGw== X-Google-Smtp-Source: AGHT+IHlGZ7scCmtn9fKI/xDVPOT3GK+BG/3UU2AW1/QYiZ2i73rDF+NNg+7Jlh+cIQIC8b8RYPJ0jgQMwx4jg== X-Received: from wmpu6.prod.google.com ([2002:a05:600c:4d06:b0:47a:814a:e0cf]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1c88:b0:477:8a29:582c with SMTP id 5b1f17b1804b1-47a8f917533mr151251585e9.34.1765878073998; Tue, 16 Dec 2025 01:41:13 -0800 (PST) Date: Tue, 16 Dec 2025 09:41:13 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251215-gcov-inline-noinstr-v2-0-6f100b94fa99@google.com> <20251215-gcov-inline-noinstr-v2-2-6f100b94fa99@google.com> X-Mailer: aerc 0.21.0 Message-ID: Subject: Re: [PATCH v2 2/3] kcsan: mark !__SANITIZE_THREAD__ stub __always_inline From: Brendan Jackman To: Marco Elver , Brendan Jackman Cc: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Ard Biesheuvel , , Content-Type: text/plain; charset="UTF-8" On Mon Dec 15, 2025 at 12:11 PM UTC, Marco Elver wrote: > On Mon, 15 Dec 2025 at 11:12, Brendan Jackman wrote: >> >> 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. >> >> 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) { } > > It wouldn't be wrong to apply __always_inline to these 2 stub > functions as well, but I think it's fair if you just limit this to the > ones used from . Either way, please > double-check. I was thinking here that it's a bug to call these from noinstr code, regardless of your ambient instrumentation settings. But yeah, on second thoughts... says who? I don't think that _has_ to be a bug, we could totally mark them __always_inline.