From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Brendan Jackman <jackmanb@google.com>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
Marco Elver <elver@google.com>, Sasha Levin <sashal@kernel.org>,
nathan@kernel.org, ardb@kernel.org, mingo@kernel.org,
llvm@lists.linux.dev
Subject: [PATCH AUTOSEL 6.18] x86/sev: Disable GCOV on noinstr object
Date: Mon, 12 Jan 2026 09:58:03 -0500 [thread overview]
Message-ID: <20260112145840.724774-2-sashal@kernel.org> (raw)
In-Reply-To: <20260112145840.724774-1-sashal@kernel.org>
From: Brendan Jackman <jackmanb@google.com>
[ Upstream commit 9efb74f84ba82a9de81fc921baf3c5e2decf8256 ]
With Debian clang version 19.1.7 (3+build5) there are calls to
kasan_check_write() from __sev_es_nmi_complete(), which violates noinstr. Fix
it by disabling GCOV for the noinstr object, as has been done for previous
such instrumentation issues.
Note that this file already disables __SANITIZE_ADDRESS__ and
__SANITIZE_THREAD__, thus calls like kasan_check_write() ought to be nops
regardless of GCOV. This has been fixed in other patches. However, to avoid
any other accidental instrumentation showing up, (and since, in principle GCOV
is instrumentation and hence should be disabled for noinstr code anyway),
disable GCOV overall as well.
Signed-off-by: Brendan Jackman <jackmanb@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Marco Elver <elver@google.com>
Link: https://patch.msgid.link/20251216-gcov-inline-noinstr-v3-3-10244d154451@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Analysis of Commit: x86/sev: Disable GCOV on noinstr object
### 1. COMMIT MESSAGE ANALYSIS
The commit message clearly explains the problem:
- With Clang 19.1.7, GCOV instrumentation causes calls to
`kasan_check_write()` from `__sev_es_nmi_complete()`
- This violates the `noinstr` (no instrumentation) attribute requirement
- The fix follows an established pattern already used in the same file
for other sanitizers
Key review tags:
- Signed-off-by maintainers from Google and AMD (Borislav Petkov, well-
known x86 maintainer)
- Acked-by from Marco Elver (instrumentation/sanitizer expert at Google)
### 2. CODE CHANGE ANALYSIS
The change is trivially simple - one line added to a Makefile:
```makefile
GCOV_PROFILE_noinstr.o := n
```
This disables GCOV code coverage profiling for the `noinstr.o` object
file. The context shows this follows an established pattern:
- `UBSAN_SANITIZE_noinstr.o := n` - already disables UBSAN
- `KASAN_SANITIZE_noinstr.o := n` - already disables KASAN
- `KCSAN_SANITIZE_noinstr.o := n` - already disables KCSAN
The `noinstr` attribute is critical for code that runs in sensitive
contexts like NMI handlers, where any unexpected function calls can
cause deadlocks, crashes, or undefined behavior.
### 3. CLASSIFICATION
This is a **build fix** that prevents instrumentation violations. When
`noinstr` code gets instrumented:
- NMI handlers may call functions that aren't safe in NMI context
- Potential deadlocks if instrumentation takes locks
- Potential crashes or undefined behavior
This falls squarely under the "build fixes" exception category for
stable backports.
### 4. SCOPE AND RISK ASSESSMENT
- **Lines changed**: 2 (including blank line)
- **Files touched**: 1 Makefile only
- **Complexity**: Minimal
- **Risk**: Extremely low
This change cannot cause regressions because:
1. It's a Makefile-only change, not code modification
2. It only disables optional build-time instrumentation
3. GCOV is used for code coverage analysis, not production functionality
4. The pattern is already used in the same file for other sanitizers
### 5. USER IMPACT
- **Affected users**: Those building with GCOV enabled + Clang 19+ + AMD
SEV support
- **Severity if hit**: noinstr violations in NMI handlers can cause
crashes or deadlocks - severe
- **Scope**: Relatively niche configuration, but real for users who hit
it
### 6. STABILITY INDICATORS
- Reviewed and acked by instrumentation expert (Marco Elver)
- Signed off by well-known x86 maintainer (Borislav Petkov)
- Follows well-established pattern in the kernel
### 7. DEPENDENCY CHECK
- No dependencies on other commits
- The affected Makefile with existing `*_SANITIZE_noinstr.o` lines
exists in stable trees with SEV support
### VERDICT
**Pros:**
- Trivially small change (1 line)
- Fixes a real instrumentation violation issue
- Zero risk of runtime regression
- Follows established pattern already in the file
- Well-reviewed by appropriate experts
- Falls under "build fixes" exception
**Cons:**
- Requires specific toolchain configuration to trigger
- Somewhat niche (Clang 19 + GCOV + SEV)
This is a textbook example of a safe, low-risk build fix. It disables
optional instrumentation for code that must not be instrumented
(`noinstr`). The change is defensive, harmless, and prevents potential
crashes/deadlocks in NMI handlers. Even if users don't actively hit the
issue with their current toolchain, disabling GCOV for noinstr code is
the correct thing to do.
**YES**
arch/x86/coco/sev/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/coco/sev/Makefile b/arch/x86/coco/sev/Makefile
index 3b8ae214a6a64..b2e9ec2f69014 100644
--- a/arch/x86/coco/sev/Makefile
+++ b/arch/x86/coco/sev/Makefile
@@ -8,3 +8,5 @@ UBSAN_SANITIZE_noinstr.o := n
# GCC may fail to respect __no_sanitize_address or __no_kcsan when inlining
KASAN_SANITIZE_noinstr.o := n
KCSAN_SANITIZE_noinstr.o := n
+
+GCOV_PROFILE_noinstr.o := n
--
2.51.0
next prev parent reply other threads:[~2026-01-12 14:58 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 14:58 [PATCH AUTOSEL 6.18] HID: Elecom: Add support for ELECOM M-XT3DRBK (018C) Sasha Levin
2026-01-12 14:58 ` Sasha Levin [this message]
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] wifi: mac80211: collect station statistics earlier when disconnect Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] btrfs: do not free data reservation in fallback from inline due to -ENOSPC Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] btrfs: fix deadlock in wait_current_trans() due to ignored transaction type Sasha Levin
2026-01-19 11:46 ` Motiejus Jakštys
2026-01-20 11:03 ` Greg KH
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: quirks: Add another Chicony HP 5MP Cameras to hid_ignore_list Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.1] HID: intel-ish-hid: Update ishtp bus match to support device ID table Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: multitouch: add MT_QUIRK_STICKY_FINGERS to MT_CLS_VTL Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.1] HID: i2c-hid: fix potential buffer overflow in i2c_hid_get_report() Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] riscv: trace: fix snapshot deadlock with sbi ecall Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] drm/amd/pm: Disable MMIO access during SMU Mode 1 reset Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] riscv: Sanitize syscall table indexing under speculation Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.15] netfilter: replace -EEXIST with -EBUSY Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] PCI: qcom: Remove ASPM L0s support for MSM8996 SoC Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] ALSA: hda/realtek: add HP Laptop 15s-eq1xxx mute LED quirk Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] ring-buffer: Avoid softlockup in ring_buffer_resize() during memory free Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.15] HID: playstation: Center initial joystick axes to prevent spurious events Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: intel-ish-hid: Reset enum_devices_done before enumeration Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] drm/amd/display: Reduce number of arguments of dcn30's CalculatePrefetchSchedule() Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: Apply quirk HID_QUIRK_ALWAYS_POLL to Edifier QR30 (2d99:a101) Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.1] btrfs: fix reservation leak in some error paths when inserting inline extent Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] ALSA: hda/realtek: Add quirk for Acer Nitro AN517-55 Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-6.12] HID: logitech: add HID++ support for Logitech MX Anywhere 3S Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18] HID: Intel-thc-hid: Intel-thc: Add safety check for reading DMA buffer Sasha Levin
2026-01-12 14:58 ` [PATCH AUTOSEL 6.18-5.10] HID: usbhid: paper over wrong bNumDescriptor field Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260112145840.724774-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=elver@google.com \
--cc=jackmanb@google.com \
--cc=llvm@lists.linux.dev \
--cc=mingo@kernel.org \
--cc=nathan@kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox