diff options
author | Quentin Monnet <quentin.monnet@netronome.com> | 2018-01-16 15:51:50 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-01-17 01:15:06 +0100 |
commit | 74801e50d5b89329e6c02b8bd924a41234f76316 (patch) | |
tree | effbbab7241a7b203f123449f858517ba09bdb22 /drivers/net/ethernet/netronome/nfp/bpf/jit.c | |
parent | 7dfa4d87cfc48f3d4171f4a1b886bbbe4faf5c07 (diff) | |
download | linux-stable-74801e50d5b89329e6c02b8bd924a41234f76316.tar.gz linux-stable-74801e50d5b89329e6c02b8bd924a41234f76316.tar.bz2 linux-stable-74801e50d5b89329e6c02b8bd924a41234f76316.zip |
nfp: bpf: reject program on instructions unknown to the JIT compiler
If an eBPF instruction is unknown to the driver JIT compiler, we can
reject the program at verification time.
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/bpf/jit.c')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/bpf/jit.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c index cdc949fabe98..56451edf01c2 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c +++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c @@ -2907,6 +2907,11 @@ void nfp_bpf_jit_prepare(struct nfp_prog *nfp_prog, unsigned int cnt) } } +bool nfp_bpf_supported_opcode(u8 code) +{ + return !!instr_cb[code]; +} + void *nfp_bpf_relo_for_vnic(struct nfp_prog *nfp_prog, struct nfp_bpf_vnic *bv) { unsigned int i; |