• James Hogan's avatar
    MIPS: c-r4k: Fix sigtramp SMP call to use kmap · e523f289
    James Hogan authored
    Fix r4k_flush_cache_sigtramp() and local_r4k_flush_cache_sigtramp() to
    flush the delay slot emulation trampoline cacheline through a kmap
    rather than directly when the active_mm doesn't match that of the task
    initiating the flush, a bit like local_r4k_flush_cache_page() does.
    
    This would fix a corner case on SMP systems without hardware globalized
    hit cache ops, where a migration to another CPU after the flush, where
    that CPU did not have the same mm active at the time of the flush, could
    result in stale icache content being executed instead of the trampoline,
    e.g. from a previous delay slot emulation with a similar stack pointer.
    
    This case was artificially triggered by replacing the icache flush with
    a full indexed flush (not globalized on CM systems) and forcing the SMP
    call to take place, with a test program that alternated two FPU delay
    slots with a parent process repeatedly changing scheduler affinity.
    Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
    Cc: Paul Burton <paul.burton@imgtec.com>
    Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13797/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    e523f289
c-r4k.c 48.9 KB