lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200422093329.GI2659@kadam>
Date:   Wed, 22 Apr 2020 12:33:29 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Mao Wenan <maowenan@...wei.com>
Cc:     ast@...nel.org, daniel@...earbox.net, kafai@...com,
        songliubraving@...com, yhs@...com, andriin@...com,
        john.fastabend@...il.com, kpsingh@...omium.org,
        netdev@...r.kernel.org, bpf@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL

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@...wei.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ