[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240913114114.GD19305@redhat.com>
Date: Fri, 13 Sep 2024 13:41:15 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Jiri Olsa <olsajiri@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
Martin KaFai Lau <kafai@...com>, Song Liu <songliubraving@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>, Hao Luo <haoluo@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCHv3 1/7] uprobe: Add support for session consumer
On 09/13, Jiri Olsa wrote:
>
> On Fri, Sep 13, 2024 at 12:57:51PM +0200, Oleg Nesterov wrote:
>
> > static void handler_chain(struct uprobe *uprobe, struct pt_regs *regs)
> > {
> > ...
> > struct return_instance *ri = NULL;
> > int push_idx = 0;
> >
> > list_for_each_entry_rcu(uc, &uprobe->consumers, cons_node, rcu_read_lock_trace_held()) {
> > __u64 cookie = 0;
> > int rc = 0;
> >
> > if (uc->handler)
> > rc = uc->handler(uc, regs, &cookie);
> >
> > remove &= rc;
> > has_consumers = true;
> >
> > if (!uc->ret_handler || rc == UPROBE_HANDLER_REMOVE || rc == 2)
> > continue;
> >
> > if (!ri)
> > ri = alloc_return_instance();
> >
> > // or, better if (rc = UPROBE_HANDLER_I_WANT_MY_COOKIE)
> > if (uc->handler))
> > ri = push_id_cookie(ri, push_idx++, uc->id, cookie);
> > }
> >
> > if (!ZERO_OR_NULL_PTR(ri)) {
>
> should we rather bail out right after we fail to allocate ri above?
I think handler_chain() should call all the ->handler's even if
kzalloc/krealloc fails.
This is close to what the current code does, all the ->handler's are
called even if then later prepare_uretprobe()->kmalloc() fails.
Oleg.
Powered by blists - more mailing lists