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: <750db7bc-2cc5-4a53-8bb6-30e702fa0989@gmail.com>
Date: Wed, 28 Jan 2026 14:10:24 +0000
From: Mykyta Yatsenko <mykyta.yatsenko5@...il.com>
To: Feng Yang <yangfeng59949@....com>, ast@...nel.org, daniel@...earbox.net,
 andrii@...nel.org, martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
 yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
 sdf@...ichev.me, haoluo@...gle.com, jolsa@...nel.org
Cc: bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Add the missing types in the logs

On 1/28/26 08:58, Feng Yang wrote:
> From: Feng Yang <yangfeng@...inos.cn>
>
> Add the missing types to avoid such uninformative errors as shown below:
> R1 type=ptr_ expected=ptr_
>
> Signed-off-by: Feng Yang <yangfeng@...inos.cn>
> ---
>   kernel/bpf/log.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c
> index a0c3b35de2ce..6fee3d8b3703 100644
> --- a/kernel/bpf/log.c
> +++ b/kernel/bpf/log.c
> @@ -473,14 +473,26 @@ const char *reg_type_str(struct bpf_verifier_env *env, enum bpf_reg_type type)
>   			strscpy(postfix, "_or_null");
>   	}
>   
> -	snprintf(prefix, sizeof(prefix), "%s%s%s%s%s%s%s",
> +	snprintf(prefix, sizeof(prefix), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
>   		 type & MEM_RDONLY ? "rdonly_" : "",
>   		 type & MEM_RINGBUF ? "ringbuf_" : "",
>   		 type & MEM_USER ? "user_" : "",
>   		 type & MEM_PERCPU ? "percpu_" : "",
>   		 type & MEM_RCU ? "rcu_" : "",
>   		 type & PTR_UNTRUSTED ? "untrusted_" : "",
> -		 type & PTR_TRUSTED ? "trusted_" : ""
> +		 type & PTR_TRUSTED ? "trusted_" : "",
> +		 type & MEM_UNINIT ? "uninit_" : "",
> +		 type & DYNPTR_TYPE_LOCAL ? "dynptr_local_" : "",
> +		 type & DYNPTR_TYPE_RINGBUF ? "dynptr_ringbuf_" : "",
> +		 type & MEM_FIXED_SIZE ? "fixed_size_" : "",
> +		 type & MEM_ALLOC ? "alloc_" : "",
> +		 type & NON_OWN_REF ? "non_own_ref_" : "",
> +		 type & DYNPTR_TYPE_SKB ? "dynptr_skb_" : "",
> +		 type & DYNPTR_TYPE_XDP ? "dynptr_xdp_" : "",
> +		 type & MEM_ALIGNED ? "aligned_" : "",
> +		 type & MEM_WRITE ? "write_" : "",
> +		 type & DYNPTR_TYPE_SKB_META ? "dynptr_skb_meta_" : "",
> +		 type & DYNPTR_TYPE_FILE ? "dynptr_file_" : ""
>   	);
Maybe it'll be good to decrease the number of the %s
and also group up the strings, for example:
const char *dynptr_reg_type(...)
{
     if (type & DYNPTR_TYPE_SKB) return "dynptr_skb_"; if (type & 
DYNPTR_TYPE_XDP) return "dynptr_xdp_";} so later we can substitute 
multiple %s with just one, corresponding to the dynptr type, this also 
ensures dynptr type is always in the same place, relative to other 
things. This can also be applied to (MEM_RDONLY, MEM_WRITE), 
(PTR_TRUSTED, PTR_UNTRUSTED) and so on.
>   
>   	snprintf(env->tmp_str_buf, TMP_STR_BUF_LEN, "%s%s%s",


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ