pull/659/head
pdliyan 2 years ago
parent 76a836639a
commit a8046e411c

@ -278,8 +278,12 @@ macro_rules! impl_from_pt_regs {
} }
fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
let addr = ctx.rsp + 8 * (n + 1) as __u64; unsafe {
Some(addr as *const $type as _) let addr: __u64 = ctx.rsp + 8 * (n + 1) as __u64;
bpf_probe_read(addr as *const $type)
.map(|v| v as $type)
.ok()
}
} }
fn from_retval(ctx: &pt_regs) -> Option<Self> { fn from_retval(ctx: &pt_regs) -> Option<Self> {
@ -298,8 +302,12 @@ macro_rules! impl_from_pt_regs {
} }
fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
let addr = ctx.uregs[13] + 8 * (n + 1) as __u64; unsafe {
Some(addr as *const $type as _) let addr: __u64 = ctx.uregs[13] + 8 * (n + 1) as __u64;
bpf_probe_read(addr as *const $type)
.map(|v| v as $type)
.ok()
}
} }
fn from_retval(ctx: &pt_regs) -> Option<Self> { fn from_retval(ctx: &pt_regs) -> Option<Self> {
@ -318,8 +326,12 @@ macro_rules! impl_from_pt_regs {
} }
fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> { fn from_stack_argument(ctx: &pt_regs, n: usize) -> Option<Self> {
let addr = ctx.sp + 8 * (n + 1) as __u64; unsafe {
Some(addr as *const $type as _) let addr: __u64 = ctx.sp + 8 * (n + 1) as __u64;
bpf_probe_read(addr as *const $type)
.map(|v| v as $type)
.ok()
}
} }
fn from_retval(ctx: &pt_regs) -> Option<Self> { fn from_retval(ctx: &pt_regs) -> Option<Self> {

Loading…
Cancel
Save