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:   Thu, 21 Oct 2021 11:21:42 +0100
From:   Quentin Monnet <quentin@...valent.com>
To:     Stanislav Fomichev <sdf@...gle.com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org
Cc:     ast@...nel.org, daniel@...earbox.net, andrii@...nel.org
Subject: Re: [PATCH bpf-next v3 1/3] libbpf: use func name when pinning
 programs with LIBBPF_STRICT_SEC_NAME

2021-10-20 15:50 UTC-0700 ~ Stanislav Fomichev <sdf@...gle.com>
> We can't use section name anymore because they are not unique
> and pinning objects with multiple programs with the same
> progtype/secname will fail.
> 
> Closes: https://github.com/libbpf/libbpf/issues/273
> Fixes: 33a2c75c55e2 ("libbpf: add internal pin_name"0

s/0$/)/

> Cc: Quentin Monnet <quentin@...valent.com>
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> ---
>  tools/lib/bpf/libbpf.c        | 13 +++++++++++--
>  tools/lib/bpf/libbpf_legacy.h |  3 +++
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 760c7e346603..7f48eeb3ca82 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -285,7 +285,7 @@ struct bpf_program {
>  	size_t sub_insn_off;
>  
>  	char *name;
> -	/* sec_name with / replaced by _; makes recursive pinning
> +	/* name with / replaced by _; makes recursive pinning
>  	 * in bpf_object__pin_programs easier
>  	 */
>  	char *pin_name;
> @@ -614,7 +614,16 @@ static char *__bpf_program__pin_name(struct bpf_program *prog)
>  {
>  	char *name, *p;
>  
> -	name = p = strdup(prog->sec_name);
> +	if (libbpf_mode & LIBBPF_STRICT_SEC_NAME)
> +		name = strdup(prog->name);
> +	else
> +		name = strdup(prog->sec_name);
> +
> +	if (!name)
> +		return NULL;
> +
> +	p = name;
> +
>  	while ((p = strchr(p, '/')))
>  		*p = '_';
>  
> diff --git a/tools/lib/bpf/libbpf_legacy.h b/tools/lib/bpf/libbpf_legacy.h
> index 74e6f860f703..a51f34637442 100644
> --- a/tools/lib/bpf/libbpf_legacy.h
> +++ b/tools/lib/bpf/libbpf_legacy.h
> @@ -52,6 +52,9 @@ enum libbpf_strict_mode {
>  	 * allowed, with LIBBPF_STRICT_SEC_PREFIX this will become
>  	 * unrecognized by libbpf and would have to be just SEC("xdp") and
>  	 * SEC("xdp") and SEC("perf_event").
> +	 *
> +	 * Note, in this mode the program pin path will based on the

"will based" -> "will be based"

> +	 * function name instead of section name.
>  	 */
>  	LIBBPF_STRICT_SEC_NAME = 0x04,
>  
> 

Looks good otherwise
Reviewed-by: Quentin Monnet <quentin@...valent.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ