All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: Fix another bpftool segfault without skeleton code enabled
@ 2020-07-08 11:08 louis.peens
  2020-07-08 14:44 ` Quentin Monnet
  2020-07-08 22:55 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: louis.peens @ 2020-07-08 11:08 UTC (permalink / raw)
  To: ast; +Cc: netdev, bpf, daniel, john.fastabend, oss-drivers, Louis Peens

From: Louis Peens <louis.peens@netronome.com>

emit_obj_refs_json needs to added the same as with emit_obj_refs_plain
to prevent segfaults, similar to Commit "8ae4121bd89e bpf: Fix bpftool
without skeleton code enabled"). See the error below:

    # ./bpftool -p prog
    {
        "error": "bpftool built without PID iterator support"
    },[{
            "id": 2,
            "type": "cgroup_skb",
            "tag": "7be49e3934a125ba",
            "gpl_compatible": true,
            "loaded_at": 1594052789,
            "uid": 0,
            "bytes_xlated": 296,
            "jited": true,
            "bytes_jited": 203,
            "bytes_memlock": 4096,
            "map_ids": [2,3
    Segmentation fault (core dumped)

The same happens for ./bpftool -p map, as well as ./bpftool -j prog/map.

Fixes: d53dee3fe013 ("tools/bpftool: Show info for processes holding BPF map/prog/link/btf FDs")
Signed-off-by: Louis Peens <louis.peens@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.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 7d5416667c85..c0d23ce4a6f4 100644
--- a/tools/bpf/bpftool/pids.c
+++ b/tools/bpf/bpftool/pids.c
@@ -20,6 +20,7 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
 }
 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) {}
+void emit_obj_refs_json(struct obj_refs_table *table, __u32 id, json_writer_t *json_writer) {}
 
 #else /* BPFTOOL_WITHOUT_SKELETONS */
 
-- 
2.17.1


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

* Re: [PATCH bpf-next] bpf: Fix another bpftool segfault without skeleton code enabled
  2020-07-08 11:08 [PATCH bpf-next] bpf: Fix another bpftool segfault without skeleton code enabled louis.peens
@ 2020-07-08 14:44 ` Quentin Monnet
  2020-07-08 22:55 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Quentin Monnet @ 2020-07-08 14:44 UTC (permalink / raw)
  To: louis.peens, ast; +Cc: netdev, bpf, daniel, john.fastabend, oss-drivers

2020-07-08 13:08 UTC+0200 ~ louis.peens@netronome.com
> From: Louis Peens <louis.peens@netronome.com>
> 
> emit_obj_refs_json needs to added the same as with emit_obj_refs_plain
> to prevent segfaults, similar to Commit "8ae4121bd89e bpf: Fix bpftool
> without skeleton code enabled"). See the error below:
> 
>     # ./bpftool -p prog
>     {
>         "error": "bpftool built without PID iterator support"
>     },[{
>             "id": 2,
>             "type": "cgroup_skb",
>             "tag": "7be49e3934a125ba",
>             "gpl_compatible": true,
>             "loaded_at": 1594052789,
>             "uid": 0,
>             "bytes_xlated": 296,
>             "jited": true,
>             "bytes_jited": 203,
>             "bytes_memlock": 4096,
>             "map_ids": [2,3
>     Segmentation fault (core dumped)
> 
> The same happens for ./bpftool -p map, as well as ./bpftool -j prog/map.
> 
> Fixes: d53dee3fe013 ("tools/bpftool: Show info for processes holding BPF map/prog/link/btf FDs")
> Signed-off-by: Louis Peens <louis.peens@netronome.com>
> Reviewed-by: Simon Horman <simon.horman@netronome.com>

Reviewed-by: Quentin Monnet <quentin@isovalent.com>

Thanks Louis.

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

* Re: [PATCH bpf-next] bpf: Fix another bpftool segfault without skeleton code enabled
  2020-07-08 11:08 [PATCH bpf-next] bpf: Fix another bpftool segfault without skeleton code enabled louis.peens
  2020-07-08 14:44 ` Quentin Monnet
@ 2020-07-08 22:55 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2020-07-08 22:55 UTC (permalink / raw)
  To: louis.peens, ast; +Cc: netdev, bpf, john.fastabend, oss-drivers

On 7/8/20 1:08 PM, louis.peens@netronome.com wrote:
> From: Louis Peens <louis.peens@netronome.com>
> 
> emit_obj_refs_json needs to added the same as with emit_obj_refs_plain
> to prevent segfaults, similar to Commit "8ae4121bd89e bpf: Fix bpftool
> without skeleton code enabled"). See the error below:
> 
>      # ./bpftool -p prog
>      {
>          "error": "bpftool built without PID iterator support"
>      },[{
>              "id": 2,
>              "type": "cgroup_skb",
>              "tag": "7be49e3934a125ba",
>              "gpl_compatible": true,
>              "loaded_at": 1594052789,
>              "uid": 0,
>              "bytes_xlated": 296,
>              "jited": true,
>              "bytes_jited": 203,
>              "bytes_memlock": 4096,
>              "map_ids": [2,3
>      Segmentation fault (core dumped)
> 
> The same happens for ./bpftool -p map, as well as ./bpftool -j prog/map.
> 
> Fixes: d53dee3fe013 ("tools/bpftool: Show info for processes holding BPF map/prog/link/btf FDs")
> Signed-off-by: Louis Peens <louis.peens@netronome.com>
> Reviewed-by: Simon Horman <simon.horman@netronome.com>

Applied, thanks!

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

end of thread, other threads:[~2020-07-08 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 11:08 [PATCH bpf-next] bpf: Fix another bpftool segfault without skeleton code enabled louis.peens
2020-07-08 14:44 ` Quentin Monnet
2020-07-08 22:55 ` Daniel Borkmann

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.