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: <48e85d82-e5c7-463a-aef3-f1ecbe863524@linux.dev>
Date: Tue, 3 Jun 2025 07:52:16 -0700
From: Yonghong Song <yonghong.song@...ux.dev>
To: Tao Chen <chen.dylane@...ux.dev>, ast@...nel.org, daniel@...earbox.net,
 andrii@...nel.org, martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
 john.fastabend@...il.com, kpsingh@...nel.org, sdf@...ichev.me,
 qmo@...nel.org, jolsa@...nel.org
Cc: bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next v2 1/3] bpf: Add cookie to raw_tp bpf_link_info



On 6/2/25 7:26 PM, Tao Chen wrote:
> After commit 68ca5d4eebb8 ("bpf: support BPF cookie in raw tracepoint
> (raw_tp, tp_btf) programs"), we can show the cookie in bpf_link_info
> like kprobe etc.
>
> Signed-off-by: Tao Chen <chen.dylane@...ux.dev>
> ---
>   include/uapi/linux/bpf.h       | 2 ++
>   kernel/bpf/syscall.c           | 1 +
>   tools/include/uapi/linux/bpf.h | 2 ++
>   3 files changed, 5 insertions(+)
>
> Change list:
> - v1 -> v2:
>      - fill the hole in bpf_link_info.(Jiri)
> - v1:
>      https://lore.kernel.org/bpf/20250529165759.2536245-1-chen.dylane@linux.dev
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 07ee73cdf9..f3e2aae302 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -6644,6 +6644,8 @@ struct bpf_link_info {
>   		struct {
>   			__aligned_u64 tp_name; /* in/out: tp_name buffer ptr */
>   			__u32 tp_name_len;     /* in/out: tp_name buffer len */
> +			__u32 reserved; /* just fill the hole */

See various examples in uapi/linux/bpf.h, '__u32 :32;' is the preferred
apporach to fill the hole.

> +			__u64 cookie;
>   		} raw_tracepoint;
>   		struct {
>   			__u32 attach_type;
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 9794446bc8..1c3dbe44ac 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -3687,6 +3687,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link,
>   		return -EINVAL;
>   
>   	info->raw_tracepoint.tp_name_len = tp_len + 1;
> +	info->raw_tracepoint.cookie = raw_tp_link->cookie;
>   
>   	if (!ubuf)
>   		return 0;
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index 07ee73cdf9..f3e2aae302 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -6644,6 +6644,8 @@ struct bpf_link_info {
>   		struct {
>   			__aligned_u64 tp_name; /* in/out: tp_name buffer ptr */
>   			__u32 tp_name_len;     /* in/out: tp_name buffer len */
> +			__u32 reserved; /* just fill the hole */
> +			__u64 cookie;
>   		} raw_tracepoint;
>   		struct {
>   			__u32 attach_type;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ