diff options
author | Alexei Starovoitov <ast@plumgrid.com> | 2014-11-29 23:46:13 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-06 06:23:54 +0100 |
commit | 769e0de6475e5512f88bfb4dbf6d6323fd23514f (patch) | |
tree | d6a8648b1dcc509a47e47f995159f70bcb0572c6 /drivers/net | |
parent | gre: Set inner mac header in gro complete (diff) | |
download | linux-769e0de6475e5512f88bfb4dbf6d6323fd23514f.tar.xz linux-769e0de6475e5512f88bfb4dbf6d6323fd23514f.zip |
bpf: x86: fix epilogue generation for eBPF programs
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.
Fix eBPF JIT to emit epilogue when first BPF_EXIT is seen
and all other BPF_EXIT instructions will be emitted as jump.
Since jump offset to epilogue is computed as:
jmp_offset = ctx->cleanup_addr - addrs[i]
we need to change type of cleanup_addr to signed to compute the offset as:
(long long) ((int)20 - (int)30)
instead of:
(long long) ((unsigned int)20 - (int)30)
Fixes: 622582786c9e ("net: filter: x86: internal BPF JIT")
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
0 files changed, 0 insertions, 0 deletions