diff options
author | Miroslav Lichvar <mlichvar@redhat.com> | 2025-01-16 15:34:47 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2025-01-16 21:12:47 +0100 |
commit | af96ccfc24bc4803078a46b4ef2cdeb5decdfbcd (patch) | |
tree | 97004ef839bf26028cea3a83838fc4a29162ac92 | |
parent | test: add link to Ubuntu autopkgtest status page in README (diff) | |
download | systemd-af96ccfc24bc4803078a46b4ef2cdeb5decdfbcd.tar.xz systemd-af96ccfc24bc4803078a46b4ef2cdeb5decdfbcd.zip |
udev: set clock group for PTP and RTC devices
Add a new group for clock devices to enable applications like linuxptp
to open clocks without root privileges.
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | meson_options.txt | 2 | ||||
-rw-r--r-- | rules.d/50-udev-default.rules.in | 2 | ||||
-rw-r--r-- | sysusers.d/basic.conf.in | 1 |
5 files changed, 8 insertions, 1 deletions
@@ -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 diff --git a/meson.build b/meson.build index 5c364e1379..9e1963970c 100644 --- a/meson.build +++ b/meson.build @@ -937,6 +937,7 @@ static_ugids = [] foreach option : ['adm-gid', 'audio-gid', 'cdrom-gid', + 'clock-gid', 'dialout-gid', 'disk-gid', 'input-gid', diff --git a/meson_options.txt b/meson_options.txt index edf8053e51..c616f23297 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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, diff --git a/rules.d/50-udev-default.rules.in b/rules.d/50-udev-default.rules.in index 8fa518cd8f..078a78ad1a 100644 --- a/rules.d/50-udev-default.rules.in +++ b/rules.d/50-udev-default.rules.in @@ -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" diff --git a/sysusers.d/basic.conf.in b/sysusers.d/basic.conf.in index 84bbe3854f..503a4c4dac 100644 --- a/sysusers.d/basic.conf.in +++ b/sysusers.d/basic.conf.in @@ -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 }} - - |