]> Git Repo - linux.git/commitdiff
s390/perf: obtain sie_block from the right address
authorNico Boehr <[email protected]>
Tue, 24 May 2022 13:43:20 +0000 (15:43 +0200)
committerHeiko Carstens <[email protected]>
Wed, 25 May 2022 09:46:02 +0000 (11:46 +0200)
Since commit 1179f170b6f0 ("s390: fix fpu restore in entry.S"), the
sie_block pointer is located at empty1[1], but in sie_block() it was
taken from empty1[0].

This leads to a random pointer being dereferenced, possibly causing
system crash.

This problem can be observed when running a simple guest with an endless
loop and recording the cpu-clock event:

  sudo perf kvm --guestvmlinux=<guestkernel> --guest top -e cpu-clock

With this fix, the correct guest address is shown.

Fixes: 1179f170b6f0 ("s390: fix fpu restore in entry.S")
Cc: [email protected]
Acked-by: Christian Borntraeger <[email protected]>
Acked-by: Claudio Imbrenda <[email protected]>
Reviewed-by: Heiko Carstens <[email protected]>
Signed-off-by: Nico Boehr <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
arch/s390/kernel/perf_event.c

index ea7729bebaa07a227c4faa0a9b1b07578b8922de..a7f8db73984b0cb9dae7b744e92b9b08cd5127fb 100644 (file)
@@ -30,7 +30,7 @@ static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs)
        if (!stack)
                return NULL;
 
-       return (struct kvm_s390_sie_block *) stack->empty1[0];
+       return (struct kvm_s390_sie_block *)stack->empty1[1];
 }
 
 static bool is_in_guest(struct pt_regs *regs)
This page took 0.056556 seconds and 4 git commands to generate.