[elbe-devel] [PATCH v2] elbepack: imgutils: protect against race between losetup() and udev
John Ogness
jogness at linutronix.de
Wed Feb 19 12:19:09 CET 2025
On 2025-02-19, Thomas Weißschuh <thomas.weissschuh at linutronix.de> wrote:
> After creation of the loop device through losetup, udev reconfigures it.
> Partitions are rescanned, removing and then readding their device nodes.
> This introduces a race window where ELBE tries to access the non-existent
> partition device nodes after creating the loop device.
> The involvment of udev is unnecessary anyways as devtmpfs will properly create
> the partition device nodes on its won.
>
> Use a file lock to synchronize the accesses between udev and ELBE.
> The lock will be dropped automatically when the filedescriptor is closed
> at the end of the contextmanager.
>
> Reported-by: John Ogness <jogness at linutronix.de>
> Link: https://systemd.io/BLOCK_DEVICE_LOCKING
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
Reviewed-by: John Ogness <john.ogness at linutronix.de>
More information about the elbe-devel
mailing list