From: Alexei Starovoitov <ast@fb.com>
To: "David S . Miller" <davem@davemloft.net>
Cc: Daniel Borkmann <daniel@iogearbox.net>, <netdev@vger.kernel.org>
Subject: [PATCH net-next 2/2] samples/bpf: fix bpf loader
Date: Tue, 22 Nov 2016 16:52:09 -0800 [thread overview]
Message-ID: <1479862329-2361912-2-git-send-email-ast@fb.com> (raw)
In-Reply-To: <1479862329-2361912-1-git-send-email-ast@fb.com>
llvm can emit relocations into sections other than program code
(like debug info sections). Ignore them during parsing of elf file
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
samples/bpf/bpf_load.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
index 97913e109b14..62f54d6eb8bf 100644
--- a/samples/bpf/bpf_load.c
+++ b/samples/bpf/bpf_load.c
@@ -317,6 +317,10 @@ int load_bpf_file(char *path)
&shdr_prog, &data_prog))
continue;
+ if (shdr_prog.sh_type != SHT_PROGBITS ||
+ !(shdr_prog.sh_flags & SHF_EXECINSTR))
+ continue;
+
insns = (struct bpf_insn *) data_prog->d_buf;
processed_sec[shdr.sh_info] = true;
--
2.8.0
next prev parent reply other threads:[~2016-11-23 0:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 0:52 [PATCH net-next 1/2] samples/bpf: fix sockex2 example Alexei Starovoitov
2016-11-23 0:52 ` Alexei Starovoitov [this message]
2016-11-23 9:57 ` [PATCH net-next 2/2] samples/bpf: fix bpf loader Daniel Borkmann
2016-11-24 21:05 ` David Miller
2016-11-23 9:58 ` [PATCH net-next 1/2] samples/bpf: fix sockex2 example Daniel Borkmann
2016-11-24 21:05 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479862329-2361912-2-git-send-email-ast@fb.com \
--to=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.