Skip to content

Inability to run valgrind if rustix touches anything involving vdso, like clock_gettime #1559

@kchibisov

Description

@kchibisov

When trying to profile https://github.com/YaLTeR/niri I get the following error due to valgrind not being able to understand vdso access, the only way to kind of fix it is to patch things to use libc::clock_gettime, but it sometimes present in dependencies and takes time to patch out, so it would be nice to somehow not being able to manually patch all the crates in the dependencies tree, since it's time consuming.

==267786== Warning: unimplemented fcntl command: 1027
==267786== Invalid read of size 4
==267786==    at 0x78401DA: spec_eq<u8, u8, 4> (equality.rs:157)
==267786==    by 0x78401DA: <u8 as core::array::equality::SpecArrayEq<u8, 4>>::spec_ne (equality.rs:160)
==267786==    by 0x78400D2: ne<u8, u8, 4> (equality.rs:15)
==267786==    by 0x78400D2: <[u8] as core::cmp::PartialEq<[u8; 4]>>::ne (equality.rs:57)
==267786==    by 0x783F2F8: rustix::backend::param::auxv::check_elf_base (auxv.rs:490)
==267786==    by 0x783CDA2: rustix::backend::param::auxv::init_from_aux_iter::<rustix::backend::param::auxv::AuxPointer> (auxv.rs:407)
==267786==    by 0x783F594: rustix::backend::param::auxv::init_auxv_impl (auxv.rs:301)
==267786==    by 0x783F645: rustix::backend::param::auxv::maybe_init_auxv (auxv.rs:276)
==267786==    by 0x783F21C: rustix::backend::param::auxv::sysinfo_ehdr (auxv.rs:150)
==267786==    by 0x783E095: rustix::backend::vdso::init_from_sysinfo_ehdr (vdso.rs:84)
==267786==    by 0x783D46C: <rustix::backend::vdso::Vdso>::new (vdso.rs:247)
==267786==    by 0x783A50D: rustix::backend::vdso_wrappers::init (vdso_wrappers.rs:499)
==267786==    by 0x783A3B5: rustix::backend::vdso_wrappers::init_clock_gettime (vdso_wrappers.rs:294)
==267786==    by 0x533F3AE: rustix::backend::vdso_wrappers::clock_gettime (vdso_wrappers.rs:70)
==267786==  Address 0x7ff21b666000 is not stack'd, malloc'd or (recently) free'd
==267786==
==267786==
==267786== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==267786==  Access not within mapped region at address 0x7FF21B666000
==267786==    at 0x78401DA: spec_eq<u8, u8, 4> (equality.rs:157)
==267786==    by 0x78401DA: <u8 as core::array::equality::SpecArrayEq<u8, 4>>::spec_ne (equality.rs:160)
==267786==    by 0x78400D2: ne<u8, u8, 4> (equality.rs:15)
==267786==    by 0x78400D2: <[u8] as core::cmp::PartialEq<[u8; 4]>>::ne (equality.rs:57)
==267786==    by 0x783F2F8: rustix::backend::param::auxv::check_elf_base (auxv.rs:490)
==267786==    by 0x783CDA2: rustix::backend::param::auxv::init_from_aux_iter::<rustix::backend::param::auxv::AuxPointer> (auxv.rs:407)
==267786==    by 0x783F594: rustix::backend::param::auxv::init_auxv_impl (auxv.rs:301)
==267786==    by 0x783F645: rustix::backend::param::auxv::maybe_init_auxv (auxv.rs:276)
==267786==    by 0x783F21C: rustix::backend::param::auxv::sysinfo_ehdr (auxv.rs:150)
==267786==    by 0x783E095: rustix::backend::vdso::init_from_sysinfo_ehdr (vdso.rs:84)
==267786==    by 0x783D46C: <rustix::backend::vdso::Vdso>::new (vdso.rs:247)
==267786==    by 0x783A50D: rustix::backend::vdso_wrappers::init (vdso_wrappers.rs:499)
==267786==    by 0x783A3B5: rustix::backend::vdso_wrappers::init_clock_gettime (vdso_wrappers.rs:294)
==267786==    by 0x533F3AE: rustix::backend::vdso_wrappers::clock_gettime (vdso_wrappers.rs:70)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions