Re: [PATCH v3 15/51] x86/asm/head: standardize the end of the stack for idle tasks

From: Andy Lutomirski
Date: Sun Aug 14 2016 - 04:39:30 EST


On Fri, Aug 12, 2016 at 7:28 AM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> Thanks to all the recent x86 entry code refactoring, most tasks' kernel
> stacks start at the same offset right above their saved pt_regs,
> regardless of which syscall was used to enter the kernel. That creates
> a nice convention which makes it straightforward to identify the end of
> the stack, which can be useful for stack walking code which needs to
> verify the stack is sane.
>
> However, the boot CPU's idle "swapper" task doesn't follow that
> convention. Fix that by starting its stack at a sizeof(pt_regs) offset
> from the end of the stack page.
>

I think this is an improvement. If you want to be fancy, from memory
it might be nice to poke -1 into the orig_ax slot, but this doesn't
matter much.

--Andy