* [PATCH bpf v2] tools: bpftool: fix infinite loop in map create
@ 2019-04-12 12:40 Alban Crequy
2019-04-12 13:20 ` Quentin Monnet
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alban Crequy @ 2019-04-12 12:40 UTC (permalink / raw)
To: ast, daniel; +Cc: bpf, netdev, linux-kernel, alban, iago
From: Alban Crequy <alban@kinvolk.io>
"bpftool map create" has an infinite loop on "while (argc)". The error
case is missing.
Symptoms: when forgetting to type the keyword 'type' in front of 'hash':
$ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
(infinite loop, taking all the CPU)
^C
After the patch:
$ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
Error: unknown arg hash
Fixes: 0b592b5a01be ("tools: bpftool: add map create command")
Signed-off-by: Alban Crequy <alban@kinvolk.io>
---
Changes in v2:
- Explain the cause of the bug in commitmsg
- Add the "fixes" line in the commitmsg (Jakub's review)
- Rebase on the bpf tree
v1 was initially based on bpf-next and submitted on
https://marc.info/?l=linux-kernel&m=155310327709613&w=2
---
tools/bpf/bpftool/map.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 05b029b934a6..1ccc38718458 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -1151,6 +1151,9 @@ static int do_create(int argc, char **argv)
return -1;
}
NEXT_ARG();
+ } else {
+ p_err("unknown arg %s", *argv);
+ return -1;
}
}
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bpf v2] tools: bpftool: fix infinite loop in map create
2019-04-12 12:40 [PATCH bpf v2] tools: bpftool: fix infinite loop in map create Alban Crequy
@ 2019-04-12 13:20 ` Quentin Monnet
2019-04-12 18:07 ` Song Liu
2019-04-12 23:45 ` Jakub Kicinski
2019-04-16 8:52 ` Daniel Borkmann
2 siblings, 1 reply; 5+ messages in thread
From: Quentin Monnet @ 2019-04-12 13:20 UTC (permalink / raw)
To: Alban Crequy, ast, daniel; +Cc: bpf, netdev, linux-kernel, alban, iago
2019-04-12 14:40 UTC+0200 ~ Alban Crequy <alban.crequy@gmail.com>
> From: Alban Crequy <alban@kinvolk.io>
>
> "bpftool map create" has an infinite loop on "while (argc)". The error
> case is missing.
>
> Symptoms: when forgetting to type the keyword 'type' in front of 'hash':
> $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
> (infinite loop, taking all the CPU)
> ^C
>
> After the patch:
> $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
> Error: unknown arg hash
>
> Fixes: 0b592b5a01be ("tools: bpftool: add map create command")
> Signed-off-by: Alban Crequy <alban@kinvolk.io>
>
> ---
>
> Changes in v2:
> - Explain the cause of the bug in commitmsg
> - Add the "fixes" line in the commitmsg (Jakub's review)
> - Rebase on the bpf tree
>
> v1 was initially based on bpf-next and submitted on
> https://marc.info/?l=linux-kernel&m=155310327709613&w=2
> ---
> tools/bpf/bpftool/map.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index 05b029b934a6..1ccc38718458 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -1151,6 +1151,9 @@ static int do_create(int argc, char **argv)
> return -1;
> }
> NEXT_ARG();
> + } else {
> + p_err("unknown arg %s", *argv);
> + return -1;
> }
> }
>
>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Thanks Alban!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf v2] tools: bpftool: fix infinite loop in map create
2019-04-12 13:20 ` Quentin Monnet
@ 2019-04-12 18:07 ` Song Liu
0 siblings, 0 replies; 5+ messages in thread
From: Song Liu @ 2019-04-12 18:07 UTC (permalink / raw)
To: Quentin Monnet
Cc: Alban Crequy, Alexei Starovoitov, Daniel Borkmann, bpf,
Networking, open list, alban, iago
On Fri, Apr 12, 2019 at 6:21 AM Quentin Monnet
<quentin.monnet@netronome.com> wrote:
>
> 2019-04-12 14:40 UTC+0200 ~ Alban Crequy <alban.crequy@gmail.com>
> > From: Alban Crequy <alban@kinvolk.io>
> >
> > "bpftool map create" has an infinite loop on "while (argc)". The error
> > case is missing.
> >
> > Symptoms: when forgetting to type the keyword 'type' in front of 'hash':
> > $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
> > (infinite loop, taking all the CPU)
> > ^C
> >
> > After the patch:
> > $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
> > Error: unknown arg hash
> >
> > Fixes: 0b592b5a01be ("tools: bpftool: add map create command")
> > Signed-off-by: Alban Crequy <alban@kinvolk.io>
Acked-by: Song Liu <songliubraving@fb.com>
Thanks for the fix!
> >
> > ---
> >
> > Changes in v2:
> > - Explain the cause of the bug in commitmsg
> > - Add the "fixes" line in the commitmsg (Jakub's review)
> > - Rebase on the bpf tree
> >
> > v1 was initially based on bpf-next and submitted on
> > https://marc.info/?l=linux-kernel&m=155310327709613&w=2
> > ---
> > tools/bpf/bpftool/map.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> > index 05b029b934a6..1ccc38718458 100644
> > --- a/tools/bpf/bpftool/map.c
> > +++ b/tools/bpf/bpftool/map.c
> > @@ -1151,6 +1151,9 @@ static int do_create(int argc, char **argv)
> > return -1;
> > }
> > NEXT_ARG();
> > + } else {
> > + p_err("unknown arg %s", *argv);
> > + return -1;
> > }
> > }
> >
> >
>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
>
> Thanks Alban!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf v2] tools: bpftool: fix infinite loop in map create
2019-04-12 12:40 [PATCH bpf v2] tools: bpftool: fix infinite loop in map create Alban Crequy
2019-04-12 13:20 ` Quentin Monnet
@ 2019-04-12 23:45 ` Jakub Kicinski
2019-04-16 8:52 ` Daniel Borkmann
2 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2019-04-12 23:45 UTC (permalink / raw)
To: Alban Crequy; +Cc: ast, daniel, bpf, netdev, linux-kernel, alban, iago
On Fri, 12 Apr 2019 14:40:50 +0200, Alban Crequy wrote:
> From: Alban Crequy <alban@kinvolk.io>
>
> "bpftool map create" has an infinite loop on "while (argc)". The error
> case is missing.
>
> Symptoms: when forgetting to type the keyword 'type' in front of 'hash':
> $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
> (infinite loop, taking all the CPU)
> ^C
>
> After the patch:
> $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
> Error: unknown arg hash
>
> Fixes: 0b592b5a01be ("tools: bpftool: add map create command")
> Signed-off-by: Alban Crequy <alban@kinvolk.io>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf v2] tools: bpftool: fix infinite loop in map create
2019-04-12 12:40 [PATCH bpf v2] tools: bpftool: fix infinite loop in map create Alban Crequy
2019-04-12 13:20 ` Quentin Monnet
2019-04-12 23:45 ` Jakub Kicinski
@ 2019-04-16 8:52 ` Daniel Borkmann
2 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2019-04-16 8:52 UTC (permalink / raw)
To: Alban Crequy, ast; +Cc: bpf, netdev, linux-kernel, alban, iago
On 04/12/2019 02:40 PM, Alban Crequy wrote:
> From: Alban Crequy <alban@kinvolk.io>
>
> "bpftool map create" has an infinite loop on "while (argc)". The error
> case is missing.
>
> Symptoms: when forgetting to type the keyword 'type' in front of 'hash':
> $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
> (infinite loop, taking all the CPU)
> ^C
>
> After the patch:
> $ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
> Error: unknown arg hash
>
> Fixes: 0b592b5a01be ("tools: bpftool: add map create command")
> Signed-off-by: Alban Crequy <alban@kinvolk.io>
Applied, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-16 9:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 12:40 [PATCH bpf v2] tools: bpftool: fix infinite loop in map create Alban Crequy
2019-04-12 13:20 ` Quentin Monnet
2019-04-12 18:07 ` Song Liu
2019-04-12 23:45 ` Jakub Kicinski
2019-04-16 8:52 ` 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).