Re: exportfs recursively processes backslash escapes in exports file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Mar 30, 2022, at 11:39 AM, наб <nabijaczleweli@xxxxxxxxxxxxxxxxxx> wrote:
> 
> Following up with more testing:
> 
> Given:
>  $ mkdir 'a \134053 b' 'a \053 b' 'a + b'
>  $ echo a > 'a \134053 b'/a
>  $ echo b > 'a \053 b'/b
>  $ echo c > 'a + b'/c
> (henceforth dubbed a, b, c, respectively), such that, trivially:
>  $ ls -lR 'a \134053 b' 'a \053 b' 'a + b'
>  'a \053 b':
>  total 4
>  -rw-r--r-- 1 nabijaczleweli users 2 Mar 30 17:17 b
> 
>  'a \134053 b':
>  total 4
>  -rw-r--r-- 1 nabijaczleweli users 2 Mar 30 17:17 a
> 
>  'a + b':
>  total 4
>  -rw-r--r-- 1 nabijaczleweli users 2 Mar 30 17:17 c
> 
> And each is exported as such:
>  # exportfs -vo fsid=100 szarotka:'/tmp/a \134053 b'
>  # exportfs -vo fsid=200 szarotka:'/tmp/a \053 b'
>  # exportfs -vo fsid=300 szarotka:'/tmp/a + b'
>  exporting szarotka.nabijaczleweli.xyz:/tmp/a \134053 b
>  exporting szarotka.nabijaczleweli.xyz:/tmp/a \053 b
>  exporting szarotka.nabijaczleweli.xyz:/tmp/a + b
> 
> Then:
>  If only a is exported, the following state is achieved:
>    # exportfs
>    /tmp/a + b      szarotka.nabijaczleweli.xyz
>    /mnt/filling/machine/1200-S121
>                    <world>
>    # exportfs -s
>    /tmp/a\040+\040b  szarotka.nabijaczleweli.xyz(ro,wdelay,root_squash,no_subtree_check,fsid=100,sec=sys,ro,secure,root_squash,no_all_squash)
>    /mnt/filling/machine/1200-S121  *(rw,async,wdelay,crossmnt,no_root_squash,no_subtree_check,mountpoint,sec=sys,rw,secure,no_root_squash,no_all_squash)
>    $ cat /var/lib/nfs/etab
>    /tmp/a\040\134134053\040b       szarotka.nabijaczleweli.xyz(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,fsid=100,anonuid=65534,anongid=65534,sec=sys,ro,secure,root_squash,no_all_squash)
>    /mnt/filling/machine/1200-S121  *(rw,async,wdelay,hide,crossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,mountpoint,anonuid=65534,anongid=65534,sec=sys,rw,secure,no_root_squash,no_all_squash)
> 
>  If then b is also exported, the following state is achieved:
>    # exportfs
>    /tmp/a + b      szarotka.nabijaczleweli.xyz
>    /mnt/filling/machine/1200-S121
>                    <world>
>    # exportfs -s
>    /tmp/a\040+\040b  szarotka.nabijaczleweli.xyz(ro,wdelay,root_squash,no_subtree_check,fsid=100,sec=sys,ro,secure,root_squash,no_all_squash)
>    /mnt/filling/machine/1200-S121  *(rw,async,wdelay,crossmnt,no_root_squash,no_subtree_check,mountpoint,sec=sys,rw,secure,no_root_squash,no_all_squash)
>    $ cat /var/lib/nfs/etab
>    /tmp/a\040+\040b        szarotka.nabijaczleweli.xyz(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,fsid=100,anonuid=65534,anongid=65534,sec=sys,ro,secure,root_squash,no_all_squash)
>    /tmp/a\040\134053\040b  szarotka.nabijaczleweli.xyz(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,fsid=200,anonuid=65534,anongid=65534,sec=sys,ro,secure,root_squash,no_all_squash)
>    /mnt/filling/machine/1200-S121  *(rw,async,wdelay,hide,crossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,mountpoint,anonuid=65534,anongid=65534,sec=sys,rw,secure,no_root_squash,no_all_squash)
> 
>  If then c is also exported, the following state is achieved:
>    # exportfs
>    /tmp/a + b      szarotka.nabijaczleweli.xyz
>    /mnt/filling/machine/1200-S121
>                    <world>
>    # exportfs -s
>    /tmp/a\040+\040b  szarotka.nabijaczleweli.xyz(ro,wdelay,root_squash,no_subtree_check,fsid=300,sec=sys,ro,secure,root_squash,no_all_squash)
>    /mnt/filling/machine/1200-S121  *(rw,async,wdelay,crossmnt,no_root_squash,no_subtree_check,mountpoint,sec=sys,rw,secure,no_root_squash,no_all_squash)
>    $ cat /var/lib/nfs/etab
>    /tmp/a\040+\040b        szarotka.nabijaczleweli.xyz(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,fsid=300,anonuid=65534,anongid=65534,sec=sys,ro,secure,root_squash,no_all_squash)
>    /mnt/filling/machine/1200-S121  *(rw,async,wdelay,hide,crossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,mountpoint,anonuid=65534,anongid=65534,sec=sys,rw,secure,no_root_squash,no_all_squash)
> 
> Note how a and b were folded into c(?) but not into each other,
> which is especially concerning given, that, in /every/ case, regardless
> which are exported:
>  szarotka$ mkdir a b c
>  szarotka# mount -t nfs tarta:'/tmp/a \134053 b' a
>  mount.nfs: mounting tarta:/tmp/a \134053 b failed, reason given by server: No such file or directory
>  szarotka# mount -t nfs tarta:'/tmp/a \053 b' b
>  mount.nfs: mounting tarta:/tmp/a \053 b failed, reason given by server: No such file or directory
>  szarotka# mount -t nfs tarta:'/tmp/a + b' c
>  nabijaczleweli@szarotka:/tmp$ l c
>  total 4.0K
>  -rw-r--r-- 1 nabijaczleweli users 2 Mar 30 17:17 c
> 
> This could be spun as an "accidental exposure" bug or w/e, but this is
> primarily just insane. Or, if it's somehow expected and working as
> intended, then it warrants a note in the manual, at least.
> 
> Best,
> наб
> 
> Please keep me in CC, as I'm not subscribed.

It's likely an issue in exportfs itself, so Cc: Steve.

You can see what the kernel thinks is its reality with:

# cat /proc/net/rpc/nfsd.export/content
#path domain(flags)
/export/tmp	*(rw,insecure,no_root_squash,async,wdelay,no_subtree_check,uuid=6682b258:02a54061:815cee14:242ddfc2,sec=1:390003:390004:390005)


--
Chuck Lever







[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux