• David Daney's avatar
    MIPS: Avoid clobbering struct pt_regs in kthreads · 484889fc
    David Daney authored
    The resume() implementation octeon_switch.S examines the saved cp0_status
    register.  We were clobbering the entire pt_regs structure in kernel
    threads leading to random crashes.
    
    When switching away from a kernel thread, the saved cp0_status is examined
    and if bit 30 is set it is cleared and the CP2 state saved into the pt_regs
    structure.  Since the kernel thread stack overlaid the pt_regs structure
    this resulted in a corrupt stack.  When the kthread with the corrupt stack
    was resumed, it could crash if it used any of the data in the stack that was
    clobbered.
    
    We fix it by moving the kernel thread stack down so it doesn't overlay
    pt_regs.
    Signed-off-by: default avatarDavid Daney <ddaney@caviumnetworks.com>
    Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    484889fc
head.S 5.85 KB