Page MenuHomeFreeBSD

rtld: introduce PRELOAD_FDS
ClosedPublic

Authored by oshogbo on Mar 18 2021, 8:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 7 2024, 7:08 PM
Unknown Object (File)
Feb 1 2024, 5:53 PM
Unknown Object (File)
Jan 12 2024, 2:50 AM
Unknown Object (File)
Dec 20 2023, 7:39 AM
Unknown Object (File)
Dec 6 2023, 4:23 PM
Unknown Object (File)
Nov 7 2023, 6:38 AM
Unknown Object (File)
Nov 7 2023, 5:10 AM
Unknown Object (File)
Nov 6 2023, 1:17 PM
Subscribers

Details

Summary

The new PRELOAD_FDS variable accepts a list of file descriptors
that should be loaded into the process.

This may be used to optimize a loading process - in the case when
we already have a file descriptor to the library; we don't have
to look into multiple PATH to find it.

It may also be used in capability mode to load a single additional
library without the need to open a directory that contains it.

The last use of this functionality t may be a race-free method
of loading libraries.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 37934
Build 34823: arc lint + arc unit

Event Timeline

oshogbo retitled this revision from rtld: intrdouce PRELOAD_FDS to rtld: introduce PRELOAD_FDS.Mar 18 2021, 8:43 PM
This comment was removed by oshogbo.
libexec/rtld-elf/rtld.c
2579

So here we dup the passed fd to set CLOEXEC. Does the original fd get closed somehow?

libexec/rtld-elf/rtld.c
2579

No, we do not.
I did the same think like in case of LD_LIBARARY_PATH_FDS.
We don't close anywhere the directories passed.
Now I think of that the consumer should have decision what to do with those fds (in both cases) right?

kib added inline comments.
libexec/rtld-elf/rtld.c
2501

return (-1);

You can stage a pre-patch changing other returns in this function, if you prefer common style. Or better, convert the function to style (mostly indents).

This revision is now accepted and ready to land.Mar 19 2021, 11:51 AM
markj added inline comments.
libexec/rtld-elf/rtld.c
2579

I misread the code, I didn't see that fd is closed below.

This revision was automatically updated to reflect the committed changes.