Open
Description
There is code in a/p/kexec/core_64.c:
/*
* kexec thread structure and stack.
*
* We need to make sure that this is 16384-byte aligned due to the
* way process stacks are handled. It also must be statically allocated
* or allocated as part of the kimage, because everything else may be
* overwritten when we copy the kexec image. We piggyback on the
* "init_task" linker section here to statically allocate a stack.
*
* We could use a smaller stack if we don't care about anything using
* current, but that audit has not been performed.
*/
static union thread_union kexec_stack __init_task_data =
{ };
But since commit torvalds/linux@d11ed3a the __init_task_data
macro has expanded to nothing on powerpc, because CONFIG_ARCH_TASK_STRUCT_ON_STACK is not set.
That means kexec_stack
is not 16K aligned:
$ grep kexec_stack .build/System.map
c000000002a86800 b kexec_stack
In practice it probably doesn't matter, and no one has reported any breakage.
With modern kernels the only thing that's found by doing arithmetic on the stack pointer is pt_regs, via current_pt_regs()
. That tends to only get used in ptrace and exec and so on, so is probably not called during the kexec sequence.
However it's still possible that bugs could be lurking due to the misaligned stack, so it should be properly aligned.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
🔖 Ready