[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+yzMmL7gUprDru3@hirez.programming.kicks-ass.net>
Date: Wed, 15 Feb 2023 11:25:54 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org,
Chen Zhongjin <chenzhongjin@...wei.com>,
"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 2/2] x86/entry: Fix unwinding from kprobe on PUSH/POP
instruction
On Tue, Feb 14, 2023 at 09:05:52AM -0800, Josh Poimboeuf wrote:
> On Tue, Feb 14, 2023 at 12:35:04PM +0100, Peter Zijlstra wrote:
> > On Mon, Feb 13, 2023 at 11:43:57PM +0900, Masami Hiramatsu wrote:
> >
> > > > Fix it by annotating the #BP exception as a non-signal stack frame,
> > > > which tells the ORC unwinder to decrement the instruction pointer before
> > > > looking up the corresponding ORC entry.
> > >
> > > Just to make it clear, this sounds like a 'hack' use of non-signal stack
> > > frame. If so, can we change the flag name as 'literal' or 'non-literal' etc?
> > > I concern that the 'signal' flag is used differently in the future.
>
> Agreed, though I'm having trouble coming up with a succinct yet
> scrutable name. If length wasn't an issue it would be something like
>
> "decrement_return_address_when_looking_up_the_next_orc_entry"
>
> > Oooh, bike-shed :-) Let me suggest trap=1, where a trap is a fault with
> > a different return address, specifically the instruction after the
> > faulting instruction.
>
> I think "trap" doesn't work because
>
> 1) It's more than just traps, it's also function calls. We have
> traps/calls in one bucket (decrement IP); and everything else
> (faults, aborts, irqs) in the other (don't decrement IP).
>
> 2) It's not necessarily all traps which need the flag, just those that
> affect a previously-but-now-overwritten stack-modifying instruction.
> So #OF (which we don't use?) and trap-class #DB don't seem to be
> affected. In practice maybe this distinction doesn't matter, but
> for example there's no reason for ORC try to distinguish trap #DB
> from non-trap #DB at runtime.
Well, I was specifically thinking about #DB, why don't we need to
decrement when we put a hardware breakpoint on a stack modifying op?
Powered by blists - more mailing lists