mount(2) not returning EINVAL with invalid filesystems

Garrett Cooper gcooper at FreeBSD.org
Mon Aug 16 05:41:29 UTC 2010


    mount(2) says it should fail with EINVAL if the magic block is wrong:

     [EINVAL]           The super block for the file system had a bad magic
                        number or an out of range block size.

    This doesn't appear to be the case with a nmount layer though :/.
I didn't find anything conclusive that noted where the issue was
occurring, but I was wondering if anyone knew where it might be
happening?

$ sudo mount_msdosfs /dev/ada0s1b /mnt/
# ...
madvise(0x800c09000,0x1000,0x5,0x8,0x3008,0x5039d0) = 0 (0x0)
nmount(0x800c0d100,0x10,0x0,0x4,0xf0,0x5039d0)	 ERR#1 'Operation not permitted'
write(2,"mount_msdosfs: ",15)			 ERR#9 'Bad file descriptor'
write(2,": ",2)					 ERR#9 'Bad file descriptor'
# ...
mount_msdosfs: /dev/ada0s1b: Operation not permitted
$ sudo mount /dev/ada0s1b /mnt/
# ...
madvise(0x800c0b000,0x1000,0x5,0xa,0x2008,0x505dd8) = 0 (0x0)
nmount(0x800c0d080,0x8,0x0,0x7fffffffdff0,0x70,0x505dd8) ERR#1
'Operation not permitted'
write(2,"mount: ",7)				 ERR#9 'Bad file descriptor'
write(2,": ",2)					 ERR#9 'Bad file descriptor'
# ...
mount: /dev/ada0s1b : Operation not permitted

    This is something small that I've noticed for a while now that
doesn't make sense from a requirements perspective with the manpage.
Thanks!
-Garrett


More information about the freebsd-hackers mailing list