Blame SOURCES/rhbz1732173.patch

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