This bug is awaiting verification that the linux-xuantie/7.0.0-1004.4 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-resolute-linux-xuantie' to 'verification-done- resolute-linux-xuantie'. If the problem still exists, change the tag 'verification-needed-resolute-linux-xuantie' to 'verification-failed- resolute-linux-xuantie'. If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you! ** Tags added: kernel-spammed-resolute-linux-xuantie-v2 verification-needed-resolute-linux-xuantie -- You received this bug notification because you are subscribed to linux in Ubuntu. Matching subscriptions: Bgg, Bmail, Nb https://bugs.launchpad.net/bugs/2148809 Title: apparmor: LLVM/clang build failure due to uninitialized variable in notify.c Status in linux package in Ubuntu: Fix Released Bug description: [Impact] Building the Ubuntu Resolute (26.04) kernel with LLVM/clang (LLVM=1) fails due to an uninitialized variable in security/apparmor/notify.c. The function knotif_update_from_uresp_perm() declares `u16 flags` without initialization. The compiler detects that when `uresp` is NULL, the else branch (line 839) does not assign a value to `flags`, but `flags` is subsequently read at line 846 in the expression `flags & URESPONSE_NO_CACHE`. Currently the only call site (line 1041) always passes a non-NULL pointer (`&uresp->perm`), so the uninitialized read is not reachable at runtime. However, the function signature accepts a pointer and explicitly checks for NULL, making this a latent defect. Clang's -Wsometimes-uninitialized correctly flags this, and combined with -Werror, the build fails. [Test case] 1. Download linux_7.0.0-10.10 source 2. Configure with x86_64_defconfig + CONFIG_SECURITY_APPARMOR=y 3. Build with: make LLVM=1 -j$(nproc) Build fails with: security/apparmor/notify.c:817:6: error: variable 'flags' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] With the fix applied, security/apparmor/notify.c compiles without error. [Fix] Initialize the variable to zero: `u16 flags = 0;` The NULL path is currently unreachable, so the choice of initial value does not affect runtime behavior. Zero-initialization silences the compiler diagnostic and is the standard practice for this class of warning. --- a/security/apparmor/notify.c +++ b/security/apparmor/notify.c @@ -812,7 +812,7 @@ static void knotif_update_from_uresp_perm(struct aa_knotif *knotif, struct apparmor_notif_resp_perm *uresp) { - u16 flags; + u16 flags = 0; if (uresp) { [Regression potential] Minimal. Zero-initialization of a local variable. The NULL path is currently unreachable (the sole call site passes &uresp->perm), so this change has no effect on runtime behavior. It only resolves the compiler diagnostic to enable LLVM/clang kernel builds. [Other info] - Source: linux_7.0.0-10.10 (Ubuntu Resolute 26.04) - Compiler: clang 21.1.8 (LLVM=1) - Architecture: x86_64 - security/apparmor/notify.c is Ubuntu out-of-tree code (not in mainline) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2148809/+subscriptions
Комментариев нет:
Отправить комментарий