bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf 0/2] tools: bpftool: fix pinning error messages
@ 2019-08-07  0:19 Jakub Kicinski
  2019-08-07  0:19 ` [PATCH bpf 1/2] tools: bpftool: fix error message (prog -> object) Jakub Kicinski
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jakub Kicinski @ 2019-08-07  0:19 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, bpf, oss-drivers, Jakub Kicinski

Hi!

First make sure we don't use "prog" in error messages because
the pinning operation could be performed on a map. Second add
back missing error message if pin syscall failed.

Jakub Kicinski (2):
  tools: bpftool: fix error message (prog -> object)
  tools: bpftool: add error message on pin failure

 tools/bpf/bpftool/common.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
2.21.0


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

* [PATCH bpf 1/2] tools: bpftool: fix error message (prog -> object)
  2019-08-07  0:19 [PATCH bpf 0/2] tools: bpftool: fix pinning error messages Jakub Kicinski
@ 2019-08-07  0:19 ` Jakub Kicinski
  2019-08-07  0:19 ` [PATCH bpf 2/2] tools: bpftool: add error message on pin failure Jakub Kicinski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2019-08-07  0:19 UTC (permalink / raw)
  To: alexei.starovoitov, daniel
  Cc: netdev, bpf, oss-drivers, Jakub Kicinski, Quentin Monnet

Change an error message to work for any object being
pinned not just programs.

Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
 tools/bpf/bpftool/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
index 5215e0870bcb..c52a6ffb8949 100644
--- a/tools/bpf/bpftool/common.c
+++ b/tools/bpf/bpftool/common.c
@@ -237,7 +237,7 @@ int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))
 
 	fd = get_fd_by_id(id);
 	if (fd < 0) {
-		p_err("can't get prog by id (%u): %s", id, strerror(errno));
+		p_err("can't open object by id (%u): %s", id, strerror(errno));
 		return -1;
 	}
 
-- 
2.21.0


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

* [PATCH bpf 2/2] tools: bpftool: add error message on pin failure
  2019-08-07  0:19 [PATCH bpf 0/2] tools: bpftool: fix pinning error messages Jakub Kicinski
  2019-08-07  0:19 ` [PATCH bpf 1/2] tools: bpftool: fix error message (prog -> object) Jakub Kicinski
@ 2019-08-07  0:19 ` Jakub Kicinski
  2019-08-08 18:54   ` Andrii Nakryiko
  2019-08-07  6:15 ` [PATCH bpf 0/2] tools: bpftool: fix pinning error messages Y Song
  2019-08-09 15:43 ` Daniel Borkmann
  3 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2019-08-07  0:19 UTC (permalink / raw)
  To: alexei.starovoitov, daniel
  Cc: netdev, bpf, oss-drivers, Jakub Kicinski, Andy Lutomirski,
	Quentin Monnet

No error message is currently printed if the pin syscall
itself fails. It got lost in the loadall refactoring.

Fixes: 77380998d91d ("bpftool: add loadall command")
Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
CC: luto@kernel.org, sdf@google.com

 tools/bpf/bpftool/common.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
index c52a6ffb8949..6a71324be628 100644
--- a/tools/bpf/bpftool/common.c
+++ b/tools/bpf/bpftool/common.c
@@ -204,7 +204,11 @@ int do_pin_fd(int fd, const char *name)
 	if (err)
 		return err;
 
-	return bpf_obj_pin(fd, name);
+	err = bpf_obj_pin(fd, name);
+	if (err)
+		p_err("can't pin the object (%s): %s", name, strerror(errno));
+
+	return err;
 }
 
 int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))
-- 
2.21.0


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

* Re: [PATCH bpf 0/2] tools: bpftool: fix pinning error messages
  2019-08-07  0:19 [PATCH bpf 0/2] tools: bpftool: fix pinning error messages Jakub Kicinski
  2019-08-07  0:19 ` [PATCH bpf 1/2] tools: bpftool: fix error message (prog -> object) Jakub Kicinski
  2019-08-07  0:19 ` [PATCH bpf 2/2] tools: bpftool: add error message on pin failure Jakub Kicinski
@ 2019-08-07  6:15 ` Y Song
  2019-08-09 15:43 ` Daniel Borkmann
  3 siblings, 0 replies; 6+ messages in thread
From: Y Song @ 2019-08-07  6:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Alexei Starovoitov, Daniel Borkmann, netdev, bpf, oss-drivers

On Tue, Aug 6, 2019 at 5:20 PM Jakub Kicinski
<jakub.kicinski@netronome.com> wrote:
>
> Hi!
>
> First make sure we don't use "prog" in error messages because
> the pinning operation could be performed on a map. Second add
> back missing error message if pin syscall failed.
>
> Jakub Kicinski (2):
>   tools: bpftool: fix error message (prog -> object)
>   tools: bpftool: add error message on pin failure

Looks good to me. Ack the whole series.
Acked-by: Yonghong Song <yhs@fb.com>

>
>  tools/bpf/bpftool/common.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> --
> 2.21.0
>

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

* Re: [PATCH bpf 2/2] tools: bpftool: add error message on pin failure
  2019-08-07  0:19 ` [PATCH bpf 2/2] tools: bpftool: add error message on pin failure Jakub Kicinski
@ 2019-08-08 18:54   ` Andrii Nakryiko
  0 siblings, 0 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2019-08-08 18:54 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Alexei Starovoitov, Daniel Borkmann, Networking, bpf,
	oss-drivers, Andy Lutomirski, Quentin Monnet

On Tue, Aug 6, 2019 at 5:21 PM Jakub Kicinski
<jakub.kicinski@netronome.com> wrote:
>
> No error message is currently printed if the pin syscall
> itself fails. It got lost in the loadall refactoring.
>
> Fixes: 77380998d91d ("bpftool: add loadall command")
> Reported-by: Andy Lutomirski <luto@kernel.org>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
> ---

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

> CC: luto@kernel.org, sdf@google.com
>
>  tools/bpf/bpftool/common.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
> index c52a6ffb8949..6a71324be628 100644
> --- a/tools/bpf/bpftool/common.c
> +++ b/tools/bpf/bpftool/common.c
> @@ -204,7 +204,11 @@ int do_pin_fd(int fd, const char *name)
>         if (err)
>                 return err;
>
> -       return bpf_obj_pin(fd, name);
> +       err = bpf_obj_pin(fd, name);
> +       if (err)
> +               p_err("can't pin the object (%s): %s", name, strerror(errno));
> +
> +       return err;
>  }
>
>  int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))
> --
> 2.21.0
>

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

* Re: [PATCH bpf 0/2] tools: bpftool: fix pinning error messages
  2019-08-07  0:19 [PATCH bpf 0/2] tools: bpftool: fix pinning error messages Jakub Kicinski
                   ` (2 preceding siblings ...)
  2019-08-07  6:15 ` [PATCH bpf 0/2] tools: bpftool: fix pinning error messages Y Song
@ 2019-08-09 15:43 ` Daniel Borkmann
  3 siblings, 0 replies; 6+ messages in thread
From: Daniel Borkmann @ 2019-08-09 15:43 UTC (permalink / raw)
  To: Jakub Kicinski, alexei.starovoitov; +Cc: netdev, bpf, oss-drivers

On 8/7/19 2:19 AM, Jakub Kicinski wrote:
> Hi!
> 
> First make sure we don't use "prog" in error messages because
> the pinning operation could be performed on a map. Second add
> back missing error message if pin syscall failed.
> 
> Jakub Kicinski (2):
>    tools: bpftool: fix error message (prog -> object)
>    tools: bpftool: add error message on pin failure
> 
>   tools/bpf/bpftool/common.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 

Applied, thanks!

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

end of thread, other threads:[~2019-08-09 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07  0:19 [PATCH bpf 0/2] tools: bpftool: fix pinning error messages Jakub Kicinski
2019-08-07  0:19 ` [PATCH bpf 1/2] tools: bpftool: fix error message (prog -> object) Jakub Kicinski
2019-08-07  0:19 ` [PATCH bpf 2/2] tools: bpftool: add error message on pin failure Jakub Kicinski
2019-08-08 18:54   ` Andrii Nakryiko
2019-08-07  6:15 ` [PATCH bpf 0/2] tools: bpftool: fix pinning error messages Y Song
2019-08-09 15:43 ` 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).