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: <20211011144510.GE174703@worktop.programming.kicks-ass.net>
Date:   Mon, 11 Oct 2021 16:45:10 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     王贇 <yun.wang@...ux.alibaba.com>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>,
        open list <linux-kernel@...r.kernel.org>,
        Jiri Olsa <jolsa@...hat.com>
Subject: Re: [RESEND PATCH v2] trace: prevent preemption in
 perf_ftrace_function_call()

On Mon, Oct 11, 2021 at 05:39:32PM +0800, 王贇 wrote:
> 
> 
> On 2021/10/11 下午4:48, Peter Zijlstra wrote:
> > On Mon, Oct 11, 2021 at 10:32:46AM +0200, Peter Zijlstra wrote:
> >> diff --git a/include/linux/trace_recursion.h b/include/linux/trace_recursion.h
> >> index a9f9c5714e65..ca12e2d8e060 100644
> >> --- a/include/linux/trace_recursion.h
> >> +++ b/include/linux/trace_recursion.h
> >> @@ -214,7 +214,14 @@ static __always_inline void trace_clear_recursion(int bit)
> >>  static __always_inline int ftrace_test_recursion_trylock(unsigned long ip,
> >>  							 unsigned long parent_ip)
> >>  {
> >> -	return trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
> >> +	bool ret;
> >> +
> >> +	preempt_disable_notrace();
> >> +	ret = trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
> >> +	if (!ret)
> >> +		preempt_enable_notrace();
> >> +
> >> +	return ret;
> >>  }
> >>  
> >>  /**
> > 
> > Oh, I might've gotten that wrong, I assumed regular trylock semantics,
> > but it doesn't look like that's right.
> 
> I will use bit instead ret and give some testing :-)
> 
> BTW, would you prefer to merge these changes into this patch or maybe send
> another patch with your suggested-by?

Yeah, please send another patch; once you've confirmed it actually works
etc.. I did this before waking (as evidence per the above), who knows
what else I did wrong :-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ