Re: [lockdep] b09be676e0 BUG: unable to handle kernel NULL pointer dereference at 000001f2
From: Linus Torvalds
Date: Wed Oct 04 2017 - 17:30:49 EST
On Wed, Oct 4, 2017 at 2:06 PM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> I compiled the same kernel with a similar version of GCC. It turns out
> that GCC *does* create unaligned stacks with frame pointers enabled:
Christ. What a piece of crap.
It doesn't even seem to make any sense. Spill room for the "u16
item_count" and "u8 move_type"?
That function is disgusting anyway (the switch really should be
outside the loop, not inside it), but whatever. No excuse for that
kind of garbage code generation.
> This was a leaf function. For no apparent reason, GCC 4.8 decided to
> subtract 3 from the stack pointer in the prologue.
Can you make objtool warn about unaligned stack pointer additions like that?
Maybe it only happens in very limited cases, and we can find a pattern
to why gcc generates garbage code like that? And perhaps even how to
just avoid it?