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 · May be fixed by #3894
Open

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

yujack008 opened this issue Apr 11, 2024 · 1 comment · May be fixed by #3894
Labels
C-bug Category: bug E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@yujack008
Copy link

yujack008 commented Apr 11, 2024

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 ?

@tgross35 tgross35 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. and removed help wanted labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants