lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250317-loop-uevent-changed-v1-1-cb29cb91b62d@linutronix.de>
Date: Mon, 17 Mar 2025 15:13:25 +0100
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Jens Axboe <axboe@...nel.dk>, Martijn Coenen <maco@...roid.com>, 
 Alyssa Ross <hi@...ssa.is>
Cc: John Ogness <john.ogness@...utronix.de>, linux-block@...r.kernel.org, 
 linux-kernel@...r.kernel.org, stable@...r.kernel.org, 
 Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Subject: [PATCH] loop: Properly send KOBJ_CHANGED uevent for disk device

The wording "uncork" in the code comment indicates that it is expected that
the suppressed event instances are automatically sent after unsuppressing.
This is not the case, they are discarded.
In effect this means that no "changed" events are emitted on the device
itself by default. On the other hand each discovered partition does trigger
a "changed" event on the loop device itself. Therefore no event is emitted for
devices without partitions.

This leads to udev missing the device creation and prompting workarounds in
userspace, see the linked util-linux/losetup bug.

Explicitly emit the events and drop the confusingly worded comments.

Link: https://github.com/util-linux/util-linux/issues/2434
Fixes: 3448914e8cc5 ("loop: Add LOOP_CONFIGURE ioctl")
Cc: stable@...r.kernel.org
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
---
 drivers/block/loop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index c05fe27a96b64f1f1ea3868510fdd0c7f4937f55..fbc67ff29e07c15f2e3b3e225a4a37df016fe9de 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -654,8 +654,8 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
 
 	error = 0;
 done:
-	/* enable and uncork uevent now that we are done */
 	dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0);
+	kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
 	return error;
 
 out_err:
@@ -1115,8 +1115,8 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
 	if (partscan)
 		clear_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
 
-	/* enable and uncork uevent now that we are done */
 	dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0);
+	kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
 
 	loop_global_unlock(lo, is_loop);
 	if (partscan)

---
base-commit: 4701f33a10702d5fc577c32434eb62adde0a1ae1
change-id: 20250307-loop-uevent-changed-aa3690f43e03

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@...utronix.de>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ