Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-08 Thread Peter Zijlstra
On Fri, Jul 05, 2024 at 03:38:12PM +0200, Jiri Olsa wrote: > > Agreed. BTW, even if the uprobe is removed, the ret_handler should be > > called? > > I think both 1 and 2 case, we should skip ret_handler. > > do you mean what happens when the uretprobe is installed and its consumer > is unregiste

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-05 Thread Kees Cook
On Fri, Jul 05, 2024 at 09:10:36AM +0200, Peter Zijlstra wrote: > On Wed, Jul 03, 2024 at 01:36:19PM -0700, Kees Cook wrote: > > > Yes, please use struct_size_t(). This is exactly what it was designed for. > > Kees, please, just let up, not going to happen. I'm getting really fed > up having to e

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-05 Thread Jiri Olsa
On Fri, Jul 05, 2024 at 05:35:44PM +0900, Masami Hiramatsu wrote: SNIP > > > > > Also, if we can set session enabled by default, and skip ret_handler > > > > > by handler's > > > > > return value, it is more simpler. (If handler returns a specific > > > > > value, skip ret_handler) > > > > > >

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-05 Thread Jiri Olsa
On Wed, Jul 03, 2024 at 02:48:28PM -0700, Andrii Nakryiko wrote: > On Wed, Jul 3, 2024 at 10:13 AM Jiri Olsa wrote: > > > > On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: > > > > SNIP > > > > > > #ifdef CONFIG_UPROBES > > > > @@ -80,6 +83,12 @@ struct uprobe_task { > > > >

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-05 Thread Google
On Wed, 3 Jul 2024 14:43:27 -0700 Andrii Nakryiko wrote: > On Wed, Jul 3, 2024 at 9:09 AM Jiri Olsa wrote: > > > > On Tue, Jul 02, 2024 at 05:13:38PM -0700, Andrii Nakryiko wrote: > > > On Tue, Jul 2, 2024 at 4:55 PM Masami Hiramatsu > > > wrote: > > > > > > > > Hi Jiri, > > > > > > > > On Mon

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-05 Thread Peter Zijlstra
On Wed, Jul 03, 2024 at 01:36:19PM -0700, Kees Cook wrote: > Yes, please use struct_size_t(). This is exactly what it was designed for. Kees, please, just let up, not going to happen. I'm getting really fed up having to endlessly repeat what a piece of shite struct_size() is. Put your time and e

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Andrii Nakryiko
On Wed, Jul 3, 2024 at 10:13 AM Jiri Olsa wrote: > > On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: > > SNIP > > > > #ifdef CONFIG_UPROBES > > > @@ -80,6 +83,12 @@ struct uprobe_task { > > > unsigned intdepth; > > > }; > > > > > > +struct session_con

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Andrii Nakryiko
On Wed, Jul 3, 2024 at 9:09 AM Jiri Olsa wrote: > > On Tue, Jul 02, 2024 at 05:13:38PM -0700, Andrii Nakryiko wrote: > > On Tue, Jul 2, 2024 at 4:55 PM Masami Hiramatsu wrote: > > > > > > Hi Jiri, > > > > > > On Mon, 1 Jul 2024 18:41:07 +0200 > > > Jiri Olsa wrote: > > > > > > > Adding support

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Andrii Nakryiko
On Wed, Jul 3, 2024 at 8:31 AM Jiri Olsa wrote: > > On Tue, Jul 02, 2024 at 01:52:38PM -0700, Andrii Nakryiko wrote: > > On Tue, Jul 2, 2024 at 9:11 AM Jiri Olsa wrote: > > > > > > On Tue, Jul 02, 2024 at 03:04:08PM +0200, Peter Zijlstra wrote: > > > > On Mon, Jul 01, 2024 at 06:41:07PM +0200, Ji

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Kees Cook
On Wed, Jul 03, 2024 at 11:31:11AM -0700, Andrii Nakryiko wrote: > On Wed, Jul 3, 2024 at 1:10 AM Peter Zijlstra wrote: > > > > On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: > > > > +static size_t ri_size(int sessions_cnt) > > > > +{ > > > > + struct return_instance *ri __

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Andrii Nakryiko
On Wed, Jul 3, 2024 at 1:10 AM Peter Zijlstra wrote: > > On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: > > > +static size_t ri_size(int sessions_cnt) > > > +{ > > > + struct return_instance *ri __maybe_unused; > > > + > > > + return sizeof(*ri) + sessions_cnt * sizeo

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: SNIP > > #ifdef CONFIG_UPROBES > > @@ -80,6 +83,12 @@ struct uprobe_task { > > unsigned intdepth; > > }; > > > > +struct session_consumer { > > + __u64 cookie; > > + unsigned int

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Jiri Olsa
On Wed, Jul 03, 2024 at 05:31:32PM +0200, Jiri Olsa wrote: > On Tue, Jul 02, 2024 at 01:52:38PM -0700, Andrii Nakryiko wrote: > > On Tue, Jul 2, 2024 at 9:11 AM Jiri Olsa wrote: > > > > > > On Tue, Jul 02, 2024 at 03:04:08PM +0200, Peter Zijlstra wrote: > > > > On Mon, Jul 01, 2024 at 06:41:07PM +

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 05:13:38PM -0700, Andrii Nakryiko wrote: > On Tue, Jul 2, 2024 at 4:55 PM Masami Hiramatsu wrote: > > > > Hi Jiri, > > > > On Mon, 1 Jul 2024 18:41:07 +0200 > > Jiri Olsa wrote: > > > > > Adding support for uprobe consumer to be defined as session and have > > > new behav

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 01:52:38PM -0700, Andrii Nakryiko wrote: > On Tue, Jul 2, 2024 at 9:11 AM Jiri Olsa wrote: > > > > On Tue, Jul 02, 2024 at 03:04:08PM +0200, Peter Zijlstra wrote: > > > On Mon, Jul 01, 2024 at 06:41:07PM +0200, Jiri Olsa wrote: > > > > > > > +static void > > > > +uprobe_con

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Peter Zijlstra
On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: > > +static size_t ri_size(int sessions_cnt) > > +{ > > + struct return_instance *ri __maybe_unused; > > + > > + return sizeof(*ri) + sessions_cnt * sizeof(ri->sessions[0]); > > just use struct_size()? Yeah, lets not. Th

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-02 Thread Andrii Nakryiko
On Tue, Jul 2, 2024 at 4:55 PM Masami Hiramatsu wrote: > > Hi Jiri, > > On Mon, 1 Jul 2024 18:41:07 +0200 > Jiri Olsa wrote: > > > Adding support for uprobe consumer to be defined as session and have > > new behaviour for consumer's 'handler' and 'ret_handler' callbacks. > > > > The session mean

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-02 Thread Google
Hi Jiri, On Mon, 1 Jul 2024 18:41:07 +0200 Jiri Olsa wrote: > Adding support for uprobe consumer to be defined as session and have > new behaviour for consumer's 'handler' and 'ret_handler' callbacks. > > The session means that 'handler' and 'ret_handler' callbacks are > connected in a way tha

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-02 Thread Andrii Nakryiko
On Tue, Jul 2, 2024 at 9:11 AM Jiri Olsa wrote: > > On Tue, Jul 02, 2024 at 03:04:08PM +0200, Peter Zijlstra wrote: > > On Mon, Jul 01, 2024 at 06:41:07PM +0200, Jiri Olsa wrote: > > > > > +static void > > > +uprobe_consumer_account(struct uprobe *uprobe, struct uprobe_consumer > > > *uc) > > > +

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-02 Thread Andrii Nakryiko
On Mon, Jul 1, 2024 at 9:41 AM Jiri Olsa wrote: > > Adding support for uprobe consumer to be defined as session and have > new behaviour for consumer's 'handler' and 'ret_handler' callbacks. > > The session means that 'handler' and 'ret_handler' callbacks are > connected in a way that allows to: >

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-02 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 03:04:08PM +0200, Peter Zijlstra wrote: > On Mon, Jul 01, 2024 at 06:41:07PM +0200, Jiri Olsa wrote: > > > +static void > > +uprobe_consumer_account(struct uprobe *uprobe, struct uprobe_consumer *uc) > > +{ > > + static unsigned int session_id; > > + > > + if (uc->sessi

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-02 Thread Peter Zijlstra
On Mon, Jul 01, 2024 at 06:41:07PM +0200, Jiri Olsa wrote: > +static void > +uprobe_consumer_account(struct uprobe *uprobe, struct uprobe_consumer *uc) > +{ > + static unsigned int session_id; > + > + if (uc->session) { > + uprobe->sessions_cnt++; > + uc->session_id

[PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-01 Thread Jiri Olsa
Adding support for uprobe consumer to be defined as session and have new behaviour for consumer's 'handler' and 'ret_handler' callbacks. The session means that 'handler' and 'ret_handler' callbacks are connected in a way that allows to: - control execution of 'ret_handler' from 'handler' callba