rust-lang / rust-lang/rust

ld.so assertion failure when using raw-dylib on Linux

Open
#145,854 21 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-linkage C-bug F-raw_dylib O-linux T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried the raw-dylib feature in https://github.com/fortanix/rust-sgx/pull/804 but unfortunately I couldn't get it to work. I'm getting this error when doing cargo run -p fortanix-sgx-tools --bin ftxsgx-runner.

Inconsistency detected by ld.so: rtld.c: 2013: dl_main: Assertion `GL(dl_rtld_map).l_prev->l_next == GL(dl_rtld_map).l_next' failed!

This is on Ubuntu 24.04 with libc 2.39-0ubuntu8.5. rustc 1.89.0-nightly (d4e1159b8 2025-06-21).

There are no major differences in objdump -P (just the ordering of DT_NEEDED entries is different, but I don't think that should matter?). There is a small difference in objdump -T:

--- objdump-T.fake-vdso
+++ objdump-T.raw-dylib
-0000000000000000  w   DF *UND*	0000000000000000  Base        __vdso_sgx_enter_enclave
+0000000000000000  w   D  *UND*	0000000000000000  Base        __vdso_sgx_enter_enclave

I don't know that this is related to the assertion failure, but it's a bit surprising to me the F flag isn't getting set using the new method. I'm using extern { fn ... } in addition to using .type ..., function in assembly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with cargo run -p fortanix-sgx-tools --bin ftxsgx-runner on Ubuntu 24.04 using the reported nightly, then inspect the generated artifacts with objdump -P and objdump -T. Compare the fake-vDSO and raw-dylib cases, including DT_NEEDED ordering, symbol flags, the extern declaration, and the assembly .type directive. Done means identifying the cause of the ld.so assertion and validating a specific correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
compilers, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.