Re: [PATCH] uprobes/x86: Emulate ENDBR as a NOP

From: bot+bpf-ci

Date: Thu Nov 12 2026 - 23:04:51 EST


> uprobes/x86: Emulate ENDBR as a NOP

TL;DR: Design question: Peter Zijlstra objected on v1 that probing ENDBR would
cause #CP on indirect calls if userspace IBT arrives; the author agreed to
drop it, yet the patch still emulates ENDBR as a NOP.

> diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
> --- a/arch/x86/kernel/uprobes.c
> +++ b/arch/x86/kernel/uprobes.c

[ ... ]

> +/*
> + * ENDBR64/ENDBR32 (f3 0f 1e fa/fb). Userspace IBT is not supported, so
> + * in a user task they are NOPs, and they start most functions in
> + * binaries built with -fcf-protection. Revisit if userspace IBT is
> + * ever enabled.
> + */
> +static bool insn_is_endbr(struct insn *insn)
> +{
> + return insn->length == 4 &&
> + insn->prefixes.nbytes == 1 && insn->prefixes.bytes[0] == 0xf3 &&
> + insn->opcode.nbytes == 2 && insn->opcode.bytes[0] == 0x0f &&
> + insn->opcode.bytes[1] == 0x1e &&
> + (insn->modrm.bytes[0] & ~1) == 0xfa;
> +}
> +
> /* Returns -ENOSYS if branch_xol_ops doesn't handle this insn */
> static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
> {
> u8 opc1 = OPCODE1(insn);
> insn_byte_t p;
>
> - if (insn_is_nop(insn))
> + if (insn_is_nop(insn) || insn_is_endbr(insn))
> goto setup;

Peter Zijlstra objected to this approach on the v1 thread:

Uh, no. We must not allow uprobe on ENDBR. If we ever get userspace
IBT (people are actually looking at that), then putting a probe on it
will make indirect function calls #CP.

Has that objection been addressed? The thread indicates the author agreed
and planned to drop the patch, yet this commit still emulates ENDBR as a
NOP in branch_setup_xol_ops().

Link: https://lore.kernel.org/all/20261112080406.GA2668804@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/43353937212