Re: [PATCH bpf-next] bpftool: fix output for skipping kernel config check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2023-01-09 08:07 UTC+0530 ~ Chethan Suresh <chethan.suresh@xxxxxxxx>
> When bpftool feature does not find kernel config
> files under default path or wrong format,
> do not output CONFIG_XYZ is not set.
> Skip kernel config check and continue.
> 
> Signed-off-by: Chethan Suresh <chethan.suresh@xxxxxxxx>
> Signed-off-by: Kenta Tada <Kenta.Tada@xxxxxxxx>
> ---
>  tools/bpf/bpftool/feature.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c
> index 36cf0f1517c9..da16e6a27ccc 100644
> --- a/tools/bpf/bpftool/feature.c
> +++ b/tools/bpf/bpftool/feature.c
> @@ -486,16 +486,16 @@ static void probe_kernel_image_config(const char *define_prefix)
>  		}
>  	}
>  
> -end_parse:
> -	if (file)
> -		gzclose(file);
> -
>  	for (i = 0; i < ARRAY_SIZE(options); i++) {
>  		if (define_prefix && !options[i].macro_dump)
>  			continue;
>  		print_kernel_option(options[i].name, values[i], define_prefix);
>  		free(values[i]);
>  	}
> +
> +end_parse:
> +	if (file)
> +		gzclose(file);
>  }
>  
>  static bool probe_bpf_syscall(const char *define_prefix)

Thanks!

This will remove the output for the kernel config options in case the
config file is not found, including from the JSON output. I can't
remember the motivation for printing negative values in that case, at
the time. I'm somewhat concerned to see the JSON entries disappear when
the config file is missing. Ideally, we should have an alternative state
for when config file is not here; but even using a specific string in
that case could play badly with scripts expecting that the kconfig
option is set if the JSON probing output contains anything else than
'null' for that entry.

So I think we can go with this patch indeed, and see if anyone complains
about it. After all, this is consistent with what we do elsewhere: We
skip entirely most probes if BPF_SYSCALL is not set, or probes for
helpers related to unsupported program types.

Acked-by: Quentin Monnet <quentin@xxxxxxxxxxxxx>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux