All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] tools/bpftool: ignore build products
@ 2018-07-19 12:10 Taeung Song
  2018-07-19 12:10 ` [PATCH v3 2/2] tools/bpftool: Fix segfault case regarding 'pin' arguments Taeung Song
  2018-07-19 18:23 ` [PATCH v3 1/2] tools/bpftool: ignore build products Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: Taeung Song @ 2018-07-19 12:10 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann; +Cc: netdev, linux-kernel

For untracked things of tools/bpf, add this.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/bpf/.gitignore         | 5 +++++
 tools/bpf/bpftool/.gitignore | 1 +
 2 files changed, 6 insertions(+)
 create mode 100644 tools/bpf/.gitignore

diff --git a/tools/bpf/.gitignore b/tools/bpf/.gitignore
new file mode 100644
index 000000000000..dfe2bd5a4b95
--- /dev/null
+++ b/tools/bpf/.gitignore
@@ -0,0 +1,5 @@
+FEATURE-DUMP.bpf
+bpf_asm
+bpf_dbg
+bpf_exp.yacc.*
+bpf_jit_disasm
diff --git a/tools/bpf/bpftool/.gitignore b/tools/bpf/bpftool/.gitignore
index d7e678c2d396..103cc5b5b446 100644
--- a/tools/bpf/bpftool/.gitignore
+++ b/tools/bpf/bpftool/.gitignore
@@ -1,3 +1,4 @@
 *.d
 bpftool
+bpftool*.8
 FEATURE-DUMP.bpftool
-- 
2.17.1


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

* [PATCH v3 2/2] tools/bpftool: Fix segfault case regarding 'pin' arguments
  2018-07-19 12:10 [PATCH v3 1/2] tools/bpftool: ignore build products Taeung Song
@ 2018-07-19 12:10 ` Taeung Song
  2018-07-19 18:23 ` [PATCH v3 1/2] tools/bpftool: ignore build products Jakub Kicinski
  1 sibling, 0 replies; 5+ messages in thread
From: Taeung Song @ 2018-07-19 12:10 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann; +Cc: netdev, linux-kernel

Arguments of 'pin' subcommand should be checked
at the very beginning of do_pin_any().
Otherwise segfault errors can occur when using
'map pin' or 'prog pin' commands, so fix it.

  # bpftool prog pin id
  Segmentation fault

Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reported-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/bpf/bpftool/common.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
index 32f9e397a6c0..3f140eff039f 100644
--- a/tools/bpf/bpftool/common.c
+++ b/tools/bpf/bpftool/common.c
@@ -217,6 +217,14 @@ int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))
 	int err;
 	int fd;
 
+	if (argc < 3) {
+		p_err("too few arguments, id ID and FILE path is required");
+		return -1;
+	} else if (argc > 3) {
+		p_err("too many arguments");
+		return -1;
+	}
+
 	if (!is_prefix(*argv, "id")) {
 		p_err("expected 'id' got %s", *argv);
 		return -1;
@@ -230,9 +238,6 @@ int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))
 	}
 	NEXT_ARG();
 
-	if (argc != 1)
-		usage();
-
 	fd = get_fd_by_id(id);
 	if (fd < 0) {
 		p_err("can't get prog by id (%u): %s", id, strerror(errno));
-- 
2.17.1


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

* Re: [PATCH v3 1/2] tools/bpftool: ignore build products
  2018-07-19 12:10 [PATCH v3 1/2] tools/bpftool: ignore build products Taeung Song
  2018-07-19 12:10 ` [PATCH v3 2/2] tools/bpftool: Fix segfault case regarding 'pin' arguments Taeung Song
@ 2018-07-19 18:23 ` Jakub Kicinski
  2018-07-20  8:23   ` Daniel Borkmann
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2018-07-19 18:23 UTC (permalink / raw)
  To: Taeung Song; +Cc: Alexei Starovoitov, Daniel Borkmann, netdev, linux-kernel

On Thu, 19 Jul 2018 21:10:04 +0900, Taeung Song wrote:
> For untracked things of tools/bpf, add this.
> 
> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
> ---
>  tools/bpf/.gitignore         | 5 +++++
>  tools/bpf/bpftool/.gitignore | 1 +
>  2 files changed, 6 insertions(+)
>  create mode 100644 tools/bpf/.gitignore
> 
> diff --git a/tools/bpf/.gitignore b/tools/bpf/.gitignore
> new file mode 100644
> index 000000000000..dfe2bd5a4b95
> --- /dev/null
> +++ b/tools/bpf/.gitignore
> @@ -0,0 +1,5 @@
> +FEATURE-DUMP.bpf
> +bpf_asm
> +bpf_dbg
> +bpf_exp.yacc.*
> +bpf_jit_disasm
> diff --git a/tools/bpf/bpftool/.gitignore b/tools/bpf/bpftool/.gitignore
> index d7e678c2d396..103cc5b5b446 100644
> --- a/tools/bpf/bpftool/.gitignore
> +++ b/tools/bpf/bpftool/.gitignore
> @@ -1,3 +1,4 @@
>  *.d
>  bpftool
> +bpftool*.8
>  FEATURE-DUMP.bpftool

This patch is going to be merged to the bpf-next tree, I presume, and
there is more man pages there:

$ make -C tools/bpf/bpftool/ doc 
make: Entering directory 'linux/tools/bpf/bpftool'
  DESCEND  Documentation
make[1]: Entering directory '/linux/tools/bpf/bpftool/Documentation'
  GEN      bpftool-perf.8
  GEN      bpftool-map.8
  GEN      bpftool.8
  GEN      bpftool-prog.8
  GEN      bpftool-cgroup.8
  GEN      bpf-helpers.rst
Parsed description of 80 helper function(s)
  GEN      bpf-helpers.7
make[1]: Leaving directory 'linux/tools/bpf/bpftool/Documentation'
make: Leaving directory 'linux/tools/bpf/bpftool'
$ git status 
On branch work
Your branch is ahead of 'pending' by 10 commits.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	tools/bpf/bpftool/Documentation/bpf-helpers.7
	tools/bpf/bpftool/Documentation/bpf-helpers.rst
	tools/bpf/bpftool/Documentation/bpftool-cgroup.8
	tools/bpf/bpftool/Documentation/bpftool-map.8
	tools/bpf/bpftool/Documentation/bpftool-perf.8
	tools/bpf/bpftool/Documentation/bpftool-prog.8
	tools/bpf/bpftool/Documentation/bpftool.8

nothing added to commit but untracked files present (use "git add" to track)


See the bpf-helpers.* files?  Those are all auto-generated.

If you respin for -next please split the series and put [PATCH bpf-next
v4] as prefix of first patch, and [PATCH bpf v4] as prefix for the
second, as one of them is an improvement, and second a bug fix.

Thank you!!

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

* Re: [PATCH v3 1/2] tools/bpftool: ignore build products
  2018-07-19 18:23 ` [PATCH v3 1/2] tools/bpftool: ignore build products Jakub Kicinski
@ 2018-07-20  8:23   ` Daniel Borkmann
  2018-07-20  9:54     ` Taeung Song
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2018-07-20  8:23 UTC (permalink / raw)
  To: Jakub Kicinski, Taeung Song; +Cc: Alexei Starovoitov, netdev, linux-kernel

On 07/19/2018 08:23 PM, Jakub Kicinski wrote:
> On Thu, 19 Jul 2018 21:10:04 +0900, Taeung Song wrote:
>> For untracked things of tools/bpf, add this.
>>
>> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
>> ---
>>  tools/bpf/.gitignore         | 5 +++++
>>  tools/bpf/bpftool/.gitignore | 1 +
>>  2 files changed, 6 insertions(+)
>>  create mode 100644 tools/bpf/.gitignore
>>
>> diff --git a/tools/bpf/.gitignore b/tools/bpf/.gitignore
>> new file mode 100644
>> index 000000000000..dfe2bd5a4b95
>> --- /dev/null
>> +++ b/tools/bpf/.gitignore
>> @@ -0,0 +1,5 @@
>> +FEATURE-DUMP.bpf
>> +bpf_asm
>> +bpf_dbg
>> +bpf_exp.yacc.*
>> +bpf_jit_disasm
>> diff --git a/tools/bpf/bpftool/.gitignore b/tools/bpf/bpftool/.gitignore
>> index d7e678c2d396..103cc5b5b446 100644
>> --- a/tools/bpf/bpftool/.gitignore
>> +++ b/tools/bpf/bpftool/.gitignore
>> @@ -1,3 +1,4 @@
>>  *.d
>>  bpftool
>> +bpftool*.8
>>  FEATURE-DUMP.bpftool
> 
> This patch is going to be merged to the bpf-next tree, I presume, and
> there is more man pages there:
> 
> $ make -C tools/bpf/bpftool/ doc 
> make: Entering directory 'linux/tools/bpf/bpftool'
>   DESCEND  Documentation
> make[1]: Entering directory '/linux/tools/bpf/bpftool/Documentation'
>   GEN      bpftool-perf.8
>   GEN      bpftool-map.8
>   GEN      bpftool.8
>   GEN      bpftool-prog.8
>   GEN      bpftool-cgroup.8
>   GEN      bpf-helpers.rst
> Parsed description of 80 helper function(s)
>   GEN      bpf-helpers.7
> make[1]: Leaving directory 'linux/tools/bpf/bpftool/Documentation'
> make: Leaving directory 'linux/tools/bpf/bpftool'
> $ git status 
> On branch work
> Your branch is ahead of 'pending' by 10 commits.
>   (use "git push" to publish your local commits)
> 
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> 
> 	tools/bpf/bpftool/Documentation/bpf-helpers.7
> 	tools/bpf/bpftool/Documentation/bpf-helpers.rst
> 	tools/bpf/bpftool/Documentation/bpftool-cgroup.8
> 	tools/bpf/bpftool/Documentation/bpftool-map.8
> 	tools/bpf/bpftool/Documentation/bpftool-perf.8
> 	tools/bpf/bpftool/Documentation/bpftool-prog.8
> 	tools/bpf/bpftool/Documentation/bpftool.8
> 
> nothing added to commit but untracked files present (use "git add" to track)
> 
> See the bpf-helpers.* files?  Those are all auto-generated.
> 
> If you respin for -next please split the series and put [PATCH bpf-next
> v4] as prefix of first patch, and [PATCH bpf v4] as prefix for the
> second, as one of them is an improvement, and second a bug fix.

I've just applied patch 2/2 to bpf tree, thanks Taeung! I think best for
patch 1/2 would be if you rebase this against bpf-next tree as Jakub
mentioned so wouldn't need an immediate follow-up due to incomplete
.gitignore then.

Thanks,
Daniel

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

* Re: [PATCH v3 1/2] tools/bpftool: ignore build products
  2018-07-20  8:23   ` Daniel Borkmann
@ 2018-07-20  9:54     ` Taeung Song
  0 siblings, 0 replies; 5+ messages in thread
From: Taeung Song @ 2018-07-20  9:54 UTC (permalink / raw)
  To: Daniel Borkmann, Jakub Kicinski; +Cc: Alexei Starovoitov, netdev, linux-kernel



On 07/20/2018 05:23 PM, Daniel Borkmann wrote:
> On 07/19/2018 08:23 PM, Jakub Kicinski wrote:
>> On Thu, 19 Jul 2018 21:10:04 +0900, Taeung Song wrote:
>>> For untracked things of tools/bpf, add this.
>>>
>>> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
>>> ---
>>>   tools/bpf/.gitignore         | 5 +++++
>>>   tools/bpf/bpftool/.gitignore | 1 +
>>>   2 files changed, 6 insertions(+)
>>>   create mode 100644 tools/bpf/.gitignore
>>>
>>> diff --git a/tools/bpf/.gitignore b/tools/bpf/.gitignore
>>> new file mode 100644
>>> index 000000000000..dfe2bd5a4b95
>>> --- /dev/null
>>> +++ b/tools/bpf/.gitignore
>>> @@ -0,0 +1,5 @@
>>> +FEATURE-DUMP.bpf
>>> +bpf_asm
>>> +bpf_dbg
>>> +bpf_exp.yacc.*
>>> +bpf_jit_disasm
>>> diff --git a/tools/bpf/bpftool/.gitignore b/tools/bpf/bpftool/.gitignore
>>> index d7e678c2d396..103cc5b5b446 100644
>>> --- a/tools/bpf/bpftool/.gitignore
>>> +++ b/tools/bpf/bpftool/.gitignore
>>> @@ -1,3 +1,4 @@
>>>   *.d
>>>   bpftool
>>> +bpftool*.8
>>>   FEATURE-DUMP.bpftool
>>
>> This patch is going to be merged to the bpf-next tree, I presume, and
>> there is more man pages there:
>>
>> $ make -C tools/bpf/bpftool/ doc
>> make: Entering directory 'linux/tools/bpf/bpftool'
>>    DESCEND  Documentation
>> make[1]: Entering directory '/linux/tools/bpf/bpftool/Documentation'
>>    GEN      bpftool-perf.8
>>    GEN      bpftool-map.8
>>    GEN      bpftool.8
>>    GEN      bpftool-prog.8
>>    GEN      bpftool-cgroup.8
>>    GEN      bpf-helpers.rst
>> Parsed description of 80 helper function(s)
>>    GEN      bpf-helpers.7
>> make[1]: Leaving directory 'linux/tools/bpf/bpftool/Documentation'
>> make: Leaving directory 'linux/tools/bpf/bpftool'
>> $ git status
>> On branch work
>> Your branch is ahead of 'pending' by 10 commits.
>>    (use "git push" to publish your local commits)
>>
>> Untracked files:
>>    (use "git add <file>..." to include in what will be committed)
>>
>> 	tools/bpf/bpftool/Documentation/bpf-helpers.7
>> 	tools/bpf/bpftool/Documentation/bpf-helpers.rst
>> 	tools/bpf/bpftool/Documentation/bpftool-cgroup.8
>> 	tools/bpf/bpftool/Documentation/bpftool-map.8
>> 	tools/bpf/bpftool/Documentation/bpftool-perf.8
>> 	tools/bpf/bpftool/Documentation/bpftool-prog.8
>> 	tools/bpf/bpftool/Documentation/bpftool.8
>>
>> nothing added to commit but untracked files present (use "git add" to track)
>>
>> See the bpf-helpers.* files?  Those are all auto-generated.
>>
>> If you respin for -next please split the series and put [PATCH bpf-next
>> v4] as prefix of first patch, and [PATCH bpf v4] as prefix for the
>> second, as one of them is an improvement, and second a bug fix.
> 
> I've just applied patch 2/2 to bpf tree, thanks Taeung! I think best for
> patch 1/2 would be if you rebase this against bpf-next tree as Jakub
> mentioned so wouldn't need an immediate follow-up due to incomplete
> .gitignore then.
> 
> Thanks,
> Daniel
> 

OK, I'll follow-up it later!
--
Thanks,
Taeung

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

end of thread, other threads:[~2018-07-20  9:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 12:10 [PATCH v3 1/2] tools/bpftool: ignore build products Taeung Song
2018-07-19 12:10 ` [PATCH v3 2/2] tools/bpftool: Fix segfault case regarding 'pin' arguments Taeung Song
2018-07-19 18:23 ` [PATCH v3 1/2] tools/bpftool: ignore build products Jakub Kicinski
2018-07-20  8:23   ` Daniel Borkmann
2018-07-20  9:54     ` Taeung Song

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.