Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yujack008 opened this issue Apr 11, 2024 · 1 comment
Open
Labels
C-bug Category: bug

Comments

@yujack008
Copy link

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 yujack008 added the C-bug Category: bug label Apr 11, 2024
@devnexen
Copy link
Contributor

would you be able to produce a PR ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants