• Milton Miller's avatar
    powerpc/kexec: Fix memory corruption from unallocated slaves · 3d2cea73
    Milton Miller authored
    Commit 1fc711f7 (powerpc/kexec: Fix race
    in kexec shutdown) moved the write to signal the cpu had exited the kernel
    from before the transition to real mode in kexec_smp_wait to kexec_wait.
    
    Unfornately it missed that kexec_wait is used both by cpus leaving the
    kernel and by secondary slave cpus that were not allocated a paca for
    what ever reason -- they could be beyond nr_cpus or not described in
    the current device tree for whatever reason (for example, kexec-load
    was not refreshed after a cpu hotplug operation).  Cpus coming through
    that path they will write to paca[NR_CPUS] which is beyond the space
    allocated for the paca data and overwrite memory not allocated to pacas
    but very likely still real mode accessable).
    
    Move the write back to kexec_smp_wait, which is used only by cpus that
    found their paca, but after the transition to real mode.
    Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
    Cc: <stable@kernel.org> # (1fc711f7 was backported to 2.6.32)
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    3d2cea73
misc_64.S 13.5 KB