netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bpf-next PATCH] bpf: fix bpftool without skeleton code enabled
@ 2020-07-02 17:25 John Fastabend
  2020-07-02 21:01 ` Yonghong Song
  2020-07-06 23:30 ` Andrii Nakryiko
  0 siblings, 2 replies; 3+ messages in thread
From: John Fastabend @ 2020-07-02 17:25 UTC (permalink / raw)
  To: andriin, ast, daniel; +Cc: netdev, bpf, john.fastabend

Fix segfault from bpftool by adding emit_obj_refs_plain when skeleton
code is disabled.

Tested by deleting BUILD_BPF_SKELS in Makefile.

# ./bpftool prog show
Error: bpftool built without PID iterator support
3: cgroup_skb  tag 7be49e3934a125ba  gpl
        loaded_at 2020-07-01T08:01:29-0700  uid 0
Segmentation fault

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 tools/bpf/bpftool/pids.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/bpf/bpftool/pids.c b/tools/bpf/bpftool/pids.c
index 2709be4de2b1..7d5416667c85 100644
--- a/tools/bpf/bpftool/pids.c
+++ b/tools/bpf/bpftool/pids.c
@@ -19,6 +19,7 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
 	return -ENOTSUP;
 }
 void delete_obj_refs_table(struct obj_refs_table *table) {}
+void emit_obj_refs_plain(struct obj_refs_table *table, __u32 id, const char *prefix) {}
 
 #else /* BPFTOOL_WITHOUT_SKELETONS */
 


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

* Re: [bpf-next PATCH] bpf: fix bpftool without skeleton code enabled
  2020-07-02 17:25 [bpf-next PATCH] bpf: fix bpftool without skeleton code enabled John Fastabend
@ 2020-07-02 21:01 ` Yonghong Song
  2020-07-06 23:30 ` Andrii Nakryiko
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2020-07-02 21:01 UTC (permalink / raw)
  To: John Fastabend, andriin, ast, daniel; +Cc: netdev, bpf



On 7/2/20 10:25 AM, John Fastabend wrote:
> Fix segfault from bpftool by adding emit_obj_refs_plain when skeleton
> code is disabled.
> 
> Tested by deleting BUILD_BPF_SKELS in Makefile.

You probably hit this issue with a different way, right?
Old clang, or anything? I would be good to clarify in
the commit message. People in general do not tweak Makefile
to find bugs, I guess.

> 
> # ./bpftool prog show
> Error: bpftool built without PID iterator support
> 3: cgroup_skb  tag 7be49e3934a125ba  gpl
>          loaded_at 2020-07-01T08:01:29-0700  uid 0
> Segmentation fault
> 
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>

Ack with request for better description in the commit message.

Acked-by: Yonghong Song <yhs@fb.com>

> ---
>   tools/bpf/bpftool/pids.c |    1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/bpf/bpftool/pids.c b/tools/bpf/bpftool/pids.c
> index 2709be4de2b1..7d5416667c85 100644
> --- a/tools/bpf/bpftool/pids.c
> +++ b/tools/bpf/bpftool/pids.c
> @@ -19,6 +19,7 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
>   	return -ENOTSUP;
>   }
>   void delete_obj_refs_table(struct obj_refs_table *table) {}
> +void emit_obj_refs_plain(struct obj_refs_table *table, __u32 id, const char *prefix) {}
>   
>   #else /* BPFTOOL_WITHOUT_SKELETONS */
>   
> 

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

* Re: [bpf-next PATCH] bpf: fix bpftool without skeleton code enabled
  2020-07-02 17:25 [bpf-next PATCH] bpf: fix bpftool without skeleton code enabled John Fastabend
  2020-07-02 21:01 ` Yonghong Song
@ 2020-07-06 23:30 ` Andrii Nakryiko
  1 sibling, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2020-07-06 23:30 UTC (permalink / raw)
  To: John Fastabend
  Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Networking, bpf

On Thu, Jul 2, 2020 at 10:25 AM John Fastabend <john.fastabend@gmail.com> wrote:
>
> Fix segfault from bpftool by adding emit_obj_refs_plain when skeleton
> code is disabled.
>
> Tested by deleting BUILD_BPF_SKELS in Makefile.
>
> # ./bpftool prog show
> Error: bpftool built without PID iterator support
> 3: cgroup_skb  tag 7be49e3934a125ba  gpl
>         loaded_at 2020-07-01T08:01:29-0700  uid 0
> Segmentation fault
>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> ---

My bad, thanks for the fix!

Acked-by: Andrii Nakryiko <andriin@fb.com>

>  tools/bpf/bpftool/pids.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/bpf/bpftool/pids.c b/tools/bpf/bpftool/pids.c
> index 2709be4de2b1..7d5416667c85 100644
> --- a/tools/bpf/bpftool/pids.c
> +++ b/tools/bpf/bpftool/pids.c
> @@ -19,6 +19,7 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
>         return -ENOTSUP;
>  }
>  void delete_obj_refs_table(struct obj_refs_table *table) {}
> +void emit_obj_refs_plain(struct obj_refs_table *table, __u32 id, const char *prefix) {}
>
>  #else /* BPFTOOL_WITHOUT_SKELETONS */
>
>

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

end of thread, other threads:[~2020-07-06 23:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 17:25 [bpf-next PATCH] bpf: fix bpftool without skeleton code enabled John Fastabend
2020-07-02 21:01 ` Yonghong Song
2020-07-06 23:30 ` Andrii Nakryiko

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).