NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.67k stars 13.81k forks source link

runc: missing reverse device mapping in /dev #224217

Open Kiskae opened 1 year ago

Kiskae commented 1 year ago

Describe the bug

As described in the changelog of #223939, runc uses the /dev/{char/block} reverse major:minor symlinks to discover what to mount in the container. While this appears to be handled properly for devices that rely on the kernel to create device nodes, any driver that uses manual node creation (like nvidia through udev) does not create these reverse mappings and runs into this issue.

Steps To Reproduce

  1. build configuration with the nvidia driver enabled
  2. look in /dev/char and see that none of the /dev/nvidia* nodes are symlinked there.

Expected behavior

Creation of appropriate symlinks in /dev/{char/block}. Currently I am only aware of the nvidia driver but I'm sure there are other packages that rely on manual mknod that have this issue.

Additional context

runc issue: https://github.com/opencontainers/runc/issues/3708 nvidia-modprobe commit: https://github.com/NVIDIA/nvidia-modprobe/commit/ec487af278c3603f785e6829023dc1675c66a236

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

❯ nix run nixpkgs#nix-info -- -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.2.7-zen1, NixOS, 23.05 (Stoat), 23.05.20230330.e3652e0`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - channels(root): `"nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Kiskae commented 1 year ago

For all device nodes published through sysfs, these symlinks are created here: https://github.com/systemd/systemd/blob/09567df7db75824f1b8bf0b5cc721febda03cb56/src/udev/udev-node.c#L484

As far as I can see it isn't possible to create fake devices for udev to manage. I still want to check whether static_node udev rules would allow for symlinks.