[PATCH AUTOSEL 7.0-5.10] hexagon: uapi: Fix structure alignment attribute
Sasha Levin <[email protected]> Mon, 20 Apr 2026 09:19:41 -0400
| Newsgroups | org.kernel.vger.linux-hexagon,dev.linux.lists.patches,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
From: Thomas Weißschuh <[email protected]> [ Upstream commit 47bca1cbf692b89defbf4db27495813f82d5e3ff ] __aligned() is a kernel macro, which is not available in UAPI headers. Use the compiler-provided alignment attribute directly. Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> Tested-by: Nicolas Schier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Nicolas Schier <[email protected]> Signed-off-by: Sasha Levin <[email protected]> --- LLM Generated explanations, may be completely bogus: Now I have all the information needed. Let me compile the full analysis. --- ## PHASE 1: COMMIT MESSAGE FORENSICS **Step 1.1: Subject Line** Record: [hexagon/uapi] [Fix] Fix structure alignment attribute - replacing kernel-internal `__aligned()` macro with compiler `__attribute__((aligned(8)))` in a UAPI header. **Step 1.2: Tags** - Signed-off-by: Thomas Weißschuh (author, prolific UAPI header cleaner) - Acked-by: Arnd Bergmann (ARM/arch maintainer, respected cross- subsystem reviewer) - Reviewed-by: Nathan Chancellor (kbuild/clang maintainer) - Reviewed-by: Nicolas Schier - Tested-by: Nicolas Schier - Link: https://patch.msgid.link/20260227-kbuild-uapi- [email protected] - Signed-off-by: Nicolas Schier (committer) No Fixes: tag, no Cc: stable, no Reported-by. Strong review lineage (Arnd Bergmann + Nathan Chancellor). **Step 1.3: Body Text** The commit states: `__aligned()` is a kernel macro not available in UAPI headers. Uses the compiler-provided alignment attribute directly. This is a build fix - the UAPI header cannot be compiled by userspace programs. **Step 1.4: Hidden Bug Fix Detection** This IS a real bug fix. `__aligned()` is defined only in `include/linux/compiler_attributes.h` (line 33), which is NOT exported to userspace. Any userspace program including `<asm/sigcontext.h>` on hexagon will get a compilation error because `__aligned` is undefined. ## PHASE 2: DIFF ANALYSIS **Step 2.1: Inventory** - 1 file changed: `arch/hexagon/include/uapi/asm/sigcontext.h` - 1 line changed (s/__aligned(8)/__attribute__((aligned(8)))/) - Single-file, single-line surgical fix **Step 2.2: Code Flow** - Before: `} __aligned(8);` — uses kernel-only macro - After: `} __attribute__((aligned(8)));` — uses compiler-native attribute - Functionally identical within the kernel; fixes compilation for userspace **Step 2.3: Bug Mechanism** This is a build fix (category h: hardware workarounds/build fixes). The UAPI header uses a macro that only exists in kernel-internal headers. The macro `__aligned` is defined in `include/linux/compiler_attributes.h` as `__attribute__((__aligned__(x)))`. Since `compiler_attributes.h` is NOT exported to userspace, this header is broken for userspace compilation. **Step 2.4: Fix Quality** - Obviously correct: exact same pattern as the s390 fix (commit `bae0aae2f8f97`) from 2019 - Minimal/surgical: single character-level substitution - Zero regression risk: the replacement is semantically identical - Reviewed by 3 expert reviewers including Arnd Bergmann and Nathan Chancellor ## PHASE 3: GIT HISTORY **Step 3.1: Blame** The buggy line (`__aligned(8)`) was introduced in commit `cd5b61d6f4f07` ("Hexagon: Add signal functions") by Richard Kuo on 2011-10-31. This was first included in v3.2-rc1. The bug has existed since the very first version of this file — over 14 years and ALL stable trees. **Step 3.2: Fixes Tag** No Fixes: tag present. The implicit fix target is `cd5b61d6f4f07` from v3.2. **Step 3.3: File History** The file has had only 3 commits since creation (all trivial: copyright changes, SPDX, UAPI disintegration). No conflicting changes exist. **Step 3.4: Author** Thomas Weißschuh is a prolific contributor to UAPI header cleanups. He authored a major series adding UAPI header build validation (`kbuild: uapi: validate that headers do not use libc`), and has systematically fixed many UAPI header issues across multiple architectures. **Step 3.5: Dependencies** This is a standalone fix. No prerequisites needed. The file is trivially simple and unchanged across all stable trees. ## PHASE 4: MAILING LIST RESEARCH **Step 4.1-4.2:** Lore.kernel.org was unreachable (anti-bot protection). The commit has strong review signals: Acked-by Arnd Bergmann, Reviewed- by Nathan Chancellor and Nicolas Schier, Tested-by Nicolas Schier. **Step 4.3:** The Link: message-id suggests this is patch 1 of series "kbuild-uapi-libc-v1", which is Thomas's UAPI cleanup work. This specific fix is self-contained. **Step 4.4-4.5:** Cannot verify stable mailing list discussion due to lore access restrictions. ## PHASE 5: CODE SEMANTIC ANALYSIS **Step 5.1-5.4:** The change is to a structure definition in a header file. `struct sigcontext` is used in signal handling code for the hexagon architecture. The fix only changes the macro used for the alignment attribute — it does not change the structure layout, alignment, or any runtime behavior. This is purely a compile-time fix for userspace consumers of the header. **Step 5.5: Similar Patterns** The exact same bug was fixed for s390 in commit `bae0aae2f8f97` ("s390: fix unrecognized __aligned() in uapi header", 2019). That fix used the same approach: replacing `__aligned()` with `__attribute__`. The hexagon instance is the LAST remaining bare `__aligned()` in any UAPI header (confirmed by grep). ## PHASE 6: STABLE TREE ANALYSIS **Step 6.1:** The buggy code exists in ALL stable trees (v3.2+, since 2011). Every stable tree that supports hexagon is affected. **Step 6.2:** The patch will apply cleanly to all stable trees — the file has been unchanged (except for trivial metadata) since creation. **Step 6.3:** No related fixes already in stable for this specific file. ## PHASE 7: SUBSYSTEM CONTEXT **Step 7.1:** Architecture-specific (hexagon) UAPI header. Hexagon is a niche architecture (Qualcomm DSP), so this is PERIPHERAL criticality. However, UAPI header correctness affects anyone building userspace tools for that architecture. **Step 7.2:** Very low activity — file unchanged since 2017 (SPDX addition). ## PHASE 8: IMPACT AND RISK **Step 8.1:** Affects: hexagon userspace developers who include `<asm/sigcontext.h>`. **Step 8.2:** Triggered whenever a userspace program includes this header on hexagon. Always reproducible. **Step 8.3:** Failure mode: compilation error. Severity: MEDIUM (build breakage, not runtime). **Step 8.4:** - BENEFIT: Low-medium (niche architecture, but fixes a real build breakage) - RISK: Extremely low (1-line change, semantically identical, well- reviewed, proven pattern from s390 fix) - Ratio: Favorable — virtually zero risk for a real fix ## PHASE 9: FINAL SYNTHESIS **Evidence FOR backporting:** - Fixes a real UAPI header compilation breakage - One-line, trivially correct change - Proven fix pattern (identical to s390 fix from 2019) - Reviewed by 3 experts (Arnd Bergmann, Nathan Chancellor, Nicolas Schier) - Tested by Nicolas Schier - Bug exists in all stable trees since v3.2 - Will apply cleanly with zero conflicts - Falls into "build fix" exception category **Evidence AGAINST backporting:** - Hexagon is a niche architecture with limited userbase - No Fixes: tag or Cc: stable (expected, not a negative signal) - Not a runtime bug — only affects userspace compilation **Stable Rules Checklist:** 1. Obviously correct and tested? **YES** — reviewed by 3 experts, tested, identical to proven s390 fix 2. Fixes a real bug? **YES** — UAPI header is broken for userspace compilation 3. Important issue? **MEDIUM** — build fix (compilation error) 4. Small and contained? **YES** — 1 line changed in 1 file 5. No new features or APIs? **YES** — no new features 6. Can apply to stable? **YES** — clean apply guaranteed (file unchanged since 2017) **Exception Category:** Build fix — these are explicitly called out as stable-worthy. ## Verification - [Phase 1] Parsed tags: Acked-by Arnd Bergmann, Reviewed-by Nathan Chancellor + Nicolas Schier, Tested-by Nicolas Schier - [Phase 2] Diff analysis: 1 line changed, `__aligned(8)` -> `__attribute__((aligned(8)))` in UAPI header - [Phase 3] git blame: buggy code introduced in `cd5b61d6f4f07` (v3.2-rc1, 2011), present in all stable trees - [Phase 3] git log: file has only 3 commits total (all trivial metadata), no conflicts possible - [Phase 3] Author: Thomas Weißschuh is a prolific UAPI header maintainer with 20+ related commits - [Phase 4] b4 dig: commit not yet in tree (candidate), lore blocked by anti-bot protection - [Phase 5] grep: confirmed this is the ONLY remaining bare `__aligned()` in all UAPI headers - [Phase 5] Verified `__aligned` defined only in `include/linux/compiler_attributes.h` (line 33), not exported to userspace - [Phase 6] File unchanged since 2017, will apply cleanly to all stable trees - [Phase 6] Precedent: identical s390 fix (commit `bae0aae2f8f97`) was applied in v5.3 for the same bug pattern - [Phase 8] Failure mode: userspace compilation error; severity MEDIUM; risk extremely low **YES** arch/hexagon/include/uapi/asm/sigcontext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/hexagon/include/uapi/asm/sigcontext.h b/arch/hexagon/include/uapi/asm/sigcontext.h index 7171edb1b8b71..179a97041b593 100644 --- a/arch/hexagon/include/uapi/asm/sigcontext.h +++ b/arch/hexagon/include/uapi/asm/sigcontext.h @@ -29,6 +29,6 @@ */ struct sigcontext { struct user_regs_struct sc_regs; -} __aligned(8); +} __attribute__((aligned(8))); #endif -- 2.53.0