Blame SOURCES/rhbz1732173.patch

52bd98
commit 7be7af0fda3633cd19e499617834cf4a5f51dd55
52bd98
Author: William Cohen <wcohen@redhat.com>
52bd98
Date:   Tue Jul 23 14:24:14 2019 -0400
52bd98
52bd98
    Fix aarch64 to properly access arguments for wrapped syscalls
52bd98
    
52bd98
    Linux 4.18 added wrappers for aarch64 syscalls that pass a pointer to
52bd98
    a struct pt_regs holding the values for the actual arguments.  The
52bd98
    syscall tapsets initialize CONTEXT->sregs to point at this data
52bd98
    structure.  However, the aarch64 specific register access code was
52bd98
    using the CONTEXT->kregs and just getting the processor register state
52bd98
    when the kprobe triggered rather than the expected arguments in the
52bd98
    data structure being passed into the syscall.  The aarch64 specific
52bd98
    register code now gets the syscall arguments from the correct pt_regs
52bd98
    structure.
52bd98
52bd98
diff --git a/tapset/arm64/registers.stp b/tapset/arm64/registers.stp
52bd98
index b2e5649..8773df2 100644
52bd98
--- a/tapset/arm64/registers.stp
52bd98
+++ b/tapset/arm64/registers.stp
52bd98
@@ -58,7 +58,10 @@ function uarch_bytes:long() {
52bd98
 function _stp_get_register_by_offset:long (offset:long) %{ /* pure */
52bd98
 	long value;
52bd98
 	struct pt_regs *regs;
52bd98
-	regs = (CONTEXT->user_mode_p ? CONTEXT->uregs : CONTEXT->kregs);
52bd98
+	if (CONTEXT->sregs)
52bd98
+	  regs = CONTEXT->sregs;
52bd98
+	else
52bd98
+	  regs = (CONTEXT->user_mode_p ? CONTEXT->uregs : CONTEXT->kregs);
52bd98
 	if (!regs) {
52bd98
 		CONTEXT->last_error = "No registers available in this context";
52bd98
 		return;