Skip to content

pv-runtime: Duplicate symlinks in /etc, /var in the interpreter root

Simon McVittie requested to merge wip/task342-1 into main
  • pv-runtime: Duplicate symlinks in /etc, /var in the interpreter root

    This allows them to point to files that might be virtualized by emulators like FEX-Emu. When running x86 code on ARM under FEX-Emu, we have to populate the container's real /usr with ARM libraries, and populate $FEX_ROOTFS/usr with x86 libraries; otherwise, FEX-Emu itself, which is a dynamically-linked ARM executable, cannot work.

    /etc/os-release is canonically a symlink to ../usr/lib/os-release, but if we rely on FEX-Emu reading /etc/os-release, we have a problem: it will dereference the symlink and read the real /usr, which contains a /usr/lib/os-release describing the real (ARM) operating system.

    However, if we create this symlink in the FEX_ROOTFS, when an x86 process dereferences /etc/os-release, FEX-Emu will follow the symlink to $FEX_ROOTFS/usr/lib/os-release, which describes the container runtime (in practice soldier or sniper) as desired. Create both /etc/os-release and $FEX_ROOTFS/etc/os-release, so that both ARM and x86 code do the right thing.

    We could in principle get the same situation with other symlinks in /etc or /var, so do this uniformly with all members of /etc and /var: if they are symlinks, we create the symlink in both / and $FEX_ROOTFS.

    steamrt/tasks#342

Edited by Simon McVittie

Merge request reports

Loading