netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] bpf: indicate lderr when bpf_apply_relo_data fails
@ 2017-06-27  0:48 Daniel Borkmann
  2017-06-27 23:09 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Borkmann @ 2017-06-27  0:48 UTC (permalink / raw)
  To: netdev; +Cc: Daniel Borkmann

When LLVM wrongly generates a rodata relo entry (llvm BZ #33599),
then just bail out instead of probing for prog w/o reloc, which
will fail in this case anyway.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
 lib/bpf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/bpf.c b/lib/bpf.c
index ae4d97d..6b5a96d 100644
--- a/lib/bpf.c
+++ b/lib/bpf.c
@@ -1795,8 +1795,10 @@ static int bpf_fetch_prog_relo(struct bpf_elf_ctx *ctx, const char *section,
 		*sseen = true;
 
 		ret = bpf_apply_relo_data(ctx, &data_relo, &data_insn);
-		if (ret < 0)
+		if (ret < 0) {
+			*lderr = true;
 			return ret;
+		}
 
 		memset(&prog, 0, sizeof(prog));
 		prog.type    = ctx->type;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2] bpf: indicate lderr when bpf_apply_relo_data fails
  2017-06-27  0:48 [PATCH iproute2] bpf: indicate lderr when bpf_apply_relo_data fails Daniel Borkmann
@ 2017-06-27 23:09 ` Stephen Hemminger
  2017-06-27 23:14   ` Daniel Borkmann
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2017-06-27 23:09 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: netdev

On Tue, 27 Jun 2017 02:48:36 +0200
Daniel Borkmann <daniel@iogearbox.net> wrote:

> When LLVM wrongly generates a rodata relo entry (llvm BZ #33599),
> then just bail out instead of probing for prog w/o reloc, which
> will fail in this case anyway.
> 
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

Applied, but don't you want a reasonable error message.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2] bpf: indicate lderr when bpf_apply_relo_data fails
  2017-06-27 23:09 ` Stephen Hemminger
@ 2017-06-27 23:14   ` Daniel Borkmann
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2017-06-27 23:14 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

On 06/28/2017 01:09 AM, Stephen Hemminger wrote:
> On Tue, 27 Jun 2017 02:48:36 +0200
> Daniel Borkmann <daniel@iogearbox.net> wrote:
>
>> When LLVM wrongly generates a rodata relo entry (llvm BZ #33599),
>> then just bail out instead of probing for prog w/o reloc, which
>> will fail in this case anyway.
>>
>> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
>
> Applied, but don't you want a reasonable error message.

Thanks, the error message in this case throws:

ELF contains non-map related relo data in entry <X> pointing to section <Y>! Compiler bug?!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-27 23:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-27  0:48 [PATCH iproute2] bpf: indicate lderr when bpf_apply_relo_data fails Daniel Borkmann
2017-06-27 23:09 ` Stephen Hemminger
2017-06-27 23:14   ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).