This breaks my memory file system for building release.
I have this line in my /etc/fstab

/dev/sd0b /build mfs rw,noperm,nodev,nosuid,-s=2064348,noauto

# mount /build
mount_mfs: /dev/sd0b: Block device required

According to ktrace this command fails.
# /sbin/mount_mfs -o rw -o noperm -o nodev -o nosuid -s 2064348 -o noauto 
/dev/sd0b /build

Without this commit it works,

bluhm

On Thu, Aug 25, 2022 at 11:09:54AM -0600, Klemens Nanni wrote:
> CVSROOT:      /cvs
> Module name:  src
> Changes by:   k...@cvs.openbsd.org    2022/08/25 11:09:54
>
> Modified files:
>       lib/libutil    : opendev.3 opendev.c
>
> Log message:
> Only return file descriptors to block or character devices
>
> If the requested path contained a slash, opendev(3) blindly opened the file
> and returned a file descriptor to it.
>
> Check for block or character devices (according to OPENDEV_BLCK) and fail
> for other types.
>
> Spotted through installboot(8) which happily opened a stage file as device
> when forgetting the device argument:
> # installboot -v ./biosboot
> Using / as root
> installing bootstrap on ./biosboot
> using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
> installboot: disklabel: ./biosboot: Inappropriate ioctl for device
>
> This makes it fail earlier, as expected:
> # installboot -v ./biosboot
> installboot: open: ./biosboot: Block device required
>
> The case where opendev(3) is passed a string not containing a slash, i.e.
> a supposed DUID, is fine, as diskmap(4) will ensure that only valid device
> paths are returned, if the DUID is valid.
>
> Feedback OK millert

Reply via email to