Messages in this thread | | | Date | Tue, 13 Dec 2016 08:34:55 -0600 | From | Josh Poimboeuf <> | Subject | Re: WARNING: kernel stack frame pointer at ffffffff82e03f40 in swapper:0 has bad value (null) |
| |
On Mon, Dec 12, 2016 at 05:05:11PM -0600, Josh Poimboeuf wrote: > On Mon, Dec 12, 2016 at 11:33:54PM +0100, Borislav Petkov wrote: > > On Mon, Dec 12, 2016 at 04:11:47PM -0600, Josh Poimboeuf wrote: > > > Yes, please. > > > > Attached. > > Thanks, I was able to recreate. Will take a look tomorrow.
Figured it out. Your config has CONFIG_PARAVIRT=n, which convinces gcc to create the following preamble for x86_64_start_kernel():
0000000000000124 <x86_64_start_kernel>: 124: 4c 8d 54 24 08 lea 0x8(%rsp),%r10 129: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp 12d: 41 ff 72 f8 pushq -0x8(%r10) 131: 55 push %rbp 132: 48 89 e5 mov %rsp,%rbp
It's an unusual pattern which aligns rsp (though in this case it's already aligned) and saves the start_cpu() return address again on the stack before storing the frame pointer.
The unwinder assumes the last stack frame header is at a certain offset, but the above code breaks that assumption. I still need to think about the best way to fix it.
-- Josh
| |