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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E1477B9.1050701@kernel.dk>
Date:	Wed, 06 Jul 2011 16:56:57 +0200
From:	Jens Axboe <axboe@...nel.dk>
To:	Roland Dreier <roland@...nel.org>
CC:	open list <linux-kernel@...r.kernel.org>
Subject: Re: warning because of race between userspace and add_disk()?

On 2011-07-06 02:14, Roland Dreier wrote:
> Hi Jens!
> 
> I'm seeing the warning below (with 3.0-rc5) when I hot-add a disk.
> The system has a JBOD with 4 SAS paths, so we get 4 /dev/sdXX for the
> disk (I don't think this is strictly required to trigger this, but I
> think it makes the race bigger).
> 
> What I _think_ is happening is that add_disk() exposes the /dev/sdXX
> device to userspace before it does disk_add_events(), and the
> multipath daemon immediately tries to open the device.  This means
> that blkdev_get() (called from blkdev_open()) races with
> disk_add_events() and so the first call to disk_block_events() returns
> immediately because of
> 
> 	struct disk_events *ev = disk->ev;
> 	if (!ev)
> 		return;
> 
> but then on the way out, disk_unblock_events() finds that disk->ev has
> been set and so hits the warning.
> 
> I guess the fix would be to be more careful about the order we expose
> things when registering disks?

It certainly looks like it, we need to order disk_add_events() before
register_disk() or handle this more gracefully. I'll cook up a patch.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ