Skip to content

Commit

Permalink
bpf: improve error message for unsupported helper
Browse files Browse the repository at this point in the history
BPF verifier emits "unknown func" message when given BPF program type
does not support BPF helper. This message may be confusing for users, as
important context that helper is unknown only to current program type is
not provided.

This patch changes message to "program of this type cannot use helper "
and aligns dependent code in libbpf and tests. Any suggestions on
improving/changing this message are welcome.

Signed-off-by: Mykyta Yatsenko <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Acked-by: Quentin Monnet <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
  • Loading branch information
mykyta5 authored and qmonnet committed Apr 2, 2024
1 parent 91360ab commit 9a40292
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/feature.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,8 @@ probe_helper_ifindex(enum bpf_func_id id, enum bpf_prog_type prog_type,

probe_prog_load_ifindex(prog_type, insns, ARRAY_SIZE(insns), buf,
sizeof(buf), ifindex);
res = !grep(buf, "invalid func ") && !grep(buf, "unknown func ");
res = !grep(buf, "invalid func ") && !grep(buf, "unknown func ") &&
!grep(buf, "program of this type cannot use helper ");

switch (get_vendor_id(ifindex)) {
case 0x19ee: /* Netronome specific */
Expand Down

0 comments on commit 9a40292

Please sign in to comment.