• Will Deacon's avatar
    arm64: fpsimd: Fix copying of FP state from signal frame into task struct · a4544831
    Will Deacon authored
    Commit 9de52a75 ("arm64: fpsimd: Fix failure to restore FPSIMD
    state after signals") fixed an issue reported in our FPSIMD signal
    restore code but inadvertently introduced another issue which tends to
    manifest as random SEGVs in userspace.
    
    The problem is that when we copy the struct fpsimd_state from the kernel
    stack (populated from the signal frame) into the struct held in the
    current thread_struct, we blindly copy uninitialised stack into the
    "cpu" field, which means that context-switching of the FP registers is
    no longer reliable.
    
    This patch fixes the problem by copying only the user_fpsimd member of
    struct fpsimd_state. We should really rework the function prototypes
    to take struct user_fpsimd_state * instead, but let's just get this
    fixed for now.
    
    Cc: Dave Martin <Dave.Martin@arm.com>
    Fixes: 9de52a75 ("arm64: fpsimd: Fix failure to restore FPSIMD state after signals")
    Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    a4544831
fpsimd.c 34.6 KB