You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "patacongo (via GitHub)" <gi...@apache.org> on 2023/08/14 20:21:34 UTC

[GitHub] [nuttx] patacongo commented on issue #10197: binfmt need support ST_NOSUID

patacongo commented on issue #10197:
URL: https://github.com/apache/nuttx/issues/10197#issuecomment-1678004065

   ST_NOSUID is a status bit value reported by statvfs() (https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html).  The bit field of reported status bits is required to provided by the f_flag field of the statvfs structure (https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html).  The only required fields are ST_RDONLY and ST_NOSUID.
   
   These are unrelated to the file system type.  These are specified when the file system is mounted.  The behavior does depend on what is returned by the stat() of the file.  All file systems support ST_NOSUID is some fashion.  If the file system stat() never returns the S_ISUID or S_ISGID flags, then the ST_NOSUID mount flag can have no effect.  If the file system stat() never returns st_uid or st_gid, then the switch to EIUD:EGID of root:root (0:0) is still possible.
   
   I suspect that support for ST_NOSUID flag in binfmt would be independent of the file system type.  If some file systems do not fully support all behaviors, that does not invalidate the requirement.
   
   The mount() interface is, apparently, not specified by POSIX, is left to be implementation defined.  See https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap03.html which says:
   
   > Mount Point
   >
   > The directory on which a "mounted file system" is mounted. This term, like mount() and umount(), was not included because it was implementation-defined.
   
   The NuttX mount() interface generally follows the Linux mount(https://man7.org/linux/man-pages/man2/mount.2.html) semantics. There are numerous Linux mount() flags including the MS_RDONLY and MS_NOSUID flags of interest.  These settings would need to be retained in the i-node of the mount point.  The state of these mount flags would be reflected by the statvfs() ST_RDONLY and ST_NOSUID status bits.
   
   The FreeBSD() mount() interface (https://man.freebsd.org/cgi/man.cgi?query=mount&sektion=2&n=1) is similar and support many mount flags including the flags of interest with similar but different names, MNT_RDONLY and MNT_NOSUID.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org