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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ymg7dihxLG923vs3@kroah.com>
Date:   Tue, 26 Apr 2022 20:35:34 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Demi Marie Obenour <demi@...isiblethingslab.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Block Mailing List <linux-block@...r.kernel.org>,
        Linux Filesystem Mailing List <linux-fsdevel@...r.kernel.org>
Subject: Re: Race-free block device opening

On Tue, Apr 26, 2022 at 02:12:22PM -0400, Demi Marie Obenour wrote:
> Right now, opening block devices in a race-free way is incredibly hard.
> The only reasonable approach I know of is sd_device_new_from_path() +
> sd_device_open(), and is only available in systemd git main.  It also
> requires waiting on systemd-udev to have processed udev rules, which can
> be a bottleneck.  There are better approaches in various special cases,
> such as using device-mapper ioctls to check that the device one has
> opened still has the name and/or UUID one expects.  However, none of
> them works for a plain call to open(2).

Why do you call open(2) on a block device?

> A much better approach would be for udev to point its symlinks at
> "/dev/disk/by-diskseq/$DISKSEQ" for non-partition disk devices, or at
> "/dev/disk/by-diskseq/${DISKSEQ}p${PARTITION}" for partitions.

You can do that today with udev rules, right?

> A
> filesystem would then be mounted at "/dev/disk/by-diskseq" that provides
> for race-free opening of these paths.

How would it be any less race-free than just open("/dev/sda1") is?

> This could be implemented in
> userspace using FUSE, either with difficulty using the current kernel
> API, or easily and efficiently using a new kernel API for opening a
> block device by diskseq + partition.  However, I think this should be
> handled by the Linux kernel itself.
> 
> What would be necessary to get this into the kernel?

Get what exactly?  I don't see anything the kernel needs to do here
specifically.  Normally block devices are accessed using mount(2), not
open(2).  Do you want a new mount(2)-type api?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ