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:   Tue, 26 Apr 2022 11:26:21 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     menglong8.dong@...il.com
Cc:     ast@...nel.org, rostedt@...dmis.org, mingo@...hat.com,
        davem@...emloft.net, yoshfuji@...ux-ipv6.org, dsahern@...nel.org,
        kuba@...nel.org, pabeni@...hat.com, benbjiang@...cent.com,
        flyingpeng@...cent.com, imagedong@...cent.com, edumazet@...gle.com,
        kafai@...com, talalahmad@...gle.com, keescook@...omium.org,
        mengensun@...cent.com, dongli.zhang@...cle.com,
        linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] bpf: init map_btf_id during compiling

On Sun, Apr 24, 2022 at 05:26:13PM +0800, menglong8.dong@...il.com wrote:
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 0918a39279f6..588a001cc767 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -4727,30 +4727,6 @@ static const struct bpf_map_ops * const btf_vmlinux_map_ops[] = {
>  #undef BPF_MAP_TYPE
>  };
>  
> -static int btf_vmlinux_map_ids_init(const struct btf *btf,
> -				    struct bpf_verifier_log *log)
> -{
> -	const struct bpf_map_ops *ops;
> -	int i, btf_id;
> -
> -	for (i = 0; i < ARRAY_SIZE(btf_vmlinux_map_ops); ++i) {
> -		ops = btf_vmlinux_map_ops[i];
> -		if (!ops || (!ops->map_btf_name && !ops->map_btf_id))
> -			continue;
> -		if (!ops->map_btf_name || !ops->map_btf_id) {
> -			bpf_log(log, "map type %d is misconfigured\n", i);
> -			return -EINVAL;
> -		}
> -		btf_id = btf_find_by_name_kind(btf, ops->map_btf_name,
> -					       BTF_KIND_STRUCT);
> -		if (btf_id < 0)
> -			return btf_id;
> -		*ops->map_btf_id = btf_id;
> -	}
> -
> -	return 0;
> -}
> -
>  static int btf_translate_to_vmlinux(struct bpf_verifier_log *log,
>  				     struct btf *btf,
>  				     const struct btf_type *t,
> @@ -4812,11 +4788,6 @@ struct btf *btf_parse_vmlinux(void)
>  	/* btf_parse_vmlinux() runs under bpf_verifier_lock */
>  	bpf_ctx_convert.t = btf_type_by_id(btf, bpf_ctx_convert_btf_id[0]);
>  
> -	/* find bpf map structs for map_ptr access checking */
> -	err = btf_vmlinux_map_ids_init(btf, log);
> -	if (err < 0)
> -		goto errout;
> -

Looks nice. Please address build warn and resubmit.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ