[PATCH 4/5] Don't change mode of unmatched devtmpfs devices

Alyssa Ross
2025-11-13T13:27:18Z

Otherwise, it falls back to the default rule, which sets mode 0660.
Not ideal for e.g. /dev/null!

Fixes: 88f2695 ("Initial commit")
Fixes: aeb5104 ("Initial commit")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
img/app/image/etc/mdev.conf | 5 ++++-
vm/sys/net/image/etc/mdev.conf | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/img/app/image/etc/mdev.conf b/img/app/image/etc/mdev.conf
index 7382067..df215b9 100644
--- a/img/app/image/etc/mdev.conf
+++ b/img/app/image/etc/mdev.conf
@@ -1,8 +1,11 @@
# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2021-2023 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2021-2023, 2025 Alyssa Ross <hi@alyssa.is>

-$MODALIAS=.* 0:0 0 ! +importas -Siu MODALIAS modprobe -q $MODALIAS
$INTERFACE=.* 0:0 0 ! +/etc/mdev/iface
$MODALIAS=virtio:d0000001Av.* 0:0 0 ! +/etc/mdev/virtiofs
dri/card0 0:0 660 +background { /etc/mdev/listen card0 }
snd/controlC0 0:0 660 +background { /etc/mdev/listen controlC0 }
+
+# Don't change mode of other device nodes created by devtmpfs.
+.* 0:0 0 !
diff --git a/vm/sys/net/image/etc/mdev.conf b/vm/sys/net/image/etc/mdev.conf
index 412f7f5..2a7e5fe 100644
--- a/vm/sys/net/image/etc/mdev.conf
+++ b/vm/sys/net/image/etc/mdev.conf
@@ -1,5 +1,8 @@
# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2021, 2025 Alyssa Ross <hi@alyssa.is>

-$MODALIAS=.* 0:0 0 ! +importas -Siu MODALIAS modprobe -q $MODALIAS
$INTERFACE=.* 0:0 0 ! +/etc/mdev/iface
+
+# Don't change mode of other device nodes created by devtmpfs.
+.* 0:0 0 !
--
2.51.0