You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ea97424
Browse filesBrowse the repository at this point in the historyBrowse files
Keeping a loaded memfd open until exit gave each image a path of its
own, but held one file descriptor per load for the life of the process:
ffi's close() did not release it, nor did a worker's exit, nor a load
that failed after dlopen(), so a process opening libraries in a loop
would grow without bound.
The fd is only needed until dlopen() returns, as the load's mapping
keeps the memory alive from then on. What has to last is the path, and
that depends only on the number. So move each image's fd to a number no
earlier image has had, using F_DUPFD_CLOEXEC with a process-wide counter
that only goes up, and close it right after the load again. Unlike
closing it after dlclose(), this also holds for an object that dlclose()
leaves loaded, and for addons on the main thread, which are never
unloaded. Should the numbers run out, the image goes to a temp file.
Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
0 commit comments