[PATCH 2/2] winebus.sys: Add code path to bypass udevd and use inotify.

Simon McVittie smcv at collabora.com
Wed Oct 20 07:51:26 CDT 2021


On Wed, 20 Oct 2021 at 11:01:32 +0200, Rémi Bernon wrote:
> There was some container detection too but that
> seemed a bit specific, and the new option should be enough.

(I am not a Wine or Proton developer and not subscribed to the list, so
please cc me if appropriate.)

I think some version of the container detection might be valuable
to have as a follow-up to this: because udev is not designed to work
across container boundaries, it seems like it would be good to have Wine
automatically "do the right thing" when running inside an unprivileged
container like Flatpak or Steam's pressure-vessel.

The version of the container detection that I contributed to Proton about a
year ago was specific to those two container managers:

-    bypass_udevd = check_bus_option(&disable_udevd, 0);
+    if (access ("/run/pressure-vessel", R_OK)
+        || access ("/.flatpak-info", R_OK))
+    {
+        TRACE("Container detected, bypassing udevd by default\n");
+        bypass_udevd = 1;
+    }
+
+    bypass_udevd = check_bus_option(&disable_udevd, bypass_udevd);

but unprivileged container managers have moved on a bit, and there is now
a specification (originating in systemd[1]) for how a container manager can
announce to contained code that it is running in a container: if the file
/run/host/container-manager exists, then we're in a container (and the file
should contain a string like "flatpak\n" or "pressure-vessel\n").
So replacing the access() checks above with
access("/run/host/container-manager", R_OK) might be better.

For Flatpak specifically, /run/host/container-manager was added in 1.9.1,
so if you want to support older Flatpak versions like the 1.8.x found
in RHEL 8, the right thing would now be something like this (untested),
which is the equivalent of how this is now done[3] in SDL:

-    bypass_udevd = check_bus_option(&disable_udevd, 0);
+    if (access ("/run/host/container-manager", R_OK)
+        || access ("/.flatpak-info", R_OK))
+    {
+        TRACE("Container detected, bypassing udevd by default\n");
+        bypass_udevd = 1;
+    }
+
+    bypass_udevd = check_bus_option(&disable_udevd, bypass_udevd);

    smcv

[1] https://systemd.io/CONTAINER_INTERFACE/
[2] https://github.com/containers/podman/issues/3586
[3] https://github.com/libsdl-org/SDL/blob/release-2.0.16/src/joystick/linux/SDL_sysjoystick.c#L669



More information about the wine-devel mailing list