Compare
fcbc48dc650d2f58bfe19c4486830de0e9cad62e..41d1119e2f8577b4bd01d31321c6761af9140ce7
x86/kcfi: Emit the FineIBT paranoid "cs" prefix as a byte
The "cs" prefix on the LEA in the FineIBT paranoid caller template is padding: it places the LEA's 0xf0 immediate byte where it doubles as the LOCK prefix that makes the failing Jcc raise #UD. GNU as warns about it in every CONFIG_FINEIBT=y build: Warning: segment override on `lea' is ineffectual Clang's integrated assembler does not warn, and both assemble the same bytes. Emit the prefix with ".byte 0x2e" to silence GNU as. Build tested ARCH=x86_64 defconfig with CONFIG_CFI=y, with GCC 17.0.0 (experimental, with the kCFI series) and GNU as 2.47, and with Clang 24.0.0git: GNU as no longer warns, and the template assembles to the same bytes as before with both. Under QEMU with cfi=fineibt,paranoid, the paranoid caller check catches LKDTM's CFI_FORWARD_PROTO with both. Assisted-by: LLM Signed-off-by: Kees Cook <kees@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20261012090436.1676525-2-kees@kernel.org
Kees Cook <kees@kernel.org> · 2026-10-12 09:04 UTC · committed by Peter Zijlstra
2 files changed,
+3
−2
modified arch/x86/kernel/alternative.c
| @@ -1455,7 +1455,8 @@ asm( ".pushsection .rodata \n" | |||
| 1455 | 1455 | "fineibt_paranoid_start: \n" | |
| 1456 | 1456 | " mov $0x12345678, %eax \n" | |
| 1457 | 1457 | " cmpl -11(%r11), %eax \n" | |
| 1458 | - | " cs lea -0x10(%r11), %r11 \n" | |
| 1458 | + | " .byte 0x2e \n" | |
| 1459 | + | " lea -0x10(%r11), %r11 \n" | |
| 1459 | 1460 | "#fineibt_caller_size: \n" | |
| 1460 | 1461 | " jne fineibt_paranoid_start+0xd \n" | |
| 1461 | 1462 | "fineibt_paranoid_ind: \n" | |
modified drivers/gpio/gpio-nct6694.c
| @@ -444,7 +444,7 @@ static int nct6694_gpio_probe(struct platform_device *pdev) | |||
| 444 | 444 | data->gpio.set_config = nct6694_set_config; | |
| 445 | 445 | data->gpio.init_valid_mask = nct6694_init_valid_mask; | |
| 446 | 446 | data->gpio.base = -1; | |
| 447 | - | data->gpio.can_sleep = true; | |
| 447 | + | data->gpio.can_sleep = false; | |
| 448 | 448 | data->gpio.owner = THIS_MODULE; | |
| 449 | 449 | data->gpio.ngpio = NCT6694_NR_GPIO; | |
| 450 | 450 | ||