avoid race between systemd-logind and systemd-udevd in setting ACLs#36444
avoid race between systemd-logind and systemd-udevd in setting ACLs#36444poettering merged 9 commits intosystemd:mainfrom
Conversation
e70fded to
b66f6d2
Compare
|
If access to the stat file is locked, is it possible that udev reads the old state file first, but then sets the acl after logind? |
|
hmm, i wonder if it wouldn't be nicer to just drop the acl mgmt from logind and only do it in udev, and simple trigger the devices again when the session changes? seems much nicer to me as there would be a single owner for ACLs adjustments, not two which fight. |
Hmmmm, that potentially causes infinite loop...
|
|
Maybe, the potential loop can be avoided by using SYNTH_UUID= property in uevent. I will try later. |
b66f6d2 to
bcfa6da
Compare
61af723 to
df9d025
Compare
|
@poettering Updated. PTAL. |
df9d025 to
06b2e0d
Compare
13285c2 to
2303cb9
Compare
This also makes device_in_subsystem() and device_is_devtype() return negative error on critical error
…vent When udevd broadcasts an event for e.g. a graphics device with master-of-seat tag, then previously manager_process_seat_device() was called twice for the event. With this commit, the function is called only once even for an event for such device.
…tting ACLs Previously, both udevd and logind modifies ACLs of a device node. Hence, there exists a race something like the following: 1. udevd reads an old state file, 2. logind updates the state file, and apply new ACLs, 3. udevd applies ACLs based on the old state file. This makes logind not update ACLs but trigger uevents for relevant devices to make ACLs updated by udevd.
As it is now only used by udev-builtin-uaccess.c. This also makes devnode_acl() use fd rather than path to device node.
2303cb9 to
003c6fa
Compare
|
@poettering Thank you for the review. All requests are addressed. PTAL. |
|
Commit 'login,udev: avoid race between systemd-logind and systemd-udevd in setting ACLs' introduced a regression, and permission checks for users owning a session no longer works. Eg: in GNOME, when already logged in clicking on suspend/reboot/poweroff in the menu asks the user for authentication, while it didn't before |
This PR systemd/systemd#36444 caused this bug systemd/systemd#39043, which is fixed in this PR systemd/systemd#39071. In short, `uaccess` doesn't work with `OPTIONS+="static_node=..."` udev rules, and `/dev/snd/timer` is a static node. 258.1 needs to wait for the next staging cycle, so for now let's just use a non-static node.
|
I've recently gotten a regression on one of my machines, which I've bisected to c960ca2
This only happens on one of my machines (AMD EPYC 7642, Supermicro H12SSL-i, Radeon RX 6700XT), not on any of my other AMD machines; on various 6.17 kernels. I'd be happy to help with tracing this, if somebody tells me what to look at. For now, I'll keep using v257 |
Follow-up for #36408.
Hopefully fixes #24026, #28512, and/or #23547.