Page MenuHomeFreeBSD

rtld: fix reference tracking with common symbols
Needs ReviewPublic

Authored by vangyzen on Sep 7 2022, 9:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 20 2024, 9:06 PM
Unknown Object (File)
Apr 20 2024, 7:13 PM
Unknown Object (File)
Mar 19 2024, 3:01 PM
Unknown Object (File)
Feb 22 2024, 2:39 PM
Unknown Object (File)
Dec 23 2023, 2:16 AM
Unknown Object (File)
Jun 22 2023, 7:08 PM
Unknown Object (File)
May 3 2023, 2:47 AM
Unknown Object (File)
Mar 17 2023, 2:16 AM

Details

Reviewers
markj
kib
Summary

See dlopen_common_global.md for a detailed description of the bug.

The proposed fix is an ugly hack, due in part to casting away const (and the #pragma that requires). I would be delighted to throw it away and implement your better idea. Removing const from SymLook::defobj_out is fairly invasive and feels wrong.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47285
Build 44172: arc lint + arc unit

Event Timeline

I do not think that workarounds for application bugs should be performed in ld-elf.so.1.

I do not completely understand the problem, but did you tried to change libcompiler_rt (is it libgcc.s.so BTW?) to be linked with -Bsymbolic? This might be the right thing to do regardless of the specific bug we are discussing.

I think the real fix, following the ELF model of the COPY relocation, is to have the main binary linked against libgcc_s.so, and more, main binary needs to reference symbols needed by dlopened dsos.
This is how ELF is supposed to work.

Or do dlclose nss/pam modules, or mark then unloadable for your instrumented build.

rtld never converts symbols references into refcounts, and I do not see why it is reasonable to do to workaround some application bug.