git: c1ad5b4b10c5 - main - cd9660: Apply the file and directory mode masks bits to all 12 access bits

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 06 Dec 2024 22:48:24 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=c1ad5b4b10c5e426d3d782b7216a038187419a1e

commit c1ad5b4b10c5e426d3d782b7216a038187419a1e
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-12-06 22:40:35 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-12-06 22:40:35 +0000

    cd9660: Apply the file and directory mode masks bits to all 12 access bits
    
    This permits the mask bits to control the upper 3 bits used for setuid,
    setgid, and sticky permissions.  While here, clarify the manpage language
    as non-Rockridge volumes with extended attributes can also supply users
    and groups along with permissions.
    
    Reviewed by:    olce
    Fixes:          82f2275b73e5 cd9660: Add support for mask,dirmask,uid,gid options
    Differential Revision:  https://reviews.freebsd.org/D47357
---
 sbin/mount_cd9660/mount_cd9660.8 | 23 ++++++++++++-----------
 sys/fs/cd9660/cd9660_vfsops.c    |  2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/sbin/mount_cd9660/mount_cd9660.8 b/sbin/mount_cd9660/mount_cd9660.8
index 017ad7ee9a11..19c3ca5cf012 100644
--- a/sbin/mount_cd9660/mount_cd9660.8
+++ b/sbin/mount_cd9660/mount_cd9660.8
@@ -73,30 +73,31 @@ version number.
 .It Fl G Ar group
 Set the group of the files in the file system to
 .Ar group .
-The default gid on non-Rockridge volumes is zero.
+The default gid on volumes without extended attributes or Rockridge extensions
+is zero.
 .It Fl U Ar user
 Set the owner of the files in the file system to
 .Ar user .
-The default uid on non-Rockridge volumes is zero.
+The default uid on volumes without extended attributes or Rockridge extensions
+is zero.
 .It Fl m Ar mask
 Specify the maximum file permissions for files
 in the file system.
-(For example, a
+For example, a
 .Ar mask
 of
-.Li 755
-specifies that, by default, the owner should have
-read, write, and execute permissions for files, but
-others should only have read and execute permissions).
+.Li 544
+limits the owner to
+read and execute permissions for files and
+others to only read permission.
 See
 .Xr chmod 1
 for more information about octal file modes.
-Only the nine low-order bits of
-.Ar mask
-are used.
 The default
 .Ar mask
-on non-Rockridge volumes is 755.
+is 7777.
+The default permissions on volumes without extended attributes or Rockridge
+extensions is 555.
 .It Fl M Ar mask
 Specify the maximum file permissions for directories
 in the file system.
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 814f49f58ae1..b4db4c4f7331 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -394,7 +394,7 @@ iso_mountfs(struct vnode *devvp, struct mount *mp)
 	isomp->im_mountp = mp;
 	isomp->im_dev = dev;
 	isomp->im_devvp = devvp;
-	isomp->im_fmask = isomp->im_dmask = ACCESSPERMS;
+	isomp->im_fmask = isomp->im_dmask = ALLPERMS;
 
 	vfs_flagopt(mp->mnt_optnew, "norrip", &isomp->im_flags, ISOFSMNT_NORRIP);
 	vfs_flagopt(mp->mnt_optnew, "gens", &isomp->im_flags, ISOFSMNT_GENS);