libc icon indicating copy to clipboard operation
libc copied to clipboard

The offset of mcontext_t inside the libc::ucontext_t struct is incorrect

Open yujack008 opened this issue 10 months ago • 1 comments

Cpp code:

DEBUG("off: 0x%x\n", (size_t)(&((ucontext_t *) data)->uc_mcontext) - (size_t)data);

output:

off: 0xB0

Rust code:

let ucontext = data as *const libc::ucontext_t;
let start = ucontext as usize;
let uc_mcontext_ref = &(*ucontext).uc_mcontext;
let uc_mcontext_ptr = uc_mcontext_ref as *const _;
let end = uc_mcontext_ptr as usize;
log::info!("off:0x{:x}",end -star);

output:

off:0x30

build for target aarch64-linux-android

yujack008 avatar Apr 11 '24 09:04 yujack008

would you be able to produce a PR ?

devnexen avatar Apr 13 '24 19:04 devnexen