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: <d4a28883-2aff-42dd-afe4-c5a42447ed0e@linux.dev>
Date: Mon, 16 Jun 2025 16:34:59 +0800
From: Tao Chen <chen.dylane@...ux.dev>
To: Jiri Olsa <olsajiri@...il.com>
Cc: song@...nel.org, kpsingh@...nel.org, mattbobrowski@...gle.com,
 ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
 martin.lau@...ux.dev, eddyz87@...il.com, yonghong.song@...ux.dev,
 john.fastabend@...il.com, sdf@...ichev.me, haoluo@...gle.com,
 rostedt@...dmis.org, mhiramat@...nel.org, mathieu.desnoyers@...icios.com,
 bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next v2 2/2] bpf: Add show_fdinfo for kprobe_multi

在 2025/6/16 15:40, Jiri Olsa 写道:
> On Sun, Jun 15, 2025 at 11:05:14PM +0800, Tao Chen wrote:
>> Show kprobe_multi link info with fdinfo, the info as follows:
>>
>> link_type:	kprobe_multi
>> link_id:	3
>> prog_tag:	e8225cbcc9cdffef
>> prog_id:	29
>> type:	kprobe_multi
>> kprobe_cnt:	8
>> missed:	0
>> func:	bpf_fentry_test1+0x0/0x20
>> cookie:	1
>> func:	bpf_fentry_test2+0x0/0x20
>> cookie:	7
>> func:	bpf_fentry_test3+0x0/0x20
>> cookie:	2
>> func:	bpf_fentry_test4+0x0/0x20
>> cookie:	3
>> func:	bpf_fentry_test5+0x0/0x20
>> cookie:	4
>> func:	bpf_fentry_test6+0x0/0x20
>> cookie:	5
>> func:	bpf_fentry_test7+0x0/0x20
>> cookie:	6
>> func:	bpf_fentry_test8+0x0/0x10
>> cookie:	8
>>
>> Signed-off-by: Tao Chen <chen.dylane@...ux.dev>
>> ---
>>   kernel/trace/bpf_trace.c | 33 +++++++++++++++++++++++++++++++++
>>   1 file changed, 33 insertions(+)
>>
>> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
>> index 9a8ca8a8e2b..d060c61e4e4 100644
>> --- a/kernel/trace/bpf_trace.c
>> +++ b/kernel/trace/bpf_trace.c
>> @@ -2623,10 +2623,43 @@ static int bpf_kprobe_multi_link_fill_link_info(const struct bpf_link *link,
>>   	return err;
>>   }
>>   
>> +#ifdef CONFIG_PROC_FS
>> +static void bpf_kprobe_multi_show_fdinfo(const struct bpf_link *link,
>> +					 struct seq_file *seq)
>> +{
>> +	struct bpf_kprobe_multi_link *kmulti_link;
>> +	char sym[KSYM_NAME_LEN];
>> +
>> +	kmulti_link = container_of(link, struct bpf_kprobe_multi_link, link);
>> +
>> +	seq_printf(seq,
>> +		   "type:\t%s\n"
>> +		   "kprobe_cnt:\t%u\n"
>> +		   "missed:\t%lu\n",
>> +		   kmulti_link->flags == BPF_F_KPROBE_MULTI_RETURN ? "kretprobe_multi" :
>> +					 "kprobe_multi",
>> +		   kmulti_link->cnt,
>> +		   kmulti_link->fp.nmissed);
>> +
>> +	for (int i = 0; i < kmulti_link->cnt; i++) {
>> +		sprint_symbol(sym, kmulti_link->addrs[i]);
> 
> I think you could use specifier to do the translation for you,
> check Documentation/core-api/printk-formats.rst:
> 
>          %pS     versatile_init+0x0/0x110 [module_name]
> 

I'll refer to that, thanks!

> 
> 
>> +		seq_printf(seq,
>> +			  "func:\t%s\n"
>> +			  "cookie:\t%llu\n",
>> +			  sym,
>> +			  kmulti_link->cookies[i]
>> +			  );
> 
> bracket should be on the previous line
> 

will fix it in v3, thanks.

> jirka
> 
> 
>> +	}
>> +}
>> +#endif
>> +
>>   static const struct bpf_link_ops bpf_kprobe_multi_link_lops = {
>>   	.release = bpf_kprobe_multi_link_release,
>>   	.dealloc_deferred = bpf_kprobe_multi_link_dealloc,
>>   	.fill_link_info = bpf_kprobe_multi_link_fill_link_info,
>> +#ifdef CONFIG_PROC_FS
>> +	.show_fdinfo = bpf_kprobe_multi_show_fdinfo,
>> +#endif
>>   };
>>   
>>   static void bpf_kprobe_multi_cookie_swap(void *a, void *b, int size, const void *priv)
>> -- 
>> 2.48.1
>>


-- 
Best Regards
Tao Chen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ