Commit db6a71dd authored by Alexei Starovoitov's avatar Alexei Starovoitov Committed by David S. Miller

samples/bpf: fix bpf loader

llvm can emit relocations into sections other than program code
(like debug info sections). Ignore them during parsing of elf file
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d2b024d3
...@@ -317,6 +317,10 @@ int load_bpf_file(char *path) ...@@ -317,6 +317,10 @@ int load_bpf_file(char *path)
&shdr_prog, &data_prog)) &shdr_prog, &data_prog))
continue; continue;
if (shdr_prog.sh_type != SHT_PROGBITS ||
!(shdr_prog.sh_flags & SHF_EXECINSTR))
continue;
insns = (struct bpf_insn *) data_prog->d_buf; insns = (struct bpf_insn *) data_prog->d_buf;
processed_sec[shdr.sh_info] = true; processed_sec[shdr.sh_info] = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment