Skip to content

SIGSEGV in TLS startup on mips/musl with rcrt1.o #46566

@aep

Description

@aep

this looks like a bug in musl's rcrt1.o to me, but i can't quite give the musl guys any useful information here

Program received signal SIGSEGV, Segmentation fault.
0x77fbfb1c in core::cell::Cell<bool>::get<bool> () at /checkout/src/libcore/cell.rs:240
240	/checkout/src/libcore/cell.rs: No such file or directory.
(gdb) bt
#0  0x77fbfb1c in core::cell::Cell<bool>::get<bool> () at /checkout/src/libcore/cell.rs:240
#1  std::thread::local::fast::Key<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>>::get<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>> () at /checkout/src/libstd/thread/local.rs:421
#2  std::sys_common::thread_info::THREAD_INFO::__getit () at /checkout/src/libstd/thread/local.rs:184
#3  std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>>::try_with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,closure,()> () at /checkout/src/libstd/thread/local.rs:376
#4  std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>>::with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,closure,()> () at /checkout/src/libstd/thread/local.rs:293
#5  std::sys_common::thread_info::set () at /checkout/src/libstd/sys_common/thread_info.rs:46
#6  0x77fc3350 in std::rt::lang_start () at /checkout/src/libstd/rt.rs:52
#7  0x77fb1408 in main ()

this only happens when using rcrt1.o as entrypoint, not with Scrt1.o , so i suspect something related to TLS must be different in rcrt1

I'd appecheciate some pointers from the rust community here how TLS is different than for C++ so i can show a better test case to musl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-muslTarget: The musl libc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions