Source-Changes-HG archive

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

[src/netbsd-9]: src/sys Pull up following revision(s) (requested by reinoud i...



details:   https://anonhg.NetBSD.org/src/rev/cc9d6135a150
branches:  netbsd-9
changeset: 365778:cc9d6135a150
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Apr 24 16:39:00 2022 +0000

description:
Pull up following revision(s) (requested by reinoud in ticket #1438):

        sys/compat/netbsd32/netbsd32.h: revision 1.140
        sys/compat/netbsd32/netbsd32_fs.c: revision 1.95
        sys/fs/udf/udf_subr.c: revision 1.169

Fix endian issue with UDF extended attribute handling

Implement support for mounting UDF in compat32
Fixes PR#56801

diffstat:

 sys/compat/netbsd32/netbsd32.h    |  21 +++++++++++-
 sys/compat/netbsd32/netbsd32_fs.c |  70 +++++++++++++++++++++++++++++++++++++-
 sys/fs/udf/udf_subr.c             |   8 ++--
 3 files changed, 92 insertions(+), 7 deletions(-)

diffs (186 lines):

diff -r daa987a1eae2 -r cc9d6135a150 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h    Mon Apr 18 10:57:05 2022 +0000
+++ b/sys/compat/netbsd32/netbsd32.h    Sun Apr 24 16:39:00 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32.h,v 1.123.4.1 2019/11/19 13:36:25 martin Exp $        */
+/*     $NetBSD: netbsd32.h,v 1.123.4.2 2022/04/24 16:39:00 martin Exp $        */
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -1095,6 +1095,25 @@
        int     gmtoff;         /* v3: offset from UTC in seconds */
 };
 
+/* from <udf/udf_mount.h> */
+struct netbsd32_udf_args {
+       uint32_t         version;       /* version of this structure         */
+       netbsd32_charp   fspec;         /* mount specifier                   */
+       int32_t          sessionnr;     /* session specifier, rel of abs     */
+       uint32_t         udfmflags;     /* mount options                     */
+       int32_t          gmtoff;        /* offset from UTC in seconds        */
+
+       uid_t            anon_uid;      /* mapping of anonymous files uid    */
+       gid_t            anon_gid;      /* mapping of anonymous files gid    */
+       uid_t            nobody_uid;    /* nobody:nobody will map to -1:-1   */
+       gid_t            nobody_gid;    /* nobody:nobody will map to -1:-1   */
+
+       uint32_t         sector_size;   /* for mounting dumps/files          */
+
+       /* extendable */
+       uint8_t  reserved[32];
+};
+
 /* from <miscfs/genfs/layer.h> */
 struct netbsd32_layer_args {
        netbsd32_charp target;          /* Target of loopback  */
diff -r daa987a1eae2 -r cc9d6135a150 sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Mon Apr 18 10:57:05 2022 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Sun Apr 24 16:39:00 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_fs.c,v 1.82.4.1 2019/10/16 17:29:49 martin Exp $      */
+/*     $NetBSD: netbsd32_fs.c,v 1.82.4.2 2022/04/24 16:39:00 martin Exp $      */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.82.4.1 2019/10/16 17:29:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.82.4.2 2022/04/24 16:39:00 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,6 +53,7 @@
 #include <fs/tmpfs/tmpfs_args.h>
 #include <fs/msdosfs/bpb.h>
 #include <fs/msdosfs/msdosfsmount.h>
+#include <fs/udf/udf_mount.h>
 #include <ufs/ufs/ufsmount.h>
 #include <miscfs/nullfs/null.h>
 
@@ -794,6 +795,7 @@
                struct netbsd32_iso_args iso_args;
                struct netbsd32_nfs_args nfs_args;
                struct netbsd32_msdosfs_args msdosfs_args;
+               struct netbsd32_udf_args udf_args;
                struct netbsd32_tmpfs_args tmpfs_args;
                struct netbsd32_null_args null_args;
        } fs_args32;
@@ -803,6 +805,7 @@
                struct iso_args iso_args;
                struct nfs_args nfs_args;
                struct msdosfs_args msdosfs_args;
+               struct udf_args udf_args;
                struct tmpfs_args tmpfs_args;
                struct null_args null_args;
        } fs_args;
@@ -928,6 +931,40 @@
                data_seg = UIO_SYSSPACE;
                data = &fs_args.msdosfs_args;
                data_len = sizeof(fs_args.msdosfs_args);
+       } else if (strcmp(mtype, MOUNT_UDF) == 0) {
+               if (data_len != 0 && data_len < sizeof(fs_args32.udf_args))
+                       return EINVAL;
+               if ((flags & MNT_GETARGS) == 0) {
+                       error = copyin(data, &fs_args32.udf_args,
+                           sizeof(fs_args32.udf_args));
+                       if (error)
+                               return error;
+                       fs_args.udf_args.version =
+                           fs_args32.udf_args.version;
+                       fs_args.udf_args.fspec =
+                           NETBSD32PTR64(fs_args32.udf_args.fspec);
+                       fs_args.udf_args.sessionnr =
+                           fs_args32.udf_args.sessionnr;
+                       fs_args.udf_args.udfmflags =
+                           fs_args32.udf_args.udfmflags;
+                       fs_args.udf_args.gmtoff =
+                           fs_args32.udf_args.gmtoff;
+                       fs_args.udf_args.anon_uid =
+                           fs_args32.udf_args.anon_uid;
+                       fs_args.udf_args.anon_gid =
+                           fs_args32.udf_args.anon_gid;
+                       fs_args.udf_args.nobody_uid =
+                           fs_args32.udf_args.nobody_uid;
+                       fs_args.udf_args.nobody_gid =
+                           fs_args32.udf_args.nobody_gid;
+                       fs_args.udf_args.sector_size =
+                           fs_args32.udf_args.sector_size;
+                       memset(fs_args.udf_args.reserved, 0,
+                           sizeof(fs_args.udf_args.reserved));
+               }
+               data_seg = UIO_SYSSPACE;
+               data = &fs_args.udf_args;
+               data_len = sizeof(fs_args.udf_args);
        } else if (strcmp(mtype, MOUNT_NFS) == 0) {
                if (data_len < sizeof(fs_args32.nfs_args))
                        return EINVAL;
@@ -1031,6 +1068,35 @@
                        error = copyout(&fs_args32.iso_args, udata,
                                    sizeof(fs_args32.iso_args));
                        *retval = sizeof(fs_args32.iso_args);
+               } else if (strcmp(mtype, MOUNT_UDF) == 0) {
+                       if (data_len != 0 &&
+                           data_len != sizeof(fs_args.udf_args))
+                               return EINVAL;
+                       fs_args32.udf_args.version =
+                           fs_args.udf_args.version;
+                       NETBSD32PTR32(fs_args32.udf_args.fspec,
+                           fs_args.udf_args.fspec);
+                       fs_args32.udf_args.sessionnr =
+                           fs_args.udf_args.sessionnr;
+                       fs_args32.udf_args.udfmflags =
+                           fs_args.udf_args.udfmflags;
+                       fs_args32.udf_args.gmtoff =
+                           fs_args.udf_args.gmtoff;
+                       fs_args32.udf_args.anon_uid =
+                           fs_args.udf_args.anon_uid;
+                       fs_args32.udf_args.anon_gid =
+                           fs_args.udf_args.anon_gid;
+                       fs_args32.udf_args.nobody_uid =
+                           fs_args.udf_args.nobody_uid;
+                       fs_args32.udf_args.nobody_gid =
+                           fs_args.udf_args.nobody_gid;
+                       fs_args32.udf_args.sector_size =
+                           fs_args.udf_args.sector_size;
+                       memset(fs_args32.udf_args.reserved, 0,
+                           sizeof(fs_args32.udf_args.reserved));
+                       error = copyout(&fs_args32.udf_args, udata,
+                                   sizeof(fs_args32.udf_args));
+                       *retval = sizeof(fs_args32.udf_args);
                } else if (strcmp(mtype, MOUNT_NFS) == 0) {
                        if (data_len != sizeof(fs_args.nfs_args))
                                return EINVAL;
diff -r daa987a1eae2 -r cc9d6135a150 sys/fs/udf/udf_subr.c
--- a/sys/fs/udf/udf_subr.c     Mon Apr 18 10:57:05 2022 +0000
+++ b/sys/fs/udf/udf_subr.c     Sun Apr 24 16:39:00 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.146.2.2 2022/03/13 09:48:32 martin Exp $ */
+/* $NetBSD: udf_subr.c,v 1.146.2.3 2022/04/24 16:39:00 martin Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.146.2.2 2022/03/13 09:48:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.146.2.3 2022/04/24 16:39:00 martin Exp $");
 #endif /* not lint */
 
 
@@ -2439,11 +2439,11 @@
                if ((a_l == 0) || (a_l > l_ea))
                        return EINVAL;
 
-               if (attrhdr->type != sattr)
+               if (udf_rw32(attrhdr->type) != sattr)
                        goto next_attribute;
 
                /* we might have found it! */
-               if (attrhdr->type < 2048) {     /* Ecma-167 attribute */
+               if (udf_rw32(attrhdr->type) < 2048) {   /* Ecma-167 attribute */
                        *offsetp = offset;
                        *lengthp = a_l;
                        return 0;               /* success */



Home | Main Index | Thread Index | Old Index