]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: fpsimd: Fix copying of FP state from signal frame into task struct
authorWill Deacon <will.deacon@arm.com>
Fri, 15 Dec 2017 16:07:22 +0000 (16:07 +0000)
committerWill Deacon <will.deacon@arm.com>
Fri, 15 Dec 2017 16:12:35 +0000 (16:12 +0000)
commit395e7f06768e00bb1db1e01e1ac1638c2529b2a1
tree6db0189ca49e20a47b14b2fd46c741adfaa24064
parent47bd0a9af9ad490d6448743652aa5728a484c38d
arm64: fpsimd: Fix copying of FP state from signal frame into task struct

Commit 32a1d09fbd1d172e ("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: 32a1d09fbd1d172e ("arm64: fpsimd: Fix failure to restore FPSIMD state after signals")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/fpsimd.c