]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: set clock group for PTP and RTC devices
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 16 Jan 2025 14:34:47 +0000 (15:34 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Jan 2025 20:12:47 +0000 (21:12 +0100)
Add a new group for clock devices to enable applications like linuxptp
to open clocks without root privileges.

README
meson.build
meson_options.txt
rules.d/50-udev-default.rules.in
sysusers.d/basic.conf.in

diff --git a/README b/README
index 2480f10d5dc07fc60b28f131d347db930e36331c..7e2fcda060efda5c0d11b20957c7b9c4c64ed82f 100644 (file)
--- a/README
+++ b/README
@@ -368,7 +368,8 @@ USERS AND GROUPS:
         need to be resolvable by getgrnam() at any time, even in the very early
         boot stages, where no other databases and network are available:
 
-        audio, cdrom, dialout, disk, input, kmem, kvm, lp, render, tape, tty, video
+        audio, cdrom, clock, dialout, disk, input, kmem, kvm, lp, render, tape,
+        tty, video
 
         During runtime, the journal daemon requires the "systemd-journal" system
         group to exist. New journal files will be readable by this group (but
index 5c364e137903e30085115dbeba8c4f570ea86446..9e1963970c25b585fb2fb002e6ca5d45cfba5c31 100644 (file)
@@ -937,6 +937,7 @@ static_ugids = []
 foreach option : ['adm-gid',
                   'audio-gid',
                   'cdrom-gid',
+                  'clock-gid',
                   'dialout-gid',
                   'disk-gid',
                   'input-gid',
index edf8053e51478ef1da37ca16ee2049d84ab0d5d2..c616f23297585de765e1fee3ad71a284b4ba5e58 100644 (file)
@@ -291,6 +291,8 @@ option('audio-gid', type : 'integer', value : 0,
        description : 'soft-static allocation for the "audio" group')
 option('cdrom-gid', type : 'integer', value : 0,
        description : 'soft-static allocation for the "cdrom" group')
+option('clock-gid', type : 'integer', value : 0,
+       description : 'soft-static allocation for the "clock" group')
 option('dialout-gid', type : 'integer', value : 0,
        description : 'soft-static allocation for the "dialout" group')
 option('disk-gid', type : 'integer', value : 0,
index 8fa518cd8f92152cd9138d6c120e2f9bafe01e15..078a78ad1ae56e882c41bae6af44c3d27d761665 100644 (file)
@@ -10,6 +10,7 @@ SUBSYSTEM=="block", KERNEL=="md*", ENV{ID_IGNORE_DISKSEQ}="1"
 
 SUBSYSTEM=="virtio-ports", KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"
 
+SUBSYSTEM=="rtc", GROUP="clock", MODE="0660"
 # select "system RTC" or just use the first one
 SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc"
 SUBSYSTEM=="rtc", KERNEL=="rtc0", SYMLINK+="rtc", OPTIONS+="link_priority=-100"
@@ -30,6 +31,7 @@ SUBSYSTEM=="pci|usb|platform", IMPORT{builtin}="path_id"
 
 SUBSYSTEM=="net", IMPORT{builtin}="net_driver"
 
+SUBSYSTEM=="ptp", GROUP="clock", MODE="0660"
 SUBSYSTEM=="ptp", ATTR{clock_name}=="KVM virtual PTP", SYMLINK+="ptp_kvm"
 SUBSYSTEM=="ptp", ATTR{clock_name}=="hyperv", SYMLINK+="ptp_hyperv"
 
index 84bbe3854f99871a5bf114bbb3494077282511dc..503a4c4dac0fcfd647aa6f15b72d28be3bbfb0af 100644 (file)
@@ -25,6 +25,7 @@ g utmp    {{UTMP_GID   }}     -            -
 # Physical and virtual hardware access groups
 g audio   {{AUDIO_GID  }}     -            -
 g cdrom   {{CDROM_GID  }}     -            -
+g clock   {{CLOCK_GID  }}     -            -
 g dialout {{DIALOUT_GID}}     -            -
 g disk    {{DISK_GID   }}     -            -
 g input   {{INPUT_GID  }}     -            -