Skip to contentSkip to conversation

Patch "KVM: s390: don't use current->thread.fpu.* when accessing registers" has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 22, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    KVM: s390: don't use current->thread.fpu.* when accessing registers

to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
kvm-s390-don-t-use-current-thread.fpu.-when-accessing-registers.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From a7d4b8f2565ad0dfdff9a222d1d87990c73b36e8 Mon Sep 17 00:00:00 2001

From: David Hildenbrand <[email protected]>
Date: Tue, 16 Aug 2016 14:38:24 +0200
Subject: KVM: s390: don't use current->thread.fpu.* when accessing registers

From: David Hildenbrand <[email protected]>

commit a7d4b8f2565ad0dfdff9a222d1d87990c73b36e8 upstream.

As the meaning of these variables and pointers seems to change more frequently, let's directly access our save area, instead of going via current->thread.

Right now, this is broken for set/get_fpu. They simply overwrite the host registers, as the pointers to the current save area were turned into the static host save area.

Fixes 3f6813b9a5e0 ("s390/fpu: allocate 'struct fpu' with the task_struct")
---
 arch/s390/kvm/kvm-s390.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arch/s390/kvm/kvm-s390.c +6 -4
@@ -1951,9 +1951,10 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct k
 		return -EINVAL;
 	current->thread.fpu.fpc = fpu->fpc;
 	if (MACHINE_HAS_VX)
-		convert_fp_to_vx(current->thread.fpu.vxrs, (freg_t *)fpu->fprs);
+		convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs,
+				 (freg_t *) fpu->fprs);
 	else
-		memcpy(current->thread.fpu.fprs, &fpu->fprs, sizeof(fpu->fprs));
+		memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs));
 	return 0;
 }
 
@@ -1962,9 +1963,10 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct k
 	/* make sure we have the latest values */
 	save_fpu_regs();
 	if (MACHINE_HAS_VX)
-		convert_vx_to_fp((freg_t *)fpu->fprs, current->thread.fpu.vxrs);
+		convert_vx_to_fp((freg_t *) fpu->fprs,
+				 (__vector128 *) vcpu->run->s.regs.vrs);
 	else
-		memcpy(fpu->fprs, current->thread.fpu.fprs, sizeof(fpu->fprs));
+		memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs));
 	fpu->fpc = current->thread.fpu.fpc;
 	return 0;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.7/kvm-s390-don-t-use-current-thread.fpu.-when-accessing-registers.patch