Skip to content

Commit

Permalink
s390/perf: obtain sie_block from the right address
Browse files Browse the repository at this point in the history
commit c9bfb46 upstream.

Since commit 1179f17 ("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: 1179f17 ("s390: fix fpu restore in entry.S")
Cc: stable@vger.kernel.org
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Nico Boehr authored and gregkh committed Jun 9, 2022
1 parent 7994d89 commit 74114d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,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)
Expand Down

0 comments on commit 74114d2

Please sign in to comment.