Re: [PATCH bpf-next v3 04/10] bpf, x86: add helper to emit kasan checks in x86 JITed programs
From: Alexis Lothoré
Date: Tue Jul 07 2026 - 10:17:48 EST
On Wed Jul 1, 2026 at 12:44 PM CEST, bot+bpf-ci wrote:
>> diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
>> index 054e043ffcd2..68c5f9f94e5e 100644
>> --- a/arch/x86/net/bpf_jit_comp.c
>> +++ b/arch/x86/net/bpf_jit_comp.c
>
> [ ... ]
>
>> @@ -1110,6 +1121,90 @@ static void maybe_emit_1mod(u8 **pprog, u32 reg, bool is64)
>
> [ ... ]
>
>> + /* Save rax */
>> + EMIT1(0x50);
>> + /* Save rcx */
>> + EMIT1(0x51);
>> + /* Save rdx */
>> + EMIT1(0x52);
>> + /* Save rsi */
>> + EMIT1(0x56);
>> + /* Save rdi */
>> + EMIT1(0x57);
>> + /* Save r8 */
>> + EMIT2(0x41, 0x50);
>> + /* Save r9 */
>> + EMIT2(0x41, 0x51);
>
> [ ... ]
>
>> + EMIT2(0x41, 0x59);
>> + EMIT2(0x41, 0x58);
>> + EMIT1(0x5F);
>> + EMIT1(0x5E);
>> + EMIT1(0x5A);
>> + EMIT1(0x59);
>> + EMIT1(0x58);
>
> This isn't a bug, but the save block annotates each push with its target
> register (/* Save rax */, /* Save rcx */, ... /* Save r9 */), while the
> matching restore block emits the seven pops with no comments at all.
> Would adding the mirrored comments here (/* Restore r9 */, /* Restore r8 */,
> ... /* Restore rax */) make the push/pop symmetry easier to check at a
> glance?
I am not convinced this brings much value, aside from adding more noise
around the code.
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com