bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] bpftool: Respect the -d option in struct_ops cmd
@ 2020-04-24 18:29 Martin KaFai Lau
  2020-04-24 19:01 ` Quentin Monnet
  0 siblings, 1 reply; 3+ messages in thread
From: Martin KaFai Lau @ 2020-04-24 18:29 UTC (permalink / raw)
  To: bpf; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team, netdev

In the prog cmd, the "-d" option turns on the verifier log.
This is missed in the "struct_ops" cmd and this patch fixes it.

Fixes: 65c93628599d ("bpftool: Add struct_ops support")
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
---
 tools/bpf/bpftool/struct_ops.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c
index 0fe0d584c57e..e17738479edc 100644
--- a/tools/bpf/bpftool/struct_ops.c
+++ b/tools/bpf/bpftool/struct_ops.c
@@ -479,6 +479,7 @@ static int do_unregister(int argc, char **argv)
 
 static int do_register(int argc, char **argv)
 {
+	struct bpf_object_load_attr load_attr = {};
 	const struct bpf_map_def *def;
 	struct bpf_map_info info = {};
 	__u32 info_len = sizeof(info);
@@ -499,7 +500,12 @@ static int do_register(int argc, char **argv)
 
 	set_max_rlimit();
 
-	if (bpf_object__load(obj)) {
+	load_attr.obj = obj;
+	if (verifier_logs)
+		/* log_level1 + log_level2 + stats, but not stable UAPI */
+		load_attr.log_level = 1 + 2 + 4;
+
+	if (bpf_object__load_xattr(&load_attr)) {
 		bpf_object__close(obj);
 		return -1;
 	}
-- 
2.24.1


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

* Re: [PATCH bpf] bpftool: Respect the -d option in struct_ops cmd
  2020-04-24 18:29 [PATCH bpf] bpftool: Respect the -d option in struct_ops cmd Martin KaFai Lau
@ 2020-04-24 19:01 ` Quentin Monnet
  2020-04-25  0:41   ` Alexei Starovoitov
  0 siblings, 1 reply; 3+ messages in thread
From: Quentin Monnet @ 2020-04-24 19:01 UTC (permalink / raw)
  To: Martin KaFai Lau, bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team, netdev

2020-04-24 11:29 UTC-0700 ~ Martin KaFai Lau <kafai@fb.com>
> In the prog cmd, the "-d" option turns on the verifier log.
> This is missed in the "struct_ops" cmd and this patch fixes it.
> 
> Fixes: 65c93628599d ("bpftool: Add struct_ops support")
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>

Looks good to me, thanks!
Reviewed-by: Quentin Monnet <quentin@isovalent.com>

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

* Re: [PATCH bpf] bpftool: Respect the -d option in struct_ops cmd
  2020-04-24 19:01 ` Quentin Monnet
@ 2020-04-25  0:41   ` Alexei Starovoitov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-04-25  0:41 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Martin KaFai Lau, bpf, Alexei Starovoitov, Daniel Borkmann,
	Kernel Team, Network Development

On Fri, Apr 24, 2020 at 12:01 PM Quentin Monnet <quentin@isovalent.com> wrote:
>
> 2020-04-24 11:29 UTC-0700 ~ Martin KaFai Lau <kafai@fb.com>
> > In the prog cmd, the "-d" option turns on the verifier log.
> > This is missed in the "struct_ops" cmd and this patch fixes it.
> >
> > Fixes: 65c93628599d ("bpftool: Add struct_ops support")
> > Signed-off-by: Martin KaFai Lau <kafai@fb.com>
>
> Looks good to me, thanks!
> Reviewed-by: Quentin Monnet <quentin@isovalent.com>

Applied. Thanks

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

end of thread, other threads:[~2020-04-25  0:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 18:29 [PATCH bpf] bpftool: Respect the -d option in struct_ops cmd Martin KaFai Lau
2020-04-24 19:01 ` Quentin Monnet
2020-04-25  0:41   ` Alexei Starovoitov

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