Add a fast-path for drivers that are symlinked or hardlinked
-
glib-backports: Backport g_memdup2
This is a fixed version of g_memdup(), which is deprecated because it's vulnerable to integer overflows if the byte_size is attacker-controlled. I'm not actually intending to use it for anything that could be attacker-controlled, but doing this backport seems clearer than proving that our use of the deprecated function is safe.
-
pv-runtime: Do more fd-relative I/O in bind_icds()
This is mostly preparation for a subsequent commit that also wants to do fd-relative I/O in the destination directory, but it should also slightly reduce the number of filesystem operations.
-
pv-runtime: Add a fast-path for drivers that are symlinked or hardlinked
In recent Mesa versions, all DRI drivers are hard-links to one of a small number of large "megadrivers", typically one for Gallium drivers and one for "classic" drivers.
When dealing with these drivers, there's little point in processing them one by one: everything capsule-capture-libs does is dependent only on the content of the driver, so whatever we would have done for (for example) iris_dri.so (a Gallium driver), we'll do exactly the same for the nouveau_dri.so that is another name for the same file.
Instead, process only the first representative of each file, and then copy its result (whether positive or negative) for the others.
This provides ~ 10% faster container startup with warm cache (CPU-bound rather than I/O-bound).