[Yaffs] SGID operation with directories

Charles Manning manningc2 at actrix.gen.nz
Thu May 25 02:39:21 BST 2006


Tom

Thanx for the concise report on this. It took a bit longer for me to get 
around to sorting this out than I would have liked, been a bit busy!

I have just checked in a fix to this. It is a two-liner so is easy to apply if 
you want to do this without picking up the checkpointing stuff, though adding 
the checkpointing would make your system mount faster too.

The fix is:
http://www.aleph1.co.uk/cgi-bin/viewcvs.cgi/yaffs2/yaffs_fs.c?r1=1.48&r2=1.49

-- Charles

On Tuesday 09 May 2006 05:27, Tom Hansen wrote:
> Here is a transcript of the test session, in which I compare the
> behavior of the ramfs mounted on /tmp with that of YAFFS.
>
> root at ts-7250:~ $ cd /tmp
> root at ts-7250:/tmp $ mkdir testsgid
> root at ts-7250:/tmp $ chgrp bin testsgid
> root at ts-7250:/tmp $ chmod g+s testsgid
> root at ts-7250:/tmp $ cd testsgid
> root at ts-7250:/tmp/testsgid $ ls -Fla
> drwxrwsr-x    1 root     bin             0 May  8 12:18 ./
> drwxrwxrwt    1 root     root            0 Dec 31  1969 ../
> root at ts-7250:/tmp/testsgid $ touch testfile
> root at ts-7250:/tmp/testsgid $ ls -Fla
> drwxrwsr-x    1 root     bin             0 May  8 12:18 ./
> drwxrwxrwt    1 root     root            0 Dec 31  1969 ../
> -rw-rw-r--    1 root     bin             0 May  8 12:19 testfile
> root at ts-7250:/tmp/testsgid $ cd
> root at ts-7250:~ $ mkdir testsgid
> root at ts-7250:~ $ chgrp bin testsgid
> root at ts-7250:~ $ chmod g+s testsgid
> root at ts-7250:~ $ cd testsgid
> root at ts-7250:~/testsgid $ ls -Fla
> drwxrwsr-x    1 root     bin           512 May  8 12:19 ./
> drwxr-xr-x    1 root     root          512 Oct 26  2005 ../
> root at ts-7250:~/testsgid $ touch testfile
> root at ts-7250:~/testsgid $ ls -Fla
> drwxrwsr-x    1 root     bin           512 May  8 12:19 ./
> drwxr-xr-x    1 root     root          512 Oct 26  2005 ../
> -rw-rw-r--    1 root     root            0 May  8 12:20 testfile
> root at ts-7250:~/testsgid $
>
> You can see that the new "testfile" has a group ID of "bin" in the first
> example, but retains "root" in the second.
>
> Here is the output from /proc/yaffs:
>
> $Id: yaffs_fs.c,v 1.3 2005/01/25 00:38:25 eddie Exp $
> $Id: yaffs_guts.c,v 1.2 2005/01/10 18:27:13 eddie Exp $
>
> Device yaffs
> startBlock......... 1
> endBlock........... 1855
> chunkGroupBits..... 0
> chunkGroupSize..... 1
> nErasedBlocks...... 7
> nTnodesCreated..... 7600
> nFreeTnodes........ 2513
> nObjectsCreated.... 4600
> nFreeObjects....... 2511
> nFreeChunks........ 2273
> nPageWrites........ 1036366
> nPageReads......... 2450159
> nBlockErasures..... 17124
> nGCCopies.......... 393757
> garbageCollections. 17122
> passiveGCs......... 18
> nRetriedWrites..... 0
> nRetireBlocks...... 0
> eccFixed........... 0
> eccUnfixed......... 0
> tagsEccFixed....... 0
> tagsEccUnfixed..... 8
> cacheHits.......... 0
> nDeletedFiles...... 7751
> nUnlinkedFiles..... 10282
> nBackgroudDeletions 0
> useNANDECC......... 1
>
> Also, my /etc/fstab:
>
> proc    /proc   proc    defaults        0 0
> /dev/mtdblock/1 / yaffs defaults,noatime,grpid 0 0
> ramfs /tmp ramfs mode=1777 0 0
>
> Charles Manning wrote:
> > On Thursday 27 April 2006 22:25, Tom Hansen wrote:
> >> I'm using YAFFS with the 2.4.26-ts9 kernel on a Technologics TS-7250.
> >
> > Is that YAFFS2?
> >
> >> When I set the SGID bit on a directory, files created under it do not
> >> inherit the group ID, and directories created under it inherit neither
> >> the group ID nor the SGID bit.
> >>
> >> I have a ramfs mount active at the same time (on /tmp), and the correct
> >> SGID behavior occurs there, so it does seem to be a filesystem-specific
> >> issue.
> >>
> >> Is there some mount option I should be using?  I tried the 'grpid'
> >> mount option, but it had no effect on the problem.
> >
> > Could you send a bash script that can demo the problem?
> >
> > YAFFS does not listen to any mount options itself, but the VFS can be
> > doing things on its behalf.
> >
> > -- Charles



More information about the yaffs mailing list