NFS bug?

Mikhail E. Zakharov zakharov at ipb.redline.ru
Tue May 11 01:29:10 PDT 2004


Hi!

When playing with NFS under FreeBSD, I've noticed something strange.
You know it's impossible to export 2 directories of the same
filesystem to one nfs-client:

server# cat /etc/exports
/usr/c client
/usr/d client
server# killall -HUP mountd
server# showmount -e
/usr/c                             Everyone

There is no /usr/d exported. And we got errors in /var/log/messages:
mountd[377]: can't change attributes for /usr/d
mountd[377]: bad exports list line /usr/d

But it's possible(!) to fool mountd when using the -network key.
Let's try to export /usr/a as read-only system for the whole network,
and /usr/b writable for one host, and not readable for others. NB! Our
NFS-client (192.168.12.98) is from 192.168.0.0/16 network. See this
example:

server# cat /etc/exports
/usr/a -ro -network 192.168.0.0 -mask 255.255.0.0
/usr/b -mapall=root 192.168.12.98

server# killall -HUP mountd
server# showmount -e
Exports list on localhost:
/usr/b                             192.168.12.98
/usr/a                             192.168.0.0

As you see /usr/a and /usr/b successfully exported without errors.
Now, from the client (192.168.12.98) we can mount both of them:

client# mount server:/usr/b /mnt1
client# mount server:/usr/a /mnt
client# mount
server:/usr/b on /mnt1 (nfs)
server:/usr/a on /mnt (nfs)

When we successfully mounted them on client. Let's make additional
tests:
client# echo "something stupid" > /mnt/test.txt
client# echo "something stupid1" > /mnt1/test1.txt
client# cat /mnt/test.txt
something stupid
client# cat /mnt1/test1.txt
something stupid1

Oh, my God! Both of the exported directories are writable.

Best regards,
Mikhail




More information about the freebsd-bugs mailing list