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: <20190619101133.f5aa78eac7a1cce4c24ae802@kernel.org>
Date:   Wed, 19 Jun 2019 10:11:33 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
        Tom Zanussi <tom.zanussi@...ux.intel.com>,
        Ravi Bangoria <ravi.bangoria@...ux.ibm.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: Re: [PATCH 10/21] tracing/probe: Split trace_event related data
 from trace_probe

On Tue, 18 Jun 2019 12:23:22 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Wed, 19 Jun 2019 01:14:09 +0900
> Masami Hiramatsu <mhiramat@...nel.org> wrote:
> 
> > On Mon, 17 Jun 2019 21:56:43 -0400
> > Steven Rostedt <rostedt@...dmis.org> wrote:
> > 
> 
> > > > +static nokprobe_inline struct trace_kprobe *
> > > > +trace_kprobe_primary_from_call(struct trace_event_call *call)
> > > > +{
> > > > +	struct trace_probe *tp = trace_probe_primary_from_call(call);
> > > > +
> > > > +	return container_of(tp, struct trace_kprobe, tp);  
> > > 
> > > 
> > > Hmm, is there a possibility that trace_probe_primary_from_call() may
> > > not have a primary?  
> > 
> > Good question! Of course if given event_call is not a kprobe event,
> > it doesn't have primary (or any) trace_probe. But that must not happen
> > unless user misuses it.
> > And that list never be the empty, when the last trace probe is released,
> > the event_call also unregistered and released. See unregister_trace_kprobe()
> > for details. If there is no siblings on the list, the event_call is also
> > unregistered before unregistering kprobes, and after unregistering kprobes
> > the list is unlinked.
> >  (Note that unregister_kprobe() will wait a quiescence period
> > before return. This means all probe handlers are done before that.)
> 
> Yeah, I thought something like that. But perhaps the
> trace_probe_primary_from_call() code should add a WARN_ON() is the list
> is empty.

OK, I'll add that, and check in all callers.

> > > >  
> > > > -	ret = __enable_trace_kprobe(tk);
> > > > -	if (ret) {
> > > > +	enabled = false;
> > > > +	list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
> > > > +		tk = container_of(pos, struct trace_kprobe, tp);
> > > > +		ecode = __enable_trace_kprobe(tk);
> > > > +		if (ecode)
> > > > +			ret = ecode;	/* Save the last error code */
> > > > +		else
> > > > +			enabled = true;  
> > > 
> > > So, if we have some enabled but return an error code, what should a
> > > caller think of that? Wouldn't it be an inconsistent state?  
> > 
> > Oops, good catch!
> > This part is related to caller (ftrace/perf) so should be more careful.
> > Usually, kprobe enablement should not fail. If one of them has
> > gone (like a probe on unloaded module), it can be fail but that
> > should be ignored. I would like to add some additional check so that
> > - If all kprobes are on the module which is unloaded, enablement
> >   must be failed and return error.
> > - If any kprobe is enabled, and others are on non-exist modules,
> >   it should succeeded and return OK.
> > - If any kprobe caused an error not because of unloaded module,
> >   all other enablement should be canceled and return error.
> > 
> > Is that OK for you?
> > 
> 
> Sounds good to me.

Thank you!


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ