* [PATCH bpf-next 0/2] Change return code if failed to load object
@ 2020-04-22 8:30 Mao Wenan
2020-04-22 8:30 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL Mao Wenan
2020-04-22 8:30 ` [PATCH bpf-next 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
0 siblings, 2 replies; 14+ messages in thread
From: Mao Wenan @ 2020-04-22 8:30 UTC (permalink / raw)
To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh
Cc: netdev, bpf, linux-kernel, kernel-janitors
The first patch change return code from -EINVAL to -EOPNOTSUPP,
the second patch quote the err value returned by bpf_object__load().
Mao Wenan (2):
bpf: Change error code when ops is NULL
libbpf: Return err if bpf_object__load failed
kernel/bpf/syscall.c | 8 +++++---
tools/lib/bpf/libbpf.c | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL
2020-04-22 8:30 [PATCH bpf-next 0/2] Change return code if failed to load object Mao Wenan
@ 2020-04-22 8:30 ` Mao Wenan
2020-04-22 9:33 ` Dan Carpenter
` (2 more replies)
2020-04-22 8:30 ` [PATCH bpf-next 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
1 sibling, 3 replies; 14+ messages in thread
From: Mao Wenan @ 2020-04-22 8:30 UTC (permalink / raw)
To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh
Cc: netdev, bpf, linux-kernel, kernel-janitors
There is one error printed when use type
BPF_MAP_TYPE_SOCKMAP to create map:
libbpf: failed to create map (name: 'sock_map'): Invalid argument(-22)
This is because CONFIG_BPF_STREAM_PARSER is not set, and
bpf_map_types[type] return invalid ops. It is not clear
to show the cause of config missing with return code -EINVAL,
so add pr_warn() and change error code to describe the reason.
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
kernel/bpf/syscall.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index d85f37239540..f67bc063bf75 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -112,9 +112,11 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
return ERR_PTR(-EINVAL);
type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
ops = bpf_map_types[type];
- if (!ops)
- return ERR_PTR(-EINVAL);
-
+ if (!ops) {
+ pr_warn("map type %d not supported or
+ kernel config not opened\n", type);
+ return ERR_PTR(-EOPNOTSUPP);
+ }
if (ops->map_alloc_check) {
err = ops->map_alloc_check(attr);
if (err)
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH bpf-next 2/2] libbpf: Return err if bpf_object__load failed
2020-04-22 8:30 [PATCH bpf-next 0/2] Change return code if failed to load object Mao Wenan
2020-04-22 8:30 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL Mao Wenan
@ 2020-04-22 8:30 ` Mao Wenan
2020-04-22 23:27 ` Andrii Nakryiko
1 sibling, 1 reply; 14+ messages in thread
From: Mao Wenan @ 2020-04-22 8:30 UTC (permalink / raw)
To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh
Cc: netdev, bpf, linux-kernel, kernel-janitors
bpf_object__load() has various return code, when
it failed to load object, it must return err instead
of return -EINVAL.
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 8f480e29a6b0..8e1dc6980fac 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -7006,7 +7006,7 @@ int bpf_prog_load_xattr(const struct bpf_prog_load_attr *attr,
err = bpf_object__load(obj);
if (err) {
bpf_object__close(obj);
- return -EINVAL;
+ return err;
}
*pobj = obj;
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL
2020-04-22 8:30 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL Mao Wenan
@ 2020-04-22 9:33 ` Dan Carpenter
2020-04-23 3:33 ` [PATCH bpf-next v2 0/2] Change return code if failed to load object Mao Wenan
2020-04-24 5:10 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL kbuild test robot
2020-04-30 2:04 ` kbuild test robot
2 siblings, 1 reply; 14+ messages in thread
From: Dan Carpenter @ 2020-04-22 9:33 UTC (permalink / raw)
To: Mao Wenan
Cc: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh, netdev, bpf, linux-kernel, kernel-janitors
On Wed, Apr 22, 2020 at 04:30:09PM +0800, Mao Wenan wrote:
> There is one error printed when use type
> BPF_MAP_TYPE_SOCKMAP to create map:
> libbpf: failed to create map (name: 'sock_map'): Invalid argument(-22)
>
> This is because CONFIG_BPF_STREAM_PARSER is not set, and
> bpf_map_types[type] return invalid ops. It is not clear
> to show the cause of config missing with return code -EINVAL,
> so add pr_warn() and change error code to describe the reason.
Since you're going to have to redo the commit any way, maybe you should
put the line breaks at 72 characters. I think you're using 65 character
line breaks, but that's only for the Subject.
>
> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> ---
> kernel/bpf/syscall.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index d85f37239540..f67bc063bf75 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -112,9 +112,11 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
> return ERR_PTR(-EINVAL);
> type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
> ops = bpf_map_types[type];
> - if (!ops)
> - return ERR_PTR(-EINVAL);
> -
> + if (!ops) {
> + pr_warn("map type %d not supported or
> + kernel config not opened\n", type);
This pr_warn() will be badly formatted in dmesg because of the new line
and the tabs. I tried to add a checkpatch.pl warning for this but maybe
it only works with -f?...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH bpf-next 2/2] libbpf: Return err if bpf_object__load failed
2020-04-22 8:30 ` [PATCH bpf-next 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
@ 2020-04-22 23:27 ` Andrii Nakryiko
0 siblings, 0 replies; 14+ messages in thread
From: Andrii Nakryiko @ 2020-04-22 23:27 UTC (permalink / raw)
To: Mao Wenan
Cc: Alexei Starovoitov, Daniel Borkmann, Martin Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, john fastabend, KP Singh,
Networking, bpf, open list, kernel-janitors
On Wed, Apr 22, 2020 at 1:30 AM Mao Wenan <maowenan@huawei.com> wrote:
>
> bpf_object__load() has various return code, when
> it failed to load object, it must return err instead
> of return -EINVAL.
>
> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> ---
This patch looks good. The other one in this series - not so sure..
Acked-by: Andrii Nakryiko <andriin@fb.com>
> tools/lib/bpf/libbpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 8f480e29a6b0..8e1dc6980fac 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -7006,7 +7006,7 @@ int bpf_prog_load_xattr(const struct bpf_prog_load_attr *attr,
> err = bpf_object__load(obj);
> if (err) {
> bpf_object__close(obj);
> - return -EINVAL;
> + return err;
> }
>
> *pobj = obj;
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH bpf-next v2 0/2] Change return code if failed to load object
2020-04-22 9:33 ` Dan Carpenter
@ 2020-04-23 3:33 ` Mao Wenan
2020-04-23 3:33 ` [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL Mao Wenan
2020-04-23 3:33 ` [PATCH bpf-next v2 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
0 siblings, 2 replies; 14+ messages in thread
From: Mao Wenan @ 2020-04-23 3:33 UTC (permalink / raw)
To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh
Cc: netdev, bpf, kernel-janitors, dan.carpenter, andrii.nakryiko
The first patch change return code from -EINVAL to -EOPNOTSUPP,
the second patch quote the err value returned by bpf_object__load().
v2: Adjust line breaks at 72 characters for commit log, and pr_warn alignment as suggested by dan carpenter. For second patch, add Acked-by tag as well.
Mao Wenan (2):
bpf: Change error code when ops is NULL
libbpf: Return err if bpf_object__load failed
kernel/bpf/syscall.c | 7 ++++---
tools/lib/bpf/libbpf.c | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL
2020-04-23 3:33 ` [PATCH bpf-next v2 0/2] Change return code if failed to load object Mao Wenan
@ 2020-04-23 3:33 ` Mao Wenan
2020-04-23 5:43 ` Alexei Starovoitov
2020-04-23 3:33 ` [PATCH bpf-next v2 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
1 sibling, 1 reply; 14+ messages in thread
From: Mao Wenan @ 2020-04-23 3:33 UTC (permalink / raw)
To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh
Cc: netdev, bpf, kernel-janitors, dan.carpenter, andrii.nakryiko
There is one error printed when use BPF_MAP_TYPE_SOCKMAP to create map:
libbpf: failed to create map (name: 'sock_map'): Invalid argument(-22)
This is because CONFIG_BPF_STREAM_PARSER is not set, and
bpf_map_types[type] return invalid ops. It is not clear to show the
cause of config missing with return code -EINVAL, so add pr_warn() and
change error code to describe the reason.
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
kernel/bpf/syscall.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index d85f37239540..7686778457c7 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -112,9 +112,10 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
return ERR_PTR(-EINVAL);
type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
ops = bpf_map_types[type];
- if (!ops)
- return ERR_PTR(-EINVAL);
-
+ if (!ops) {
+ pr_warn("map type %d not supported or kernel config not opened\n", type);
+ return ERR_PTR(-EOPNOTSUPP);
+ }
if (ops->map_alloc_check) {
err = ops->map_alloc_check(attr);
if (err)
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH bpf-next v2 2/2] libbpf: Return err if bpf_object__load failed
2020-04-23 3:33 ` [PATCH bpf-next v2 0/2] Change return code if failed to load object Mao Wenan
2020-04-23 3:33 ` [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL Mao Wenan
@ 2020-04-23 3:33 ` Mao Wenan
1 sibling, 0 replies; 14+ messages in thread
From: Mao Wenan @ 2020-04-23 3:33 UTC (permalink / raw)
To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh
Cc: netdev, bpf, kernel-janitors, dan.carpenter, andrii.nakryiko
bpf_object__load() has various return code, when it failed to load
object, it must return err instead of -EINVAL.
Signed-off-by: Mao Wenan <maowenan@huawei.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 8f480e29a6b0..8e1dc6980fac 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -7006,7 +7006,7 @@ int bpf_prog_load_xattr(const struct bpf_prog_load_attr *attr,
err = bpf_object__load(obj);
if (err) {
bpf_object__close(obj);
- return -EINVAL;
+ return err;
}
*pobj = obj;
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL
2020-04-23 3:33 ` [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL Mao Wenan
@ 2020-04-23 5:43 ` Alexei Starovoitov
2020-04-23 6:25 ` maowenan
0 siblings, 1 reply; 14+ messages in thread
From: Alexei Starovoitov @ 2020-04-23 5:43 UTC (permalink / raw)
To: Mao Wenan
Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Network Development, bpf, kernel-janitors, Dan Carpenter,
Andrii Nakryiko
On Wed, Apr 22, 2020 at 8:31 PM Mao Wenan <maowenan@huawei.com> wrote:
>
> There is one error printed when use BPF_MAP_TYPE_SOCKMAP to create map:
> libbpf: failed to create map (name: 'sock_map'): Invalid argument(-22)
>
> This is because CONFIG_BPF_STREAM_PARSER is not set, and
> bpf_map_types[type] return invalid ops. It is not clear to show the
> cause of config missing with return code -EINVAL, so add pr_warn() and
> change error code to describe the reason.
>
> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> ---
> kernel/bpf/syscall.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index d85f37239540..7686778457c7 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -112,9 +112,10 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
> return ERR_PTR(-EINVAL);
> type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
> ops = bpf_map_types[type];
> - if (!ops)
> - return ERR_PTR(-EINVAL);
> -
> + if (!ops) {
> + pr_warn("map type %d not supported or kernel config not opened\n", type);
> + return ERR_PTR(-EOPNOTSUPP);
> + }
I don't think users will like it when kernel spams dmesg.
If you need this level of verbosity please teach consumer of libbpf to
print them.
It's not a job of libbpf either.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL
2020-04-23 5:43 ` Alexei Starovoitov
@ 2020-04-23 6:25 ` maowenan
2020-04-23 16:07 ` Alexei Starovoitov
0 siblings, 1 reply; 14+ messages in thread
From: maowenan @ 2020-04-23 6:25 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Network Development, bpf, kernel-janitors, Dan Carpenter,
Andrii Nakryiko
On 2020/4/23 13:43, Alexei Starovoitov wrote:
> On Wed, Apr 22, 2020 at 8:31 PM Mao Wenan <maowenan@huawei.com> wrote:
>>
>> There is one error printed when use BPF_MAP_TYPE_SOCKMAP to create map:
>> libbpf: failed to create map (name: 'sock_map'): Invalid argument(-22)
>>
>> This is because CONFIG_BPF_STREAM_PARSER is not set, and
>> bpf_map_types[type] return invalid ops. It is not clear to show the
>> cause of config missing with return code -EINVAL, so add pr_warn() and
>> change error code to describe the reason.
>>
>> Signed-off-by: Mao Wenan <maowenan@huawei.com>
>> ---
>> kernel/bpf/syscall.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>> index d85f37239540..7686778457c7 100644
>> --- a/kernel/bpf/syscall.c
>> +++ b/kernel/bpf/syscall.c
>> @@ -112,9 +112,10 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
>> return ERR_PTR(-EINVAL);
>> type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
>> ops = bpf_map_types[type];
>> - if (!ops)
>> - return ERR_PTR(-EINVAL);
>> -
>> + if (!ops) {
>> + pr_warn("map type %d not supported or kernel config not opened\n", type);
>> + return ERR_PTR(-EOPNOTSUPP);
>> + }
>
> I don't think users will like it when kernel spams dmesg.
> If you need this level of verbosity please teach consumer of libbpf to
> print them.
> It's not a job of libbpf either.
thanks for reviw, so is it better to delete redundant pr_warn()?
>
> .
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL
2020-04-23 6:25 ` maowenan
@ 2020-04-23 16:07 ` Alexei Starovoitov
2020-04-24 1:13 ` maowenan
0 siblings, 1 reply; 14+ messages in thread
From: Alexei Starovoitov @ 2020-04-23 16:07 UTC (permalink / raw)
To: maowenan
Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Network Development, bpf, kernel-janitors, Dan Carpenter,
Andrii Nakryiko
On Wed, Apr 22, 2020 at 11:25 PM maowenan <maowenan@huawei.com> wrote:
>
> On 2020/4/23 13:43, Alexei Starovoitov wrote:
> > On Wed, Apr 22, 2020 at 8:31 PM Mao Wenan <maowenan@huawei.com> wrote:
> >>
> >> There is one error printed when use BPF_MAP_TYPE_SOCKMAP to create map:
> >> libbpf: failed to create map (name: 'sock_map'): Invalid argument(-22)
> >>
> >> This is because CONFIG_BPF_STREAM_PARSER is not set, and
> >> bpf_map_types[type] return invalid ops. It is not clear to show the
> >> cause of config missing with return code -EINVAL, so add pr_warn() and
> >> change error code to describe the reason.
> >>
> >> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> >> ---
> >> kernel/bpf/syscall.c | 7 ++++---
> >> 1 file changed, 4 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> >> index d85f37239540..7686778457c7 100644
> >> --- a/kernel/bpf/syscall.c
> >> +++ b/kernel/bpf/syscall.c
> >> @@ -112,9 +112,10 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
> >> return ERR_PTR(-EINVAL);
> >> type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
> >> ops = bpf_map_types[type];
> >> - if (!ops)
> >> - return ERR_PTR(-EINVAL);
> >> -
> >> + if (!ops) {
> >> + pr_warn("map type %d not supported or kernel config not opened\n", type);
> >> + return ERR_PTR(-EOPNOTSUPP);
> >> + }
> >
> > I don't think users will like it when kernel spams dmesg.
> > If you need this level of verbosity please teach consumer of libbpf to
> > print them.
> > It's not a job of libbpf either.
> thanks for reviw, so is it better to delete redundant pr_warn()?
which one?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL
2020-04-23 16:07 ` Alexei Starovoitov
@ 2020-04-24 1:13 ` maowenan
0 siblings, 0 replies; 14+ messages in thread
From: maowenan @ 2020-04-24 1:13 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Network Development, bpf, kernel-janitors, Dan Carpenter,
Andrii Nakryiko
On 2020/4/24 0:07, Alexei Starovoitov wrote:
> On Wed, Apr 22, 2020 at 11:25 PM maowenan <maowenan@huawei.com> wrote:
>>
>> On 2020/4/23 13:43, Alexei Starovoitov wrote:
>>> On Wed, Apr 22, 2020 at 8:31 PM Mao Wenan <maowenan@huawei.com> wrote:
>>>>
>>>> There is one error printed when use BPF_MAP_TYPE_SOCKMAP to create map:
>>>> libbpf: failed to create map (name: 'sock_map'): Invalid argument(-22)
>>>>
>>>> This is because CONFIG_BPF_STREAM_PARSER is not set, and
>>>> bpf_map_types[type] return invalid ops. It is not clear to show the
>>>> cause of config missing with return code -EINVAL, so add pr_warn() and
>>>> change error code to describe the reason.
>>>>
>>>> Signed-off-by: Mao Wenan <maowenan@huawei.com>
>>>> ---
>>>> kernel/bpf/syscall.c | 7 ++++---
>>>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>>>> index d85f37239540..7686778457c7 100644
>>>> --- a/kernel/bpf/syscall.c
>>>> +++ b/kernel/bpf/syscall.c
>>>> @@ -112,9 +112,10 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
>>>> return ERR_PTR(-EINVAL);
>>>> type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
>>>> ops = bpf_map_types[type];
>>>> - if (!ops)
>>>> - return ERR_PTR(-EINVAL);
>>>> -
>>>> + if (!ops) {
>>>> + pr_warn("map type %d not supported or kernel config not opened\n", type);
>>>> + return ERR_PTR(-EOPNOTSUPP);
>>>> + }
>>>
>>> I don't think users will like it when kernel spams dmesg.
>>> If you need this level of verbosity please teach consumer of libbpf to
>>> print them.
>>> It's not a job of libbpf either.
>> thanks for reviw, so is it better to delete redundant pr_warn()?
>
> which one?
I mean pr_warn is no need, this patch just change the return code ERR_PTR(-EOPNOTSUPP);
+ pr_warn("map type %d not supported or kernel config not opened\n", type);
>
> .
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL
2020-04-22 8:30 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL Mao Wenan
2020-04-22 9:33 ` Dan Carpenter
@ 2020-04-24 5:10 ` kbuild test robot
2020-04-30 2:04 ` kbuild test robot
2 siblings, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2020-04-24 5:10 UTC (permalink / raw)
To: Mao Wenan, ast, daniel, kafai, songliubraving, yhs, andriin,
john.fastabend, kpsingh
Cc: kbuild-all, netdev, bpf, linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 22267 bytes --]
Hi Mao,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master net/master net-next/master v5.7-rc2 next-20200423]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Mao-Wenan/Change-return-code-if-failed-to-load-object/20200424-025339
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: c6x-allyesconfig (attached as .config)
compiler: c6x-elf-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=c6x
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
kernel/bpf/syscall.c: In function 'find_and_alloc_map':
>> kernel/bpf/syscall.c:116:11: warning: missing terminating " character
116 | pr_warn("map type %d not supported or
| ^
kernel/bpf/syscall.c:117:31: warning: missing terminating " character
117 | kernel config not opened\n", type);
| ^
In file included from kernel/bpf/syscall.c:1551:
>> include/linux/bpf_types.h:120: error: unterminated argument list invoking macro "pr_warn"
120 | #endif
|
>> kernel/bpf/syscall.c:116:3: error: 'pr_warn' undeclared (first use in this function)
116 | pr_warn("map type %d not supported or
| ^~~~~~~
kernel/bpf/syscall.c:116:3: note: each undeclared identifier is reported only once for each function it appears in
>> kernel/bpf/syscall.c:116:10: error: expected ';' before '}' token
116 | pr_warn("map type %d not supported or
| ^
| ;
......
1554 | };
| ~
>> kernel/bpf/syscall.c:1556:12: error: invalid storage class for function 'find_prog_type'
1556 | static int find_prog_type(enum bpf_prog_type type, struct bpf_prog *prog)
| ^~~~~~~~~~~~~~
In file included from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:9,
from kernel/bpf/syscall.c:4:
kernel/bpf/syscall.c: In function 'find_prog_type':
>> kernel/bpf/syscall.c:1560:25: error: 'bpf_prog_types' undeclared (first use in this function); did you mean 'bpf_prog_type'?
1560 | if (type >= ARRAY_SIZE(bpf_prog_types))
| ^~~~~~~~~~~~~~
include/linux/kernel.h:47:33: note: in definition of macro 'ARRAY_SIZE'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:9,
from kernel/bpf/syscall.c:4:
include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/compiler.h:357:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
357 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
| ^~~~~~~~~~~~~~~~~
include/linux/kernel.h:47:59: note: in expansion of macro '__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1560:14: note: in expansion of macro 'ARRAY_SIZE'
1560 | if (type >= ARRAY_SIZE(bpf_prog_types))
| ^~~~~~~~~~
In file included from include/linux/fdtable.h:13,
from kernel/bpf/syscall.c:14:
include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/nospec.h:52:9: note: in definition of macro 'array_index_nospec'
52 | typeof(size) _s = (size); \
| ^~~~
include/linux/compiler.h:357:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
357 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
| ^~~~~~~~~~~~~~~~~
include/linux/kernel.h:47:59: note: in expansion of macro '__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1562:34: note: in expansion of macro 'ARRAY_SIZE'
1562 | type = array_index_nospec(type, ARRAY_SIZE(bpf_prog_types));
| ^~~~~~~~~~
include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/nospec.h:52:21: note: in definition of macro 'array_index_nospec'
52 | typeof(size) _s = (size); \
| ^~~~
include/linux/compiler.h:357:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
357 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
| ^~~~~~~~~~~~~~~~~
include/linux/kernel.h:47:59: note: in expansion of macro '__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1562:34: note: in expansion of macro 'ARRAY_SIZE'
1562 | type = array_index_nospec(type, ARRAY_SIZE(bpf_prog_types));
| ^~~~~~~~~~
kernel/bpf/syscall.c: In function 'find_and_alloc_map':
>> kernel/bpf/syscall.c:1556:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
1556 | static int find_prog_type(enum bpf_prog_type type, struct bpf_prog *prog)
| ^~~~~~
>> kernel/bpf/syscall.c:1586:13: error: invalid storage class for function 'bpf_audit_prog'
1586 | static void bpf_audit_prog(const struct bpf_prog *prog, unsigned int op)
| ^~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1627:12: error: invalid storage class for function 'bpf_prog_charge_memlock'
1627 | static int bpf_prog_charge_memlock(struct bpf_prog *prog)
| ^~~~~~~~~~~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1642:13: error: invalid storage class for function 'bpf_prog_uncharge_memlock'
1642 | static void bpf_prog_uncharge_memlock(struct bpf_prog *prog)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1650:12: error: invalid storage class for function 'bpf_prog_alloc_id'
1650 | static int bpf_prog_alloc_id(struct bpf_prog *prog)
| ^~~~~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1693:13: error: invalid storage class for function '__bpf_prog_put_rcu'
1693 | static void __bpf_prog_put_rcu(struct rcu_head *rcu)
| ^~~~~~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1704:13: error: invalid storage class for function '__bpf_prog_put_noref'
1704 | static void __bpf_prog_put_noref(struct bpf_prog *prog, bool deferred)
| ^~~~~~~~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1716:13: error: invalid storage class for function '__bpf_prog_put'
1716 | static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock)
| ^~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:9,
from kernel/bpf/syscall.c:4:
>> kernel/bpf/syscall.c:1731:19: error: non-static declaration of 'bpf_prog_put' follows static declaration
1731 | EXPORT_SYMBOL_GPL(bpf_prog_put);
| ^~~~~~~~~~~~
include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
159 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1731:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
1731 | EXPORT_SYMBOL_GPL(bpf_prog_put);
| ^~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1727:6: note: previous definition of 'bpf_prog_put' was here
1727 | void bpf_prog_put(struct bpf_prog *prog)
| ^~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:9,
from kernel/bpf/syscall.c:4:
include/linux/export.h:67:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
159 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1731:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
1731 | EXPORT_SYMBOL_GPL(bpf_prog_put);
| ^~~~~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1733:12: error: invalid storage class for function 'bpf_prog_release'
1733 | static int bpf_prog_release(struct inode *inode, struct file *filp)
| ^~~~~~~~~~~~~~~~
>> kernel/bpf/syscall.c:1741:13: error: invalid storage class for function 'bpf_prog_get_stats'
1741 | static void bpf_prog_get_stats(const struct bpf_prog *prog,
| ^~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1766:13: error: invalid storage class for function 'bpf_prog_show_fdinfo'
1766 | static void bpf_prog_show_fdinfo(struct seq_file *m, struct file *filp)
| ^~~~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1797:11: error: 'bpf_dummy_read' undeclared (first use in this function)
1797 | .read = bpf_dummy_read,
| ^~~~~~~~~~~~~~
kernel/bpf/syscall.c:1798:12: error: 'bpf_dummy_write' undeclared (first use in this function)
1798 | .write = bpf_dummy_write,
| ^~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1813:25: error: invalid storage class for function '____bpf_prog_get'
1813 | static struct bpf_prog *____bpf_prog_get(struct fd f)
| ^~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:9,
from kernel/bpf/syscall.c:4:
kernel/bpf/syscall.c:1829:19: error: non-static declaration of 'bpf_prog_add' follows static declaration
1829 | EXPORT_SYMBOL_GPL(bpf_prog_add);
| ^~~~~~~~~~~~
include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
159 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
kernel/bpf/syscall.c:1829:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
1829 | EXPORT_SYMBOL_GPL(bpf_prog_add);
| ^~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1825:6: note: previous definition of 'bpf_prog_add' was here
1825 | void bpf_prog_add(struct bpf_prog *prog, int i)
| ^~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:9,
from kernel/bpf/syscall.c:4:
include/linux/export.h:67:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
159 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
kernel/bpf/syscall.c:1829:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
1829 | EXPORT_SYMBOL_GPL(bpf_prog_add);
| ^~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1840:19: error: non-static declaration of 'bpf_prog_sub' follows static declaration
1840 | EXPORT_SYMBOL_GPL(bpf_prog_sub);
| ^~~~~~~~~~~~
include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
159 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl")
| ^~~~~~~~~~~~~~
kernel/bpf/syscall.c:1840:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
1840 | EXPORT_SYMBOL_GPL(bpf_prog_sub);
| ^~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:1831:6: note: previous definition of 'bpf_prog_sub' was here
1831 | void bpf_prog_sub(struct bpf_prog *prog, int i)
| ^~~~~~~~~~~~
In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:9,
from kernel/bpf/syscall.c:4:
include/linux/export.h:67:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
67 | static const struct kernel_symbol __ksymtab_##sym \
| ^~~~~~
include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
108 | __KSYMTAB_ENTRY(sym, sec)
| ^~~~~~~~~~~~~~~
include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
| ^~~~~~~~~~~~~~~~
include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
vim +/pr_warn +120 include/linux/bpf_types.h
40077e0cf62206 Johannes Berg 2017-04-11 78
40077e0cf62206 Johannes Berg 2017-04-11 79 BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 80 BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, percpu_array_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 81 BPF_MAP_TYPE(BPF_MAP_TYPE_PROG_ARRAY, prog_array_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 82 BPF_MAP_TYPE(BPF_MAP_TYPE_PERF_EVENT_ARRAY, perf_event_array_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 83 #ifdef CONFIG_CGROUPS
40077e0cf62206 Johannes Berg 2017-04-11 84 BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_ARRAY, cgroup_array_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 85 #endif
de9cbbaadba5ad Roman Gushchin 2018-08-02 86 #ifdef CONFIG_CGROUP_BPF
de9cbbaadba5ad Roman Gushchin 2018-08-02 87 BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_STORAGE, cgroup_storage_map_ops)
b741f1630346de Roman Gushchin 2018-09-28 88 BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, cgroup_storage_map_ops)
de9cbbaadba5ad Roman Gushchin 2018-08-02 89 #endif
40077e0cf62206 Johannes Berg 2017-04-11 90 BPF_MAP_TYPE(BPF_MAP_TYPE_HASH, htab_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 91 BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_HASH, htab_percpu_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 92 BPF_MAP_TYPE(BPF_MAP_TYPE_LRU_HASH, htab_lru_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 93 BPF_MAP_TYPE(BPF_MAP_TYPE_LRU_PERCPU_HASH, htab_lru_percpu_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 94 BPF_MAP_TYPE(BPF_MAP_TYPE_LPM_TRIE, trie_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 95 #ifdef CONFIG_PERF_EVENTS
144991602e6a14 Mauricio Vasquez B 2018-10-18 96 BPF_MAP_TYPE(BPF_MAP_TYPE_STACK_TRACE, stack_trace_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 97 #endif
40077e0cf62206 Johannes Berg 2017-04-11 98 BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_of_maps_map_ops)
40077e0cf62206 Johannes Berg 2017-04-11 99 BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops)
546ac1ffb70d25 John Fastabend 2017-07-17 100 #ifdef CONFIG_NET
546ac1ffb70d25 John Fastabend 2017-07-17 101 BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)
6f9d451ab1a337 Toke Høiland-Jørgensen 2019-07-26 102 BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP_HASH, dev_map_hash_ops)
6ac99e8f23d4b1 Martin KaFai Lau 2019-04-26 103 BPF_MAP_TYPE(BPF_MAP_TYPE_SK_STORAGE, sk_storage_map_ops)
604326b41a6fb9 Daniel Borkmann 2018-10-13 104 #if defined(CONFIG_BPF_STREAM_PARSER)
174a79ff9515f4 John Fastabend 2017-08-15 105 BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops)
81110384441a59 John Fastabend 2018-05-14 106 BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKHASH, sock_hash_ops)
546ac1ffb70d25 John Fastabend 2017-07-17 107 #endif
6710e1126934d8 Jesper Dangaard Brouer 2017-10-16 108 BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops)
fbfc504a24f53f Björn Töpel 2018-05-02 109 #if defined(CONFIG_XDP_SOCKETS)
fbfc504a24f53f Björn Töpel 2018-05-02 110 BPF_MAP_TYPE(BPF_MAP_TYPE_XSKMAP, xsk_map_ops)
fbfc504a24f53f Björn Töpel 2018-05-02 111 #endif
5dc4c4b7d4e811 Martin KaFai Lau 2018-08-08 112 #ifdef CONFIG_INET
5dc4c4b7d4e811 Martin KaFai Lau 2018-08-08 113 BPF_MAP_TYPE(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, reuseport_array_ops)
5dc4c4b7d4e811 Martin KaFai Lau 2018-08-08 114 #endif
6bdc9c4c31c816 John Fastabend 2017-08-16 115 #endif
f1a2e44a3aeccb Mauricio Vasquez B 2018-10-18 116 BPF_MAP_TYPE(BPF_MAP_TYPE_QUEUE, queue_map_ops)
f1a2e44a3aeccb Mauricio Vasquez B 2018-10-18 117 BPF_MAP_TYPE(BPF_MAP_TYPE_STACK, stack_map_ops)
85d33df357b634 Martin KaFai Lau 2020-01-08 118 #if defined(CONFIG_BPF_JIT)
85d33df357b634 Martin KaFai Lau 2020-01-08 119 BPF_MAP_TYPE(BPF_MAP_TYPE_STRUCT_OPS, bpf_struct_ops_map_ops)
85d33df357b634 Martin KaFai Lau 2020-01-08 @120 #endif
:::::: The code at line 120 was first introduced by commit
:::::: 85d33df357b634649ddbe0a20fd2d0fc5732c3cb bpf: Introduce BPF_MAP_TYPE_STRUCT_OPS
:::::: TO: Martin KaFai Lau <kafai@fb.com>
:::::: CC: Alexei Starovoitov <ast@kernel.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52604 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL
2020-04-22 8:30 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL Mao Wenan
2020-04-22 9:33 ` Dan Carpenter
2020-04-24 5:10 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL kbuild test robot
@ 2020-04-30 2:04 ` kbuild test robot
2 siblings, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2020-04-30 2:04 UTC (permalink / raw)
To: Mao Wenan, ast, daniel, kafai, songliubraving, yhs, andriin,
john.fastabend, kpsingh
Cc: kbuild-all, netdev, bpf, linux-kernel, kernel-janitors
Hi Mao,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on bpf-next/master]
[also build test WARNING on bpf/master net/master net-next/master ipvs/master v5.7-rc2 next-20200423]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Mao-Wenan/Change-return-code-if-failed-to-load-object/20200424-025339
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-191-gc51a0382-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> kernel/bpf/syscall.c:117:0: sparse: sparse: missing terminating " character
kernel/bpf/syscall.c:118:0: sparse: sparse: missing terminating " character
>> kernel/bpf/syscall.c:686:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:772:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:979:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1046:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1111:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1164:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1341:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1442:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1504:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1548:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1550:1: sparse: sparse: directive in macro's argument list
kernel/bpf/syscall.c:1551:1: sparse: sparse: directive in macro's argument list
>> kernel/bpf/syscall.c:116:17: sparse: sparse: macro "pr_warn" passed 2 arguments, but takes just 2
>> include/linux/bpf_types.h:7:1: sparse: sparse: No right hand side of ','-expression
include/linux/bpf_types.h:7:1: sparse: sparse: Expected ; at end of statement
include/linux/bpf_types.h:7:1: sparse: sparse: got [
include/linux/bpf_types.h:121:0: sparse: sparse: Expected } at end of compound statement
include/linux/bpf_types.h:121:0: sparse: sparse: got end-of-input
include/linux/bpf_types.h:121:0: sparse: sparse: Expected } at end of function
include/linux/bpf_types.h:121:0: sparse: sparse: got end-of-input
kernel/bpf/syscall.c:116:17: sparse: sparse: undefined identifier 'pr_warn'
kernel/bpf/syscall.c:1560:21: sparse: sparse: undefined identifier 'bpf_prog_types'
kernel/bpf/syscall.c:1560:21: sparse: sparse: undefined identifier 'bpf_prog_types'
kernel/bpf/syscall.c:1562:16: sparse: sparse: undefined identifier 'bpf_prog_types'
kernel/bpf/syscall.c:1562:16: sparse: sparse: undefined identifier 'bpf_prog_types'
kernel/bpf/syscall.c:1562:16: sparse: sparse: undefined identifier 'bpf_prog_types'
kernel/bpf/syscall.c:1562:16: sparse: sparse: undefined identifier 'bpf_prog_types'
>> kernel/bpf/syscall.c:1562:16: sparse: sparse: cannot size expression
kernel/bpf/syscall.c:1563:15: sparse: sparse: undefined identifier 'bpf_prog_types'
kernel/bpf/syscall.c:1797:27: sparse: sparse: undefined identifier 'bpf_dummy_read'
kernel/bpf/syscall.c:1798:27: sparse: sparse: undefined identifier 'bpf_dummy_write'
kernel/bpf/syscall.c:2293:27: sparse: sparse: undefined identifier 'bpf_dummy_read'
kernel/bpf/syscall.c:2294:27: sparse: sparse: undefined identifier 'bpf_dummy_write'
kernel/bpf/syscall.c:2870:23: sparse: sparse: undefined identifier '__bpf_map_inc_not_zero'
kernel/bpf/syscall.c:3538:15: sparse: sparse: undefined identifier 'map_get_sys_perms'
kernel/bpf/syscall.c:3544:15: sparse: sparse: undefined identifier 'map_get_sys_perms'
kernel/bpf/syscall.c:3685:23: sparse: sparse: undefined identifier 'map_create'
kernel/bpf/syscall.c:3688:23: sparse: sparse: undefined identifier 'map_lookup_elem'
kernel/bpf/syscall.c:3691:23: sparse: sparse: undefined identifier 'map_update_elem'
kernel/bpf/syscall.c:3694:23: sparse: sparse: undefined identifier 'map_delete_elem'
kernel/bpf/syscall.c:3697:23: sparse: sparse: undefined identifier 'map_get_next_key'
kernel/bpf/syscall.c:3700:23: sparse: sparse: undefined identifier 'map_freeze'
kernel/bpf/syscall.c:3757:23: sparse: sparse: undefined identifier 'map_lookup_and_delete_elem'
# https://github.com/0day-ci/linux/commit/45c88e856945c443c39e3f519ad9740b8e487d8d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 45c88e856945c443c39e3f519ad9740b8e487d8d
vim +117 kernel/bpf/syscall.c
a38845729ea398 Jakub Kicinski 2018-01-11 103
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 104 static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 105 {
1110f3a9bcf394 Jakub Kicinski 2018-01-11 106 const struct bpf_map_ops *ops;
9ef09e35e521bf Mark Rutland 2018-05-03 107 u32 type = attr->map_type;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 108 struct bpf_map *map;
1110f3a9bcf394 Jakub Kicinski 2018-01-11 109 int err;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 110
9ef09e35e521bf Mark Rutland 2018-05-03 111 if (type >= ARRAY_SIZE(bpf_map_types))
1110f3a9bcf394 Jakub Kicinski 2018-01-11 112 return ERR_PTR(-EINVAL);
9ef09e35e521bf Mark Rutland 2018-05-03 113 type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
9ef09e35e521bf Mark Rutland 2018-05-03 114 ops = bpf_map_types[type];
45c88e856945c4 Mao Wenan 2020-04-22 115 if (!ops) {
45c88e856945c4 Mao Wenan 2020-04-22 @116 pr_warn("map type %d not supported or
45c88e856945c4 Mao Wenan 2020-04-22 @117 kernel config not opened\n", type);
45c88e856945c4 Mao Wenan 2020-04-22 118 return ERR_PTR(-EOPNOTSUPP);
45c88e856945c4 Mao Wenan 2020-04-22 119 }
1110f3a9bcf394 Jakub Kicinski 2018-01-11 120 if (ops->map_alloc_check) {
1110f3a9bcf394 Jakub Kicinski 2018-01-11 121 err = ops->map_alloc_check(attr);
1110f3a9bcf394 Jakub Kicinski 2018-01-11 122 if (err)
1110f3a9bcf394 Jakub Kicinski 2018-01-11 123 return ERR_PTR(err);
1110f3a9bcf394 Jakub Kicinski 2018-01-11 124 }
a38845729ea398 Jakub Kicinski 2018-01-11 125 if (attr->map_ifindex)
a38845729ea398 Jakub Kicinski 2018-01-11 126 ops = &bpf_map_offload_ops;
1110f3a9bcf394 Jakub Kicinski 2018-01-11 127 map = ops->map_alloc(attr);
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 128 if (IS_ERR(map))
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 129 return map;
1110f3a9bcf394 Jakub Kicinski 2018-01-11 130 map->ops = ops;
9ef09e35e521bf Mark Rutland 2018-05-03 131 map->map_type = type;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 132 return map;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 133 }
99c55f7d47c0dc Alexei Starovoitov 2014-09-26 134
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2020-04-30 1:54 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 8:30 [PATCH bpf-next 0/2] Change return code if failed to load object Mao Wenan
2020-04-22 8:30 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL Mao Wenan
2020-04-22 9:33 ` Dan Carpenter
2020-04-23 3:33 ` [PATCH bpf-next v2 0/2] Change return code if failed to load object Mao Wenan
2020-04-23 3:33 ` [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL Mao Wenan
2020-04-23 5:43 ` Alexei Starovoitov
2020-04-23 6:25 ` maowenan
2020-04-23 16:07 ` Alexei Starovoitov
2020-04-24 1:13 ` maowenan
2020-04-23 3:33 ` [PATCH bpf-next v2 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
2020-04-24 5:10 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL kbuild test robot
2020-04-30 2:04 ` kbuild test robot
2020-04-22 8:30 ` [PATCH bpf-next 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
2020-04-22 23:27 ` Andrii Nakryiko
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).