RE: nfs setgid inheritance test

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

 



Hello Christian, 

> > Thank you for your response.
> >
> > > Afaict, nothing has changed and the test should still be skipped.
> > > I'm not sure I ever send a patch to skip this test specifically for
> > > nfs though. I might just not have gotten around to that.
> > >
> > > Can you please also send the exact steps for reproducing this issue?
> >
> > The reproducing steps is as follows:
> >
> > Client & Server:
> > 1. Install xfstests
> > 2. # yum install libcap-devel
> >
> > Server:
> > 1. Set exports file.
> > # echo "/nfstest
> *(rw,insecure,no_subtree_check,no_root_squash,fsid=1)
> > /nfsscratch
> *(rw,insecure,no_subtree_check,no_root_squash,fsid=2)" >/etc/exports
> > 2. Restart services.
> > # systemctl restart rpcbind.service
> > # systemctl restart nfs-server.service # systemctl restart
> > rpc-statd.service
> >
> > Client:
> > 1. Create mount point
> > # mkdir -p /mnt/test
> > # mkdir -p /mnt/scratch
> > 2. Cofigure NFS parameters.
> > # echo "FSTYP=nfs
> > TEST_DEV=server_IP:/nfstest
> > TEST_DIR=/mnt/test
> > SCRATCH_DEV=server_IP:/nfsscratch
> > SCRATCH_MNT=/mnt/scratch
> > export KEEP_DMESG=yes
> > NFS_MOUNT_OPTIONS=\"-o vers=3\"">/var/lib/xfstests/local.config
> > 3. Test
> > # ./check -d generic/633
> 
> The tests should pass with "no_root_squash" set. The root cause of the original
> issue was that files created by root are squashed to 65534 which breaks setgid
> inheritance rules for S_ISGID directories.
> 
> But without root squashing the tests should succeed. If I reproduce this exactly
> with your instructions on a v6.2-rc1 kernel I get a success as expected.
> 
> I don't think you've told me What kernel you are testing this on?

Sorry, I didn't make it clearly before.
I tested on kernel 5.14.0-162.6.1.el9_1.x86_64, and it failed with "no_root_squash" set.
But after I apply commit 1639a49ccdce58ea248841ed9b23babcce6dbb0b onto kernel 5.14.0-162.6.1.el9_1.x86_64, 
the case will pass.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=1639a49ccdce58ea248841ed9b23babcce6dbb0b
This patch moves S_ISGID stripping into the vfs, so NFS can solve the setgid inheritance problem.

But although the test can succeed, when the root is squashed to nobody, is it still suitable to use generic/633 to test?

Thanks~~

★☆★☆★☆★☆FNSTオンラインへようこそ★☆★☆★☆★☆
   FNST最新情報盛りたくさん!
   http://online.fnst.cn.fujitsu.com/fnst-news
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆

> -----Original Message-----
> From: Christian Brauner <brauner@xxxxxxxxxx>
> Sent: Saturday, December 31, 2022 8:10 PM
> To: Cui, Yue/崔 悦 <cuiyue-fnst@xxxxxxxxxxx>
> Cc: Christian Brauner <christian@xxxxxxxxxx>; linux-nfs@xxxxxxxxxxxxxxx
> Subject: Re: nfs setgid inheritance test
> 
> On Sat, Dec 31, 2022 at 02:25:52AM +0000, cuiyue-fnst@xxxxxxxxxxx wrote:
> > Hi, Christian
> >
> > Thank you for your response.
> >
> > > Afaict, nothing has changed and the test should still be skipped.
> > > I'm not sure I ever send a patch to skip this test specifically for
> > > nfs though. I might just not have gotten around to that.
> > >
> > > Can you please also send the exact steps for reproducing this issue?
> >
> > The reproducing steps is as follows:
> >
> > Client & Server:
> > 1. Install xfstests
> > 2. # yum install libcap-devel
> >
> > Server:
> > 1. Set exports file.
> > # echo "/nfstest
> *(rw,insecure,no_subtree_check,no_root_squash,fsid=1)
> > /nfsscratch
> *(rw,insecure,no_subtree_check,no_root_squash,fsid=2)" >/etc/exports
> > 2. Restart services.
> > # systemctl restart rpcbind.service
> > # systemctl restart nfs-server.service # systemctl restart
> > rpc-statd.service
> >
> > Client:
> > 1. Create mount point
> > # mkdir -p /mnt/test
> > # mkdir -p /mnt/scratch
> > 2. Cofigure NFS parameters.
> > # echo "FSTYP=nfs
> > TEST_DEV=server_IP:/nfstest
> > TEST_DIR=/mnt/test
> > SCRATCH_DEV=server_IP:/nfsscratch
> > SCRATCH_MNT=/mnt/scratch
> > export KEEP_DMESG=yes
> > NFS_MOUNT_OPTIONS=\"-o vers=3\"">/var/lib/xfstests/local.config
> > 3. Test
> > # ./check -d generic/633
> 
> The tests should pass with "no_root_squash" set. The root cause of the original
> issue was that files created by root are squashed to 65534 which breaks setgid
> inheritance rules for S_ISGID directories.
> 
> But without root squashing the tests should succeed. If I reproduce this exactly
> with your instructions on a v6.2-rc1 kernel I get a success as expected.
> 
> I don't think you've told me What kernel you are testing this on?
> 
> >
> > Thanks,
> > cuiyue
> >
> > ★☆★☆★☆★☆FNSTオンラインへようこそ★☆★☆★☆★☆
> >    FNST最新情報盛りたくさん!
> >    http://online.fnst.cn.fujitsu.com/fnst-news
> > ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
> >
> > > -----Original Message-----
> > > From: Christian Brauner <brauner@xxxxxxxxxx>
> > > Sent: Friday, December 30, 2022 11:48 PM
> > > To: Cui, Yue <cuiyue-fnst@xxxxxxxxxxx>
> > > Cc: Christian Brauner <christian@xxxxxxxxxx>;
> > > linux-nfs@xxxxxxxxxxxxxxx
> > > Subject: Re: nfs setgid inheritance test
> > >
> > > On Fri, Dec 30, 2022 at 11:11:56AM +0000, cuiyue-fnst@xxxxxxxxxxx wrote:
> > > > Hi, Christian
> > > >
> > > > When I test xfstests on NFS(with no_root_squash), generic/633 fails like
> this:
> > > >
> > > > generic/633       [failed, exit status 1]- output mismatch (see
> > > /var/lib/xfstests/results//generic/633.out.bad)
> > > >     --- tests/generic/633.out     2022-11-23 09:13:48.919484895
> -0500
> > > >     +++ /var/lib/xfstests/results//generic/633.out.bad   2022-11-24
> > > 05:53:40.836484895 -0500
> > > >     @@ -1,2 +1,4 @@
> > > >      QA output created by 633
> > > >      Silence is golden
> > > >     +vfstest.c: 1642: setgid_create - Success - failure: is_setgid
> > > >     +vfstest.c: 1882: run_test - Operation not supported -
> > > > failure: create
> > > operations in directories with setgid bit set
> > > >     ...
> > > >     (Run 'diff -u /var/lib/xfstests/tests/generic/633.out
> > > > /var/lib/xfstests/results//generic/633.out.bad'  to see the entire
> > > > diff)
> > > >
> > > > We have reported this problem on Feburary.
> > > >
> > >
> https://lore.kernel.org/linux-nfs/OS3PR01MB770539462BE3E7959DAF8B578
> > > 93
> > > > 89@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#u
> > > >
> > > > At that time, the conclusion is NFS should skip this test.
> > > > But I cannot find this patch in the latest xfstests.
> > > > Does NFS still need to skip this test now?
> > >
> > > Afaict, nothing has changed and the test should still be skipped.
> > > I'm not sure I ever send a patch to skip this test specifically for
> > > nfs though. I might just not have gotten around to that.
> > >
> > > Can you please also send the exact steps for reproducing this issue?




[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