Re: [PATCH v2 net] bpf: x86: fix epilogue generation for eBPF programs

From: Alexei Starovoitov
Date: Wed Dec 03 2014 - 10:51:30 EST

On Tue, Dec 2, 2014 at 10:38 PM, Z Lim <zlim.lnx@xxxxxxxxx> wrote:
> Hi Alexei,
> On Sat, Nov 29, 2014 at 2:46 PM, Alexei Starovoitov <ast@xxxxxxxxxxxx> wrote:
>> classic BPF has a restriction that last insn is always BPF_RET.
>> eBPF doesn't have BPF_RET instruction and this restriction.
>> It has BPF_EXIT insn which can appear anywhere in the program
>> one or more times and it doesn't have to be last insn.
> Just to confirm, in valid eBPF, BPF_EXIT *must* be present at least
> once, correct?
> Does an eBPF JIT implementation need to check for it?

yes. of course. At least one bpf_exit is always there
and there are no loops. verifier is checking for it.
So no need for jit to check it again.

> I'll cook up a patch for arm64 if you haven't already done so.
> Any related test case I should run through?

Pending socket samples are generating such code by llvm.
I was planning to add an explicit test to test_bpf, but feel free
to beat me to it.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at