lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251006181835.1919496-1-sashal@kernel.org>
Date: Mon,  6 Oct 2025 14:17:33 -0400
From: Sasha Levin <sashal@...nel.org>
To: patches@...ts.linux.dev,
	stable@...r.kernel.org
Cc: Nathan Chancellor <nathan@...nel.org>,
	"Borislav Petkov (AMD)" <bp@...en8.de>,
	Sasha Levin <sashal@...nel.org>,
	tglx@...utronix.de,
	mingo@...hat.com,
	dave.hansen@...ux.intel.com,
	x86@...nel.org,
	linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev
Subject: [PATCH AUTOSEL 6.17-5.4] x86/build: Remove cc-option from stack alignment flags

From: Nathan Chancellor <nathan@...nel.org>

[ Upstream commit d87208128a3330c0eab18301ab39bdb419647730 ]

'-mpreferred-stack-boundary' (the GCC option) and '-mstack-alignment'
(the clang option) have been supported in their respective compilers for
some time, so it is unnecessary to check for support for them via
cc-option. '-mpreferred-stack-boundary=3' had a restriction on
'-mno-sse' until GCC 7.1 but that is irrelevant for most of the kernel,
which includes '-mno-sse'.

Move to simple Kconfig checks to avoid querying the compiler for the
flags that it supports.

Signed-off-by: Nathan Chancellor <nathan@...nel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Link: https://lore.kernel.org/20250814-x86-min-ver-cleanups-v1-2-ff7f19457523@kernel.org
Signed-off-by: Sasha Levin <sashal@...nel.org>
---

LLM Generated explanations, may be completely bogus:

Based on my comprehensive analysis of this commit, here is my
determination:

## Backport Status: NO

### Extensive Analysis

**Commit Context:**
- Upstream commit: d87208128a3330c0eab18301ab39bdb419647730 (August 14,
  2025)
- Author: Nathan Chancellor
- Part of patch series: "x86-min-ver-cleanups-v1"
- Already backported to 6.17 stable as 8be33f616f1c4 via AUTOSEL
  (Automatic Stable Election)
- Target tree: linux-autosel-6.17 (kernel 6.17)

**What the Commit Does:**
The commit removes runtime compiler capability checks (`cc-option`) for
stack alignment flags and replaces them with build-time Kconfig checks:
- For GCC: Uses `CONFIG_CC_IS_GCC` to unconditionally set `-mpreferred-
  stack-boundary=2/3`
- For Clang: Uses `CONFIG_CC_IS_CLANG` to unconditionally set `-mstack-
  alignment=4/8`

**Code Changes Analysis:**
```makefile
# OLD: Runtime check if compiler supports the flags
-ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
+ifdef CONFIG_CC_IS_GCC
       cc_stack_align4 := -mpreferred-stack-boundary=2
       cc_stack_align8 := -mpreferred-stack-boundary=3
-else ifneq ($(call cc-option, -mstack-alignment=16),)
+endif
+ifdef CONFIG_CC_IS_CLANG
       cc_stack_align4 := -mstack-alignment=4
       cc_stack_align8 := -mstack-alignment=8
 endif
```

**Dependency Analysis:**
- Requires minimum GCC 8.1 for x86 (introduced in v6.15 via commit
  a3e8fe814ad1)
- Requires minimum Clang 15.0.0 for x86 (commit 7861640aac52b)
- Both requirements are satisfied in 6.17 stable tree (verified via
  scripts/min-tool-version.sh)
- GCC 7.1+ supports `-mpreferred-stack-boundary=3` with `-msse` (per GCC
  commit 34fac449e121)

**Evaluation Against Stable Kernel Rules:**

According to Documentation/process/stable-kernel-rules.rst, stable
patches must:

1. ✅ **Already exist in mainline**: YES -
   d87208128a3330c0eab18301ab39bdb419647730
2. ✅ **Obviously correct and tested**: YES - simple Makefile change, no
   issues found
3. ✅ **Not bigger than 100 lines**: YES - only 5 lines changed (3
   insertions, 2 deletions)
4. ✅ **Follow submitting-patches.rst rules**: YES
5. ❌ **Fix a real bug or add device ID**: **NO - This is the critical
   failure**

The rules explicitly state (lines 15-31 of stable-kernel-rules.rst):
> "It must either fix a real bug that bothers people or just add a
device ID."

This commit:
- Does **NOT** fix a bug (no oops, hang, data corruption, security
  issue, build error, etc.)
- Is a **cleanup/optimization** to improve build performance
- Provides **no user-visible bug fix**
- Falls under "trivial fixes without benefit for users" category (rule
  line 30-31)
- The original author did **NOT** tag it with `Cc:
  stable@...r.kernel.org`

**Search for Issues/Regressions:**
- Searched Linux kernel mailing lists: No issues found
- Searched for reverts: None found
- Searched for build failures: None reported
- Part of systematic cleanup series with no reported problems

**Risk Assessment:**
- **Technical risk**: Very low - simple change, dependencies satisfied
- **Regression risk**: Very low - no functionality change, just build
  system optimization
- **Policy compliance**: **Does not meet stable kernel criteria**

### Conclusion

While this commit is technically safe and provides a marginal build-time
performance improvement by eliminating unnecessary runtime compiler
checks, **it does not meet the fundamental requirement for stable kernel
backporting**: it does not fix a bug that affects users.

The commit is purely a cleanup that removes obsolete code after compiler
minimum version requirements were raised. Such cleanups belong in
mainline development, not stable trees, which should focus exclusively
on fixing bugs that impact users.

The fact that it was auto-selected by AUTOSEL does not override the
documented stable kernel rules. This commit should be **rejected** from
stable backporting or **reverted** if already applied.

 arch/x86/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1913d342969ba..7cfc1b31f17e1 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -37,10 +37,11 @@ export RETPOLINE_VDSO_CFLAGS
 
 # For gcc stack alignment is specified with -mpreferred-stack-boundary,
 # clang has the option -mstack-alignment for that purpose.
-ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
+ifdef CONFIG_CC_IS_GCC
       cc_stack_align4 := -mpreferred-stack-boundary=2
       cc_stack_align8 := -mpreferred-stack-boundary=3
-else ifneq ($(call cc-option, -mstack-alignment=16),)
+endif
+ifdef CONFIG_CC_IS_CLANG
       cc_stack_align4 := -mstack-alignment=4
       cc_stack_align8 := -mstack-alignment=8
 endif
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ