Simon McVittie : winebus.sys: Add code path to bypass udevd and use inotify.

Alexandre Julliard julliard at winehq.org
Wed Oct 20 15:58:40 CDT 2021


Module: wine
Branch: master
Commit: ab3416c61fb17207e0831f7709da4d2911b07fb2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ab3416c61fb17207e0831f7709da4d2911b07fb2

Author: Simon McVittie <smcv at collabora.com>
Date:   Wed Oct 20 11:07:27 2021 +0200

winebus.sys: Add code path to bypass udevd and use inotify.

In a container with a non-trivial user namespace, we cannot rely on
libudev communicating with udevd as a way to monitor device nodes,
for the following reasons:

* If uid 0 from the host is not mapped to uid 0 in the container, libudev
  cannot authenticate netlink messages from the host, because their sender
  uid appears to be the overflowuid. Resolving this by mapping uid 0 into
  the container is not allowed when creating user namespaces as an
  unprivileged user, and even when running as a privileged user, it might
  be desirable for the real uid 0 to not be mapped as a way to harden the
  security boundary between container and host.

* Depending on the container configuration, initial enumeration might
  not be able to read /run/udev from the host system. If it can't, sysfs
  attributes will still work because those are read directly from the
  kernel via sysfs, but udev properties coming from user-space rules
  (in particular ID_INPUT_JOYSTICK and friends) will appear to be missing.

* The protocols between udevd and libudev (netlink messages for monitoring,
  and /run/udev for initial enumeration) are considered to be private to
  a particular version of udev, and are not a stable API; but in a
  container, we cannot expect that our copy of libudev is at exactly the
  same version as udevd on the host system.

Sidestep this by adding a code path that continues to use libudev for
the parts that work regardless of whether udevd is running or can be
communicated with.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winebus.sys/bus_udev.c | 276 ++++++++++++++++++++++++++++++++++++++++++--
 dlls/winebus.sys/main.c     |   2 +
 dlls/winebus.sys/unixlib.h  |   1 +
 3 files changed, 268 insertions(+), 11 deletions(-)

Diff:   https://source.winehq.org/git/wine.git/?a=commitdiff;h=ab3416c61fb17207e0831f7709da4d2911b07fb2



More information about the wine-cvs mailing list