Re: [PATCH] x86/asm/entry: fix stack return address retrieval in thunk

From: Linus Torvalds
Date: Tue May 17 2016 - 13:21:14 EST


On Tue, May 17, 2016 at 9:51 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> And did we only get this wrong in two places? That is, do we really
> know how little our brains really are?

Doing some grepping seems to imply that was it.

There's a fair number of cases in

arch/x86/crypto/aesni-intel_asm.S

but they actually use the proper FRAME_OFFSET.

Here's my grep pattern:

git grep -Elw 'FRAME_((BEGIN)|(END))' |
xargs grep --color=always -E
'(FRAME_((BEGIN)|(END)))|(\(.*%[er]sp.*\))' |
less -SFRX

I'm not going to guarantee anything, but both
arch/x86/entry/thunk_64.S and arch/x86/platform/efi/efi_stub_64.S
stood out with this grep as having stack pointer accesses between a
FRAME_BEGIN and FRAME_END, so at least that pattern ends up finding
the two known problem cases.

Yeah, I know, I should have used 'awk' for this. Sue me. It's been too
long since I did awk state machines. There's a reason there's a "git
grep" but not a "git awk" command.

Linus