OSDN Git Service

s390/ptrace: fix guarded storage regset handling
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 11 Sep 2017 09:24:23 +0000 (11:24 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 28 Sep 2017 05:29:40 +0000 (07:29 +0200)
commit5ef2d5231d547c672c67bdf84c13a4adaf477964
treee43e8a7aa8fabf54bccc7f0e62860c2d7cfc5f6e
parentfa1edf3f63c05ca8eacafcd7048ed91e5360f1a8
s390/ptrace: fix guarded storage regset handling

If the guarded storage regset for current is supposed to be changed,
the regset from user space is copied directly into the guarded storage
control block.

If then the process gets scheduled away while the control block is
being copied and before the new control block has been loaded, the
result is random: the process can be scheduled away due to a page
fault or preemption. If that happens the already copied parts will be
overwritten by save_gs_cb(), called from switch_to().

Avoid this by copying the data to a temporary buffer on the stack and
do the actual update with preemption disabled.

Fixes: f5bbd7219891 ("s390/ptrace: guarded storage regset for the current task")
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/ptrace.c