On Sun, Nov 03, 2024 at 11:35:12AM -0800, Kumar Kartikeya Dwivedi wrote: > arch/x86/net/bpf_jit_comp.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c > index 06b080b61aa5..7e3bd589efc3 100644 > --- a/arch/x86/net/bpf_jit_comp.c > +++ b/arch/x86/net/bpf_jit_comp.c > @@ -1954,8 +1954,8 @@ st: if (is_imm8(insn->off)) > case BPF_LDX | BPF_PROBE_MEMSX | BPF_W: > insn_off = insn->off; > > - if (BPF_MODE(insn->code) == BPF_PROBE_MEM || > - BPF_MODE(insn->code) == BPF_PROBE_MEMSX) { > + if ((BPF_MODE(insn->code) == BPF_PROBE_MEM || > + BPF_MODE(insn->code) == BPF_PROBE_MEMSX) && !cpu_feature_enabled(X86_FEATURE_SMAP)) { > /* Conservatively check that src_reg + insn->off is a kernel address: > * src_reg + insn->off > TASK_SIZE_MAX + PAGE_SIZE > * and Well, I can see why you'd want to get rid of that, that's quite dreadful code you generate there. Can't you do something like: lea off(%src), %r10 mov %r10, %r11 inc %r10 sar $63, %r11 and %r11, %r10 dec %r10 mov (%r10), %rax I realize that's not exactly pretty either, but no jumps. Not sure this'll help much if anything with the TDX thing though.