public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Heiko Carstens <hca@linux.ibm.com>,
	Sasha Levin <sashal@kernel.org>,
	nathan@kernel.org, agordeev@linux.ibm.com, svens@linux.ibm.com,
	iii@linux.ibm.com, gor@linux.ibm.com, petr.pavlu@suse.com,
	llvm@lists.linux.dev
Subject: [PATCH AUTOSEL 6.19-6.18] s390/boot: Add -Wno-default-const-init-unsafe to KBUILD_CFLAGS
Date: Wed, 11 Feb 2026 07:30:15 -0500	[thread overview]
Message-ID: <20260211123112.1330287-5-sashal@kernel.org> (raw)
In-Reply-To: <20260211123112.1330287-1-sashal@kernel.org>

From: Heiko Carstens <hca@linux.ibm.com>

[ Upstream commit 5ba35a6c13fff0929c34aba6b7602dacbe68686c ]

Add -Wno-default-const-init-unsafe to boot KBUILD_CFLAGS, similar to
scripts/Makefile.extrawarn, since clang generates warnings for the dummy
variable in typecheck():

    CC      arch/s390/boot/version.o
      arch/s390/include/asm/ptrace.h:221:9: warning: default initialization of an object of type 'typeof (regs->psw)' (aka 'const psw_t') leaves the object uninitialized [-Wdefault-const-init-var-unsafe]
        221 |         return psw_bits(regs->psw).pstate;
            |                ^
      arch/s390/include/asm/ptrace.h:98:2: note: expanded from macro 'psw_bits'
         98 |         typecheck(psw_t, __psw);                \
            |         ^
      include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
         11 |         typeof(x) __dummy2; \
            |                   ^

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

Now I have a thorough understanding of this commit. Let me compile my
analysis.

## Detailed Analysis

### 1. COMMIT MESSAGE ANALYSIS

The commit subject clearly states it adds `-Wno-default-const-init-
unsafe` to the s390 boot `KBUILD_CFLAGS`. The commit message explains it
mirrors the same flag already added in `scripts/Makefile.extrawarn` (now
`scripts/Makefile.warn`) and provides a concrete compiler warning output
demonstrating the problem. The author is Heiko Carstens, the s390
subsystem maintainer.

### 2. CODE CHANGE ANALYSIS

The change is a **single line addition** to `arch/s390/boot/Makefile`:

```
KBUILD_CFLAGS += $(call cc-option, -Wno-default-const-init-unsafe)
```

This uses `cc-option`, which means:
- If the compiler supports the flag, it's added
- If the compiler doesn't support the flag (older clang, any gcc), it's
  silently ignored
- **Zero risk of breaking anything on any compiler version**

### 3. WHY THE S390 BOOT CODE NEEDS A SEPARATE FIX

The key architectural issue is that the s390 boot code builds with its
own **completely independent** compiler flags. Looking at
`arch/s390/Makefile` lines 25-38, `KBUILD_CFLAGS_DECOMPRESSOR` is
constructed from scratch:

```25:38:arch/s390/Makefile
KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack
-std=gnu11 -fms-extensions
KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
// ... more flags built independently ...
```

Then in `arch/s390/boot/Makefile` line 21:

```21:21:arch/s390/boot/Makefile
KBUILD_CFLAGS := $(filter-out
$(CC_FLAGS_MARCH),$(KBUILD_CFLAGS_DECOMPRESSOR))
```

This **completely replaces** the global `KBUILD_CFLAGS` with the
decompressor-specific flags. So the `-Wno-default-const-init-unsafe`
flag added by the main fix (`d0afcfeb9e381`, "kbuild: Disable -Wdefault-
const-init-unsafe") in `scripts/Makefile.warn` is **never seen** by the
s390 boot code.

### 4. BUILD FAILURE CONFIRMED WITH CONFIG_WERROR

From `scripts/Makefile.lib` line 28, the actual compilation uses:
```
$(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(ccflags-y)
```

While `KBUILD_CFLAGS` is overridden for s390 boot, `KBUILD_CPPFLAGS`
(which includes `-Werror` when `CONFIG_WERROR=y`) is NOT overridden.
This means with clang 21+ and `CONFIG_WERROR=y`, the s390 boot code will
**fail to compile** with:

```
error: default initialization of an object of type 'typeof (regs->psw)'
(aka 'const psw_t') leaves the object uninitialized [-Werror,-Wdefault-
const-init-var-unsafe]
```

The warning comes from the `psw_bits()` macro in
`arch/s390/include/asm/ptrace.h` line 98 which uses `typecheck()`, and
`typecheck()` in `include/linux/typecheck.h` line 11 creates a dummy
variable that triggers this clang 21+ warning.

### 5. RELATIONSHIP TO THE PARENT FIX

The parent commit `d0afcfeb9e381` ("kbuild: Disable -Wdefault-const-
init-unsafe") by Nathan Chancellor was explicitly tagged `Cc:
stable@vger.kernel.org`, confirming the upstream maintainers consider
this class of fix appropriate for stable. The parent fix handles the
global build system, but misses the s390 boot code because of its
independent build flags. This commit is the necessary companion fix.

### 6. CLASSIFICATION

This is a **build fix** — one of the categories explicitly allowed in
stable kernel rules. It:
- Prevents compilation warnings that become errors with `CONFIG_WERROR`
- Affects a real architecture (s390/IBM Z mainframes) used heavily in
  enterprise
- Is needed when building with clang 21+ (which has the warning enabled
  by default)
- Has zero runtime impact — it only affects the compiler's warning
  behavior

### 7. SCOPE AND RISK ASSESSMENT

- **Lines changed:** 1
- **Files changed:** 1
- **Risk:** Essentially zero
  - `cc-option` ensures no effect on compilers that don't support the
    flag
  - No runtime behavioral change whatsoever
  - No code generation change
  - Only suppresses a warning
- **Self-contained:** Yes, completely independent. No dependencies on
  other patches.

### 8. USER IMPACT

- **Who is affected:** s390 users building with clang 21+ (enterprise
  Linux distributions on IBM Z)
- **Severity without fix:** Build failure with `CONFIG_WERROR=y`,
  annoying warnings without it
- **Impact with fix:** Clean build, zero runtime change

### 9. STABILITY

- Written by Heiko Carstens, the s390 subsystem maintainer
- Trivial one-line change with no possible regression path
- Mirrors exactly what was already done for the global build system

### Conclusion

This is a textbook stable kernel candidate. It's a **one-line build
fix** that prevents compilation warnings/errors on s390 when using clang
21+. The parent fix (`d0afcfeb9e381`) was already explicitly tagged for
stable, and this commit is the necessary companion to handle the s390
boot code's independent build environment. The risk is essentially zero
(uses `cc-option` for safe degradation), the fix is self-contained, and
it addresses a real build issue for s390 enterprise users.

**YES**

 arch/s390/boot/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
index 490167faba7a4..a1e719a79d38c 100644
--- a/arch/s390/boot/Makefile
+++ b/arch/s390/boot/Makefile
@@ -21,6 +21,7 @@ KBUILD_AFLAGS := $(filter-out $(CC_FLAGS_MARCH),$(KBUILD_AFLAGS_DECOMPRESSOR))
 KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_MARCH),$(KBUILD_CFLAGS_DECOMPRESSOR))
 KBUILD_AFLAGS += $(CC_FLAGS_MARCH_MINIMUM) -D__DISABLE_EXPORTS
 KBUILD_CFLAGS += $(CC_FLAGS_MARCH_MINIMUM) -D__DISABLE_EXPORTS
+KBUILD_CFLAGS += $(call cc-option, -Wno-default-const-init-unsafe)
 
 CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
 
-- 
2.51.0


  parent reply	other threads:[~2026-02-11 12:31 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 12:30 [PATCH AUTOSEL 6.19-5.10] s390/perf: Disable register readout on sampling events Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] arm64: Add support for TSV110 Spectre-BHB mitigation Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] xenbus: Use .freeze/.thaw to handle xenbus devices Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] s390/purgatory: Add -Wno-default-const-init-unsafe to KBUILD_CFLAGS Sasha Levin
2026-02-11 12:30 ` Sasha Levin [this message]
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.1] perf/arm-cmn: Support CMN-600AE Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.18] ntfs: ->d_compare() must not block Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.12] ACPI: x86: s2idle: Invoke Microsoft _DSM Function 9 (Turn On Display) Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.12] block: decouple secure erase size limit from discard size limit Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] sparc: don't reference obsolete termio struct for TC* constants Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] EFI/CPER: don't go past the ARM processor CPER record buffer Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19] ACPI: scan: Use async schedule function in acpi_scan_clear_dep_fn() Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.6] cpufreq: dt-platdev: Block the driver from probing on more QC platforms Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] EFI/CPER: don't dump the entire memory region Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.12] ACPI: battery: fix incorrect charging status when current is zero Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.18] rust: cpufreq: always inline functions using build_assert with arguments Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.18] blk-mq-sched: unify elevators checking for async requests Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] x86/xen/pvh: Enable PAE mode for 32-bit guest only when CONFIG_X86_PAE is set Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.12] APEI/GHES: ARM processor Error: don't go past allocated memory Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.18] md raid: fix hang when stopping arrays with metadata through dm-raid Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] tools/power cpupower: Reset errno before strtoull() Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] sparc: Synchronize user stack on fork and clone Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] blk-mq-debugfs: add missing debugfs_mutex in blk_mq_debugfs_register_hctxs() Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] rnbd-srv: Zero the rsp buffer before using it Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.12] alpha: fix user-space corruption during memory compaction Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] ACPICA: Abort AML bytecode execution when executing AML_FATAL_OP Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19] arm64: mte: Set TCMA1 whenever MTE is present in the kernel Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.18] tools/cpupower: Fix inverted APERF capability check Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.15] ACPI: processor: Fix NULL-pointer dereference in acpi_processor_errata_piix4() Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.12] ACPI: resource: Add JWIPC JVC9100 to irq1_level_low_skip_override[] Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.6] perf/cxlpmu: Replace IRQF_ONESHOT with IRQF_NO_THREAD Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.6] md-cluster: fix NULL pointer dereference in process_metadata_update Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-5.10] APEI/GHES: ensure that won't go past CPER allocated record Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.12] powercap: intel_rapl: Add PL4 support for Ice Lake Sasha Levin
2026-02-11 12:30 ` [PATCH AUTOSEL 6.19-6.18] io_uring/timeout: annotate data race in io_flush_timeouts() 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=20260211123112.1330287-5-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=petr.pavlu@suse.com \
    --cc=stable@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /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