Re: [PATCH 02/16] x86/dumpstack: Add get_stack_info() support for the SYSENTER stack

From: Josh Poimboeuf
Date: Mon Nov 20 2017 - 16:27:44 EST


On Mon, Nov 20, 2017 at 01:07:16PM -0800, Andy Lutomirski wrote:
> >> but, more importantly, the OOPS unwinder will just bail without this
> >> patch. With the patch, we get a valid unwind, except that everything
> >> has a ? in front.
> >
> > Hm. I can't even fathom how that's possible. Are you talking about the
> > "unwind from NMI to SYSENTER stack" path? Or any unwind to a syscall?
> > Either way I'm baffled... If the unwinder only encounters the SYSENTER
> > stack at the end, how could that cause everything beforehand to have a
> > question mark?
>
> I mean that, if I put a ud2 or other bug in the code that runs on the
> SYSENTER stack, without this patch, I get a totally blank call trace.

I would expect a blank call trace either way...

In fact I just added a ud1 after your RDI save, and got a blank call
trace.

Also the RIP printout isn't very helpful, I guess kallsyms doesn't know
about the trampoline?

[ 2.816226] invalid opcode: 0000 [#10] PREEMPT SMP
[ 2.816968] Modules linked in:
[ 2.817097] CPU: 3 PID: 167 Comm: modprobe Tainted: G D W 4.14.0+ #6
[ 2.817097] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1.fc26 04/01/2014
[ 2.817097] task: ffff88013388c000 task.stack: ffffc9000119c000
[ 2.817097] RIP: 0010:0xffffffffff54a01f
[ 2.817097] RSP: 0018:ffffc9000119ffd0 EFLAGS: 00010046
[ 2.817097] RAX: 000000000000000c RBX: 0000000000000001 RCX: 00007f16fdcf1c89
[ 2.817097] RDX: 00007ffc0b80f030 RSI: 0000561065557480 RDI: 0000000000000000
[ 2.817097] RBP: 0000561065554040 R08: 0000000000000001 R09: 00007ffc0b80f059
[ 2.817097] R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000009
[ 2.817097] R13: 00007f16fdcd9190 R14: 0000000000000001 R15: 0000000000001000
[ 2.817097] FS: 0000000000000000(0000) GS:ffff88013ac00000(0000) knlGS:0000000000000000
[ 2.817097] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2.817097] CR2: 00007f16fdefe0c0 CR3: 0000000133c79004 CR4: 00000000001606e0
[ 2.817097] Call Trace:
[ 2.817097] Code: 00 00 00 00 00 00 00 00 00 00 00 00 0f 01 f8 48 89 25 f6 d1 ff ff 48 8b 25 03 d2 ff ff 6a 2b ff 35 e7 d1 ff ff 41 53 6a 33 51 57 <0f> b9 48 c7 c7 90 6f 92 81 ff e7 90 90 90 90 90 90 90 90 90 90
[ 2.817097] RIP: 0xffffffffff54a01f RSP: ffffc9000119ffd0
[ 2.817097] ---[ end trace 215b2a1d93232ed1 ]---

--
Josh