Skip to content

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

Closed
@yujack008

Description

@yujack008

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions