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]
Date:   Wed, 20 Mar 2019 19:01:28 +0000
From:   Quentin Monnet <quentin.monnet@...ronome.com>
To:     Alban Crequy <alban.crequy@...il.com>, ast@...nel.org,
        daniel@...earbox.net
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        alban@...volk.io, iago@...volk.io
Subject: Re: [PATCH bpf-next v1 7/7] tools: bpftool: add error message on map
 pinning failure

2019-03-20 18:33 UTC+0100 ~ Alban Crequy <alban.crequy@...il.com>
> From: Alban Crequy <alban@...volk.io>
> 
> Symptoms, when "dir" does not exist:
> 
> $ sudo bpftool map create /sys/fs/bpf/dir/fooB type hash key 8 value 8 entries 8 name fooB flags 1
> $ echo $?
> 255
> 
> This patch prints an error message when the map pinning fails.
> 
> Signed-off-by: Alban Crequy <alban@...volk.io>
> ---
>  tools/bpf/bpftool/map.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index 9befcabc299d..c825eb1bbf8f 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -1305,8 +1305,10 @@ static int do_create(int argc, char **argv)
>  
>  	err = do_pin_fd(fd, pinfile);
>  	close(fd);
> -	if (err)
> +	if (err) {
> +		p_err("failed to pin map to %s", pinfile);
>  		return err;
> +	}

do_pin_fd() is already susceptible to print an error message, and this
may lead to several messages (thus breaking JSON output).

Instead, you could change do_pin_fd() to store the result from
bpf_obj_pin(), compare it, and print the message there if non-0.

>  
>  	if (json_output)
>  		jsonw_null(json_wtr);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ