[RFC PATCH] elf: Add opt-in per-object resolution notes

Domen Kožar domen@dev.si
Wed Nov 4 11:44:31 GMT 2026


Hi Carlos, Sam,

One clarification about the proposed workflow: the notes are written
during the package build, after the other ELF fixups. The intended
sequence is to generate the notes, test and sign the resulting
artifacts, then distribute those artifacts unchanged. ld.so only reads
the mapped notes. There is no runtime rewriting of installed binaries
or background cache regeneration.

The notes record library-file lookup results. Symbol lookup,
relocations, and address placement remain the loader's responsibility.
Keeping the records in each object also makes them available through
its existing mapping, without a separate cache file or discovery
mechanism.

Your concern about shipping exactly what was tested is valid. The
build-time writer must run before testing and signing the final
artifacts; existing tests that run before fixup do not establish that.

Stale records are a separate issue. The current RFC cannot detect
changes to DT_RUNPATH or DT_NEEDED. A revised format should bind the
records to those values and reject mismatches. That would detect
relevant ELF edits, but would still require unchanged filesystem
entries wherever the cache skips a search.

For the audit-hook alternative, redirecting at LA_SER_ORIG would
preempt LD_LIBRARY_PATH. Redirecting at LA_SER_RUNPATH preserves
environment-search precedence, but la_objsearch returns a single
candidate pathname. It has no direct operation for trying an ordered
list of cached candidates and then resuming the original search if
they fail.

An audit implementation would therefore need additional machinery to
preserve missing-candidate fallback, runtime directory hints,
hardware-capability selection, and per-requester decisions. Native
loader support can insert the cache lookup between environment search
and RUNPATH and reuse the existing search and error-handling paths.
This is a correctness and integration consideration; we have not
established a performance advantage over a complete audit
implementation.

Does the build-time-only writing and read-only runtime behavior
address the artifact-mutation concern?

Regards,
Domen


On Tue, 03 Nov 2026 17:09:25 -0500, Carlos O'Donell <carlos@redhat.com> wrote:
> On 11/3/26 5:01 PM, Sam James wrote:
> > Domen Kožar <domen@dev.si> writes:
> >
> >> Hello,
> >>
> >> Programs with long DT_RUNPATH lists can spend many failed file lookups
> >> resolving each library at startup. This patch lets glibc use
> >> per-object ELF notes containing precomputed library paths to avoid
> >> repeated directory searches.
> >
> > I'm not sure we want to go in this direction. I'm not comfortable with
> > ld.so mutating binaries on-disk.
> >
> > I've not used the audit hooks but do wonder if you could use them for
> > that without this functionality being upstream.
> Agreed.
>
> This is primarily the reason we stopped doing prelink.
>
> The live mutation of the binaries on disk meant we invalidated testing
> and any certifications we'd made about the binaries.
>
> There were many other reasons, but shipping exactly what you tested was
> one of them.
>
> --
> Cheers,
> Carlos.


More information about the Libc-alpha mailing list