Skip to content
  • Simon McVittie's avatar
    ld-libs: Always clear ldlibs->needed entry if ld_lib_open() fails · ac3f0295
    Simon McVittie authored
    
    
    This is what was documented to happen.
    
    Previously, we did not clear the entry if we failed to open the
    library fd, or if we succeeded but the library was "unacceptable"
    (wrong ELF class or machine tag). Normally this results in a minor
    memory leak, and a fd leak if the library is "unacceptable".
    
    However, when called from search_ldcache_cb(), it's particularly
    important that we do this, because search_ldcache() uses the state
    of the fd field - valid fd or not - to check whether ld_lib_open()
    succeeded.
    
    One practical symptom is that if your container has an x86_64
    libfoo.so.0 that compares newer than the provider's libfoo.so.0,
    and does not have an i386 libfoo.so.0, then capsule-capture-libs
    would unexpectedly not capture the i386 libfoo.so.0 from the provider
    either.
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
    ac3f0295