• Dave Martin's avatar
    arm64: fpsimd: Fix failure to restore FPSIMD state after signals · 9de52a75
    Dave Martin authored
    The fpsimd_update_current_state() function is responsible for
    loading the FPSIMD state from the user signal frame into the
    current task during sigreturn.  When implementing support for SVE,
    conditional code was added to this function in order to handle the
    case where SVE state need to be loaded for the task and merged with
    the FPSIMD data from the signal frame; however, the FPSIMD-only
    case was unintentionally dropped.
    
    As a result of this, sigreturn does not currently restore the
    FPSIMD state of the task, except in the case where the system
    supports SVE and the signal frame contains SVE state in addition to
    FPSIMD state.
    
    This patch fixes this bug by making the copy-in of the FPSIMD data
    from the signal frame to thread_struct unconditional.
    
    This remains a performance regression from v4.14, since the FPSIMD
    state is now copied into thread_struct and then loaded back,
    instead of _only_ being loaded into the CPU FPSIMD registers.
    However, it is essential to call task_fpsimd_load() here anyway in
    order to ensure that the SVE enable bit in CPACR_EL1 is set
    correctly before returning to userspace.  This could use some
    refactoring, but since sigreturn is not a fast path I have kept
    this patch as a pure fix and left the refactoring for later.
    
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Fixes: 8cd969d2 ("arm64/sve: Signal handling support")
    Reported-by: 's avatarAlex Bennée <alex.bennee@linaro.org>
    Tested-by: 's avatarAlex Bennée <alex.bennee@linaro.org>
    Reviewed-by: 's avatarAlex Bennée <alex.bennee@linaro.org>
    Signed-off-by: 's avatarDave Martin <Dave.Martin@arm.com>
    Signed-off-by: 's avatarWill Deacon <will.deacon@arm.com>
    9de52a75
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...