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]
Date:   Wed, 3 Feb 2021 12:23:54 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Ingo Molnar <mingo@...hat.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andriin@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        netdev <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Kees Cook <keescook@...omium.org>,
        Florian Weimer <fw@...eb.enyo.de>,
        syzbot+83aa762ef23b6f0d1991@...kaller.appspotmail.com,
        syzbot+d29e58bb557324e55e5e@...kaller.appspotmail.com,
        Matt Mullins <mmullins@...x.us>
Subject: Re: [for-next][PATCH 14/15] tracepoint: Do not fail unregistering a
 probe due to memory failure

On Wed, 3 Feb 2021 18:09:27 +0100
Peter Zijlstra <peterz@...radead.org> wrote:

> On Wed, Feb 03, 2021 at 11:05:31AM -0500, Steven Rostedt wrote:
> > +		if (new) {
> > +			for (i = 0; old[i].func; i++)
> > +				if ((old[i].func != tp_func->func
> > +				     || old[i].data != tp_func->data)
> > +				    && old[i].func != tp_stub_func)  
> 
> logical operators go at the end..

Agreed. I just added that "if (new) {" around the original block, didn't
think about the formatting when doing so.

> 
> > +					new[j++] = old[i];
> > +			new[nr_probes - nr_del].func = NULL;
> > +			*funcs = new;
> > +		} else {
> > +			/*
> > +			 * Failed to allocate, replace the old function
> > +			 * with calls to tp_stub_func.
> > +			 */
> > +			for (i = 0; old[i].func; i++)  
> 
> 							{
> 
> > +				if (old[i].func == tp_func->func &&
> > +				    old[i].data == tp_func->data) {  
> 
> like here.
> 
> > +					old[i].func = tp_stub_func;
> > +					/* Set the prio to the next event. */
> > +					if (old[i + 1].func)
> > +						old[i].prio =
> > +							old[i + 1].prio;  
> 
> multi line demands { }, but in this case just don't line-break.

Sure.

> 
> > +					else
> > +						old[i].prio = -1;
> > +				}  
> 
> 			}
> 
> > +			*funcs = old;
> > +		}
> >  	}
> >  	debug_print_probes(*funcs);
> >  	return old;
> > @@ -295,10 +341,12 @@ static int tracepoint_remove_func(struct tracepoint *tp,
> >  	tp_funcs = rcu_dereference_protected(tp->funcs,
> >  			lockdep_is_held(&tracepoints_mutex));
> >  	old = func_remove(&tp_funcs, func);
> > -	if (IS_ERR(old)) {
> > -		WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM);
> > +	if (WARN_ON_ONCE(IS_ERR(old)))
> >  		return PTR_ERR(old);
> > -	}
> > +
> > +	if (tp_funcs == old)
> > +		/* Failed allocating new tp_funcs, replaced func with stub */
> > +		return 0;  
> 
> { }

Even if it's just a comment that causes multiple lines? I could just move
the comment above the if.

This has already been through my test suite, and since the changes
requested are just formatting and non-functional, I'll just add a clean up
patch on top.

Thanks!

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ