Skip to content
Snippets Groups Projects
  • Simon McVittie's avatar
    31c96036
    runtime: Don't try to glnx_file_copy_at() from a magic symlink · 31c96036
    Simon McVittie authored
    In the code path where we copy a file that would not otherwise be
    visible in the container, the copy doesn't actually work, because
    glnx_file_copy_at() opens regular files with O_NOFOLLOW and so refuses
    to read through the "magic symlink", failing with ELOOP.
    
    This can be reproduced by having a Vulkan ICD manifest in
    /etc/vulkan/icd.d/*.json whose `library_path` is just a SONAME.
    pressure-vessel tries to copy the file, and fails.
    
    It turns out glnx_file_copy_at() is not the right function here anyway,
    because it tries to fchown() the destination file to match the source
    file, which is going to work poorly if we are copying a file owned by
    root (which we often are). Just use the important part of it, which is
    glnx_regfile_copy_bytes().
    
    Resolves: https://github.com/ValveSoftware/steam-runtime/issues/366
    
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
    31c96036
    History
    runtime: Don't try to glnx_file_copy_at() from a magic symlink
    Simon McVittie authored
    In the code path where we copy a file that would not otherwise be
    visible in the container, the copy doesn't actually work, because
    glnx_file_copy_at() opens regular files with O_NOFOLLOW and so refuses
    to read through the "magic symlink", failing with ELOOP.
    
    This can be reproduced by having a Vulkan ICD manifest in
    /etc/vulkan/icd.d/*.json whose `library_path` is just a SONAME.
    pressure-vessel tries to copy the file, and fails.
    
    It turns out glnx_file_copy_at() is not the right function here anyway,
    because it tries to fchown() the destination file to match the source
    file, which is going to work poorly if we are copying a file owned by
    root (which we often are). Just use the important part of it, which is
    glnx_regfile_copy_bytes().
    
    Resolves: https://github.com/ValveSoftware/steam-runtime/issues/366
    
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>