Re: [PATCH v2 bpf-next 3/5] bpf: support BPF cookie in raw tracepoint (raw_tp, tp_btf) programs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 19, 2024 at 11:19:08AM +0200, Eduard Zingerman wrote:
> On Mon, 2024-03-18 at 11:40 -0700, Andrii Nakryiko wrote:
> 
> [...]
> 
> > @@ -2373,15 +2378,23 @@ static __always_inline
> >  void __bpf_trace_run(struct bpf_raw_tp_link *link, u64 *args)
> >  {
> >  	struct bpf_prog *prog = link->link.prog;
> > +	struct bpf_run_ctx *old_run_ctx;
> > +	struct bpf_trace_run_ctx run_ctx;
> 
> The struct bpf_trace_run_ctx has two fields: bpf_cookie, is_uprobe
> (there is also run_ctx but it's size is zero).
> The is_uprobe field is not set by the code below.
> Is it necessary to zero-init `run_ctx` variable?
> 

I think it's ok because the is_uprobe is used by kprobes/uprobes helpers
while here it's used for tp programs, so it won't be used

OTOH it might be cleaner to add special run ctx struct for tp programs,
(like bpf_tp_run_ctx) to avoid confusion.. but then we'd need new helper
version for bpf_get_attach_cookie.. perhaps just adding some explaining
comment will be fine

jirka




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux