fix arm and aarch64 sp.

pull/659/head
pdliyan 2 years ago
parent 23ef443b24
commit b1bf2f23a7

@ -119,7 +119,7 @@ impl<T> FromPtRegs for *const T {
} }
fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
let addr: __u64 = &ctx.sp + 8 * (n + 1) as __u64; let addr: __u64 = &ctx.rsp + 8 * (n + 1) as __u64;
unsafe { bpf_probe_read(addr as *const c_int).map(|v| v as *const _).ok() } unsafe { bpf_probe_read(addr as *const c_int).map(|v| v as *const _).ok() }
} }
@ -139,7 +139,7 @@ impl<T> FromPtRegs for *const T {
} }
fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
let addr: __u64 = &ctx.sp + 8 * (n + 1) as __u64; let addr: __u64 = &ctx.uregs[13] + 8 * (n + 1) as __u64;
unsafe { bpf_probe_read(addr as *const c_int).map(|v| v as *const _).ok() } unsafe { bpf_probe_read(addr as *const c_int).map(|v| v as *const _).ok() }
} }
@ -183,7 +183,7 @@ impl<T> FromPtRegs for *mut T {
} }
fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
let addr: __u64 = &ctx.sp + 8 * (n + 1) as __u64; let addr: __u64 = &ctx.rsp + 8 * (n + 1) as __u64;
unsafe { bpf_probe_read(addr as *const c_int).map(|v| v as *mut _).ok() } unsafe { bpf_probe_read(addr as *const c_int).map(|v| v as *mut _).ok() }
} }
@ -203,7 +203,7 @@ impl<T> FromPtRegs for *mut T {
} }
fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
let addr: __u64 = &ctx.sp + 8 * (n + 1) as __u64; let addr: __u64 = &ctx.uregs[13] + 8 * (n + 1) as __u64;
unsafe { bpf_probe_read(addr as *const c_int).map(|v| v as *mut _).ok() } unsafe { bpf_probe_read(addr as *const c_int).map(|v| v as *mut _).ok() }
} }

Loading…
Cancel
Save