[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200523130836.GB2483@worktop.programming.kicks-ass.net>
Date: Sat, 23 May 2020 15:08:36 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Lai Jiangshan <jiangshanlai+lkml@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
"Paul E. McKenney" <paulmck@...nel.org>,
Andy Lutomirski <luto@...nel.org>,
Alexandre Chartre <alexandre.chartre@...cle.com>,
Frederic Weisbecker <frederic@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Joel Fernandes <joel@...lfernandes.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
Brian Gerst <brgerst@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Will Deacon <will@...nel.org>,
Tom Lendacky <thomas.lendacky@....com>,
Wei Liu <wei.liu@...nel.org>,
Michael Kelley <mikelley@...rosoft.com>,
Jason Chen CJ <jason.cj.chen@...el.com>,
Zhao Yakui <yakui.zhao@...el.com>
Subject: Re: [patch V6 00/37] x86/entry: Rework leftovers and merge plan
On Sat, May 23, 2020 at 10:52:24AM +0800, Lai Jiangshan wrote:
> Hello,
>
> I, who don't know how does the objtool handle it, am just curious.
> _begin() and _end() are symmetrical, which means if _end() (without nop)
> can escape, so can _begin() in a reverse way. For example:
>
> noinstr void foo()
> {
> instrumentation_begin();
> do {
> instrumentation_begin();
> ...
> instrumentation_end();
> } while (cond);
> bar();
> instrumentation_end();
> }
>
> Here, the first _begin() can be "dragged" into the do-while block.
> Expectedly, objtool validation should not complain here.
>
> But objtool validation's not complaining means it can handle it
> magically correctly (by distinguishing how many _begin()s should
> be taken around the jmp target when jmp in a specific path), or
> handle it by not checking if all paths have the same count onto
> a jmp target (a little nervous to me), or other possible ways.
No, I tihnk you're right. It could be we never hit this particular
problem. Even the one described, where end leaks out, is quite rare. For
instance, the last one I debgged (that led to this patch) only showed
itself with gcc-9, but not with gcc-8 for example.
Anyway, if we ever find the above, I'll add the NOP to begin too.
Powered by blists - more mailing lists