Skip to content
Snippets Groups Projects
  • Simon McVittie's avatar
    8196049b
    pv_wrap_append_preload: Handle libraries specified as a basename · 8196049b
    Simon McVittie authored
    This is a bit complicated, because there are two reasonable things that
    people might use LD_PRELOAD for, and in this mode it's particularly
    important to distinguish between them.
    
    One is to inject arbitrary code, like MangoHud or fakeroot. In this
    case, we want to take the loadable module from the namespace in which
    the user initiated pv-wrap. We can do this the same way we deal with
    the ${LIB} and ${PLATFORM} dynamic string tokens: load it once per ABI,
    pass a separate option to pv-adverb for each one, and let pv-adverb
    recombine them.
    
    The other is to work around libraries not being loaded soon enough,
    like the way people sometimes use LD_PRELOAD="libpthread.so.0 libGL.so.1"
    to force an optirun library to be loaded. In this case, we absolutely
    do not want to import the host library of that name into the container
    unconditionally, because if we do, it will sabotage our careful efforts
    to get the correct instance of libpthread.so.0 to be chosen. In this
    case, assume that the user meant "take whatever libpthread.so.0 you
    would naturally load, and preload it into each executable".
    
    Resolves: https://github.com/ValveSoftware/steam-runtime/issues/435
    
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
    8196049b
    History
    pv_wrap_append_preload: Handle libraries specified as a basename
    Simon McVittie authored
    This is a bit complicated, because there are two reasonable things that
    people might use LD_PRELOAD for, and in this mode it's particularly
    important to distinguish between them.
    
    One is to inject arbitrary code, like MangoHud or fakeroot. In this
    case, we want to take the loadable module from the namespace in which
    the user initiated pv-wrap. We can do this the same way we deal with
    the ${LIB} and ${PLATFORM} dynamic string tokens: load it once per ABI,
    pass a separate option to pv-adverb for each one, and let pv-adverb
    recombine them.
    
    The other is to work around libraries not being loaded soon enough,
    like the way people sometimes use LD_PRELOAD="libpthread.so.0 libGL.so.1"
    to force an optirun library to be loaded. In this case, we absolutely
    do not want to import the host library of that name into the container
    unconditionally, because if we do, it will sabotage our careful efforts
    to get the correct instance of libpthread.so.0 to be chosen. In this
    case, assume that the user meant "take whatever libpthread.so.0 you
    would naturally load, and preload it into each executable".
    
    Resolves: https://github.com/ValveSoftware/steam-runtime/issues/435
    
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>