]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/shared/loop-util.c
loop-util: track CLOCK_MONOTONIC timestamp immediately before attaching a loopback...
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Apr 2021 14:08:43 +0000 (16:08 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Apr 2021 15:20:38 +0000 (17:20 +0200)
commit8ede1e86b2cfdbe7bb1e1913a08e068a82d4532c
treeaeb7d35d52f2d6433896719d820b941801c55da7
parent8626b43be42b9db065f8fdf2b057990ef511150e
loop-util: track CLOCK_MONOTONIC timestamp immediately before attaching a loopback device

This is similar to the preceding work to store the uevent seqnum, but
this stores the CLOCK_MONOTONIC timestamp.

Why? This allows to validate udev database entries, to determine if they
were created *after* we attached the device.

The uevent seqnum logic allows us to validate uevent, and the timestamp
database entries, hence together we should be able to validate both
sources of truth for us.

(note that this is all racy, just a bit less racy, since we cannot
atomically attach loopback devices and get the timestamp for it, the
same way we can't get the uevent seqnum. Thus is shortens the race
window, but doesn#t close it).
src/shared/loop-util.c
src/shared/loop-util.h