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:   Tue, 22 Mar 2022 23:25:15 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>,
        mhiramat@...nel.org, ast@...nel.org, hjl.tools@...il.com,
        rick.p.edgecombe@...el.com, rppt@...nel.org,
        linux-toolchains@...r.kernel.org, Andrew.Cooper3@...rix.com,
        ndesaulniers@...gle.com
Subject: Re: linux-next: build warnings after merge of the tip tree

On Mon, 21 Mar 2022 12:12:09 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Mon, 21 Mar 2022 17:04:28 +0100
> Peter Zijlstra <peterz@...radead.org> wrote:
> 
> > On Mon, Mar 21, 2022 at 11:28:05AM -0400, Steven Rostedt wrote:
> > > On Mon, 21 Mar 2022 14:04:05 +0100
> > > Peter Zijlstra <peterz@...radead.org> wrote:  
> > 
> > > > Also, folks, I'm thinking we should start to move to __fexit__, if CET
> > > > SHSTK ever wants to come to kernel land return trampolines will
> > > > insta-stop working.
> > > > 
> > > > Hjl, do you think we could get -mfexit to go along with -mfentry ?  
> > 
> > > int funcA () {
> > > 	[..]
> > > 	return funcB();
> > > }  
> > 
> > > This currently works with function graph and kretprobe tracing because of
> > > the shadow stack. Let's say we traced both funcA and funcB
> > > 
> > > funcA:
> > > 	call __fentry__  
> > 			push funcA on trace-stack
> > > 
> > > 	[..]
> > > 	jmp funcB
> > > 
> > > funcB:
> > > 	call __fentry__  
> > 			push funcB on trace-stack
> > > 
> > > 	[..]  
> > 	call __fexit__
> > 			pop trace-stack until empty

This seems wrong. We don't pop the trace-stack until empty, but we will
record the real stack pointer at funcA.

> > 			  'exit funcB'
> > 			  'exit funcA'
> 
> And what happens if funcC called funcA and it too was on the stack. We pop
> that too? But it's not done yet, because calling of funcA was not a tail
> call.

Thus when the funcC is called, the trace-stack will be poped until funcA,
because we can see the real stack pointer at the 'ret'.
So the funcC is still on the trace-stack after that.

Thank you,


> 
> -- Steve
> 
> 
> > 
> > > 	ret  
> > 
> > > 
> > > That is, the current algorithm traces the end of both funcA and funcB
> > > without issue, because of how the shadow stack works.  
> > 
> > And it all works, no? Or what am I missing?
> 
> 
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ