Skip to contentSkip to conversation

build failure on x86 because commit 22e460b6333a

REGRESSION v6.6.128 Wentao Guan 2 participants 4 messages Mar 5

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Dear All,

upgrade to v6.6.128, build fail in x86 with our config with the commit:
git show 22e460b6333a5f818b042ac89201f8e735556f4a
commit 22e460b6333a5f818b042ac89201f8e735556f4a

Author: Harshit Mogalapalli <[email protected]>
Date:   Tue Dec 30 22:16:09 2025 -0800

x86/kexec: add a sanity check on previous kernel's ima kexec buffer

[ Upstream commit c5489d04337b47e93c0623e8145fcba3f5739efd ]

BRs
Wentao Guan

config:
https://gist.github.com/opsiff/4343c07b55697837f816c706309510c1

Log:
arch/x86/kernel/setup.c: In function ‘ima_get_kexec_buffer’:
arch/x86/kernel/setup.c:380:15: error: implicit declaration of function ‘ima_validate_range’ [-Werror=implicit-function-declaration]

  380 |         ret = ima_validate_range(ima_kexec_buffer_phys, ima_kexec_buffer_size);
      |               ^~~~~~~~~~~~~~~~~~

CC [M] fs/zonefs/file.o

#1 lore raw

[REGRESSION v6.12.75] build failure on x86 because commit f8f73bf0f8a57

Dear All,

I found v6.12.75 have same issue too, it can be reproduced on x86, with CONFIG_OF_FLATTREE not set(disbale CONFIG_OF).

The reason is miss the mainline commit 10d1c75ed438
("ima: verify the previous kernel's IMA buffer lies in addressable RAM")

BRs
Wentao Guan

Log:
arch/x86/kernel/setup.c: In function ‘ima_get_kexec_buffer’:
arch/x86/kernel/setup.c:380:15: error: implicit declaration of function ‘ima_validate_range’ [-Werror=implicit-function-declaration]

  380 |         ret = ima_validate_range(ima_kexec_buffer_phys, ima_kexec_buffer_size);
      |               ^~~~~~~~~~~~~~~~~~

config:
https://gist.github.com/opsiff/a139103d92b05504c05e42600958242d

commit:
git show f8f73bf0f8a57
commit f8f73bf0f8a57ee9b86792456bd42079bc98c6b7

Author: Harshit Mogalapalli <[email protected]>
Date:   Tue Dec 30 22:16:09 2025 -0800

x86/kexec: add a sanity check on previous kernel's ima kexec buffer

[ Upstream commit c5489d04337b47e93c0623e8145fcba3f5739efd ]

When the second-stage kernel is booted via kexec with a limiting command line such as "mem=<size>", the physical range that contains the carried over IMA measurement list may fall outside the truncated RAM leading to a kernel panic.

BUG: unable to handle page fault for address: ffff97793ff47000
RIP: ima_restore_measurement_list+0xdc/0x45a
#PF: error_code(0x0000) – not-present page

Other architectures already validate the range with page_is_ram(), as done in commit cbf9c4b9617b ("of: check previous kernel's ima-kexec-buffer against memory bounds") do a similar check on x86.

Without carrying the measurement list across kexec, the attestation would fail.

Fixes b69a2afd5afc ("x86/kexec: Carry forward IMA measurement log on kexec")
Cc Alexander Graf <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Baoquan He <[email protected]>
Cc Borislav Betkov <[email protected]>
Cc guoweikang <[email protected]>
Cc Henry Willard <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Bohac <[email protected]>
Cc Joel Granados <[email protected]>
Cc Jonathan McDowell <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Sohil Mehta <[email protected]>
Cc Sourabh Jain <[email protected]>
Cc Thomas Gleinxer <[email protected]>
Cc Yifei Liu <[email protected]>
arch/x86/kernel/setup.c +6 -0
index f1fea506e20f4..234c4d9e50b8f 100644
@@ -372,9 +372,15 @@ int __init ima_free_kexec_buffer(void)
 
 int __init ima_get_kexec_buffer(void **addr, size_t *size)
 {
+       int ret;
+
        if (!ima_kexec_buffer_size)
                return -ENOENT;
 
+       ret = ima_validate_range(ima_kexec_buffer_phys, ima_kexec_buffer_size);
+       if (ret)
+               return ret;
+
        *addr = __va(ima_kexec_buffer_phys);
        *size = ima_kexec_buffer_size;
#2 lore raw
In reply to Wentao Guan
Quoted 3 lines · Wentao Guan

Dear All,

upgrade to v6.6.128, build fail in x86 with our config with the commit:

kernel.org already offers 6.12.76 and 6.6.129, which from a quick look should fix this error (and the other one you reported which is basically the same problem afaics)

Quoted 21 lines

git show 22e460b6333a5f818b042ac89201f8e735556f4a
commit 22e460b6333a5f818b042ac89201f8e735556f4a

Author: Harshit Mogalapalli <[email protected]>
Date:   Tue Dec 30 22:16:09 2025 -0800

x86/kexec: add a sanity check on previous kernel's ima kexec buffer

[ Upstream commit c5489d04337b47e93c0623e8145fcba3f5739efd ]

BRs
Wentao Guan

config:
https://gist.github.com/opsiff/4343c07b55697837f816c706309510c1

Log:
arch/x86/kernel/setup.c: In function ‘ima_get_kexec_buffer’:
arch/x86/kernel/setup.c:380:15: error: implicit declaration of function ‘ima_validate_range’ [-Werror=implicit-function-declaration]

  380 |         ret = ima_validate_range(ima_kexec_buffer_phys, ima_kexec_buffer_size);
      |               ^~~~~~~~~~~~~~~~~~

CC [M] fs/zonefs/file.o

#3 lore raw

Thanks for your notice,
I tested the v6.6.129 and v6.12.76 with our config, the build problem has been solved.

BRs
Wentao Guan