OSDN Git Service

[bpf] error when unknown bpf helper is called
authorAlexei Starovoitov <alexei.starovoitov@gmail.com>
Tue, 17 Jan 2017 07:26:17 +0000 (07:26 +0000)
committerAlexei Starovoitov <alexei.starovoitov@gmail.com>
Tue, 17 Jan 2017 07:26:17 +0000 (07:26 +0000)
commite4bed26281965a0dd6634231a4a77507cc4e8113
tree5ac4431f251dcd15597511637250362f64b98380
parent54d04300edb5f7308aadfbc12d9b1b8bad672ae6
[bpf] error when unknown bpf helper is called

Emit error when BPF backend sees a call to a global function or to an external symbol.
The kernel verifier only allows calls to predefined helpers from bpf.h
which are defined in 'enum bpf_func_id'. Such calls in assembler must
look like 'call [1-9]+' where number matches bpf_func_id.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292204 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
lib/Target/BPF/BPFISelLowering.cpp
lib/Target/BPF/BPFInstrInfo.td
lib/Target/BPF/BPFMCInstLower.cpp
lib/Target/BPF/BPFMCInstLower.h
test/CodeGen/BPF/cc_args.ll
test/CodeGen/BPF/cc_args_be.ll
test/CodeGen/BPF/cc_ret.ll
test/CodeGen/BPF/fi_ri.ll
test/CodeGen/BPF/intrinsics.ll
test/CodeGen/BPF/objdump_intrinsics.ll
test/CodeGen/BPF/objdump_trivial.ll
test/CodeGen/BPF/sanity.ll
test/CodeGen/BPF/undef.ll
test/CodeGen/BPF/warn-call.ll [new file with mode: 0644]