Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
* remove compat_sys_mount
@ 2020-09-17 8:22 Christoph Hellwig
2020-09-17 8:22 ` [PATCH 1/5] nfs: simplify nfs4_parse_monolithic Christoph Hellwig
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-17 8:22 UTC (permalink / raw)
To: Al Viro
Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Trond Myklebust,
Anna Schumaker, linux-alpha, linux-kernel, linux-fsdevel,
linux-nfs
Hi Al,
this series moves the NFSv4 binary mount data compat handling to fs/nfs/,
and removes the now pointless compat_sys_mount.
Diffstat:
b/arch/alpha/kernel/osf_sys.c | 116 +++--------
b/arch/arm64/include/asm/unistd32.h | 2
b/arch/mips/kernel/syscalls/syscall_n32.tbl | 2
b/arch/mips/kernel/syscalls/syscall_o32.tbl | 2
b/arch/parisc/kernel/syscalls/syscall.tbl | 2
b/arch/powerpc/kernel/syscalls/syscall.tbl | 2
b/arch/s390/kernel/syscalls/syscall.tbl | 2
b/arch/sparc/kernel/syscalls/syscall.tbl | 2
b/arch/x86/entry/syscalls/syscall_32.tbl | 2
b/fs/Makefile | 1
b/fs/internal.h | 3
b/fs/namespace.c | 29 --
b/fs/nfs/fs_context.c | 195 ++++++++++++-------
b/include/linux/compat.h | 6
b/include/linux/fs.h | 2
b/include/uapi/asm-generic/unistd.h | 2
b/tools/include/uapi/asm-generic/unistd.h | 2
b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl | 2
b/tools/perf/arch/s390/entry/syscalls/syscall.tbl | 2
fs/compat.c | 132 ------------
20 files changed, 179 insertions(+), 329 deletions(-)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/5] nfs: simplify nfs4_parse_monolithic
2020-09-17 8:22 remove compat_sys_mount Christoph Hellwig
@ 2020-09-17 8:22 ` Christoph Hellwig
2020-09-17 8:22 ` [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code Christoph Hellwig
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-17 8:22 UTC (permalink / raw)
To: Al Viro
Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Trond Myklebust,
Anna Schumaker, linux-alpha, linux-kernel, linux-fsdevel,
linux-nfs
Remove a level of indentation for the version 1 mount data parsing, and
simplify the NULL data case a little bit as well.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/nfs/fs_context.c | 135 +++++++++++++++++++++-----------------------
1 file changed, 63 insertions(+), 72 deletions(-)
diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
index 524812984e2d43..cbf6a4ba5e5806 100644
--- a/fs/nfs/fs_context.c
+++ b/fs/nfs/fs_context.c
@@ -1049,89 +1049,80 @@ static int nfs4_parse_monolithic(struct fs_context *fc,
struct sockaddr *sap = (struct sockaddr *)&ctx->nfs_server.address;
char *c;
- if (data == NULL)
- goto out_no_data;
+ if (!data) {
+ if (is_remount_fc(fc))
+ goto done;
+ return nfs_invalf(fc,
+ "NFS4: mount program didn't pass any mount data");
+ }
ctx->version = 4;
- switch (data->version) {
- case 1:
- if (data->host_addrlen > sizeof(ctx->nfs_server.address))
- goto out_no_address;
- if (data->host_addrlen == 0)
- goto out_no_address;
- ctx->nfs_server.addrlen = data->host_addrlen;
- if (copy_from_user(sap, data->host_addr, data->host_addrlen))
- return -EFAULT;
- if (!nfs_verify_server_address(sap))
- goto out_no_address;
- ctx->nfs_server.port = ntohs(((struct sockaddr_in *)sap)->sin_port);
-
- if (data->auth_flavourlen) {
- rpc_authflavor_t pseudoflavor;
- if (data->auth_flavourlen > 1)
- goto out_inval_auth;
- if (copy_from_user(&pseudoflavor,
- data->auth_flavours,
- sizeof(pseudoflavor)))
- return -EFAULT;
- ctx->selected_flavor = pseudoflavor;
- } else
- ctx->selected_flavor = RPC_AUTH_UNIX;
-
- c = strndup_user(data->hostname.data, NFS4_MAXNAMLEN);
- if (IS_ERR(c))
- return PTR_ERR(c);
- ctx->nfs_server.hostname = c;
-
- c = strndup_user(data->mnt_path.data, NFS4_MAXPATHLEN);
- if (IS_ERR(c))
- return PTR_ERR(c);
- ctx->nfs_server.export_path = c;
- dfprintk(MOUNT, "NFS: MNTPATH: '%s'\n", c);
+ if (data->version != 1)
+ return generic_parse_monolithic(fc, data);
- c = strndup_user(data->client_addr.data, 16);
- if (IS_ERR(c))
- return PTR_ERR(c);
- ctx->client_address = c;
-
- /*
- * Translate to nfs_fs_context, which nfs_fill_super
- * can deal with.
- */
+ if (data->host_addrlen > sizeof(ctx->nfs_server.address))
+ goto out_no_address;
+ if (data->host_addrlen == 0)
+ goto out_no_address;
+ ctx->nfs_server.addrlen = data->host_addrlen;
+ if (copy_from_user(sap, data->host_addr, data->host_addrlen))
+ return -EFAULT;
+ if (!nfs_verify_server_address(sap))
+ goto out_no_address;
+ ctx->nfs_server.port = ntohs(((struct sockaddr_in *)sap)->sin_port);
- ctx->flags = data->flags & NFS4_MOUNT_FLAGMASK;
- ctx->rsize = data->rsize;
- ctx->wsize = data->wsize;
- ctx->timeo = data->timeo;
- ctx->retrans = data->retrans;
- ctx->acregmin = data->acregmin;
- ctx->acregmax = data->acregmax;
- ctx->acdirmin = data->acdirmin;
- ctx->acdirmax = data->acdirmax;
- ctx->nfs_server.protocol = data->proto;
- nfs_validate_transport_protocol(ctx);
- if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
- goto out_invalid_transport_udp;
+ if (data->auth_flavourlen) {
+ rpc_authflavor_t pseudoflavor;
- break;
- default:
- goto generic;
+ if (data->auth_flavourlen > 1)
+ goto out_inval_auth;
+ if (copy_from_user(&pseudoflavor, data->auth_flavours,
+ sizeof(pseudoflavor)))
+ return -EFAULT;
+ ctx->selected_flavor = pseudoflavor;
+ } else {
+ ctx->selected_flavor = RPC_AUTH_UNIX;
}
+ c = strndup_user(data->hostname.data, NFS4_MAXNAMLEN);
+ if (IS_ERR(c))
+ return PTR_ERR(c);
+ ctx->nfs_server.hostname = c;
+
+ c = strndup_user(data->mnt_path.data, NFS4_MAXPATHLEN);
+ if (IS_ERR(c))
+ return PTR_ERR(c);
+ ctx->nfs_server.export_path = c;
+ dfprintk(MOUNT, "NFS: MNTPATH: '%s'\n", c);
+
+ c = strndup_user(data->client_addr.data, 16);
+ if (IS_ERR(c))
+ return PTR_ERR(c);
+ ctx->client_address = c;
+
+ /*
+ * Translate to nfs_fs_context, which nfs_fill_super
+ * can deal with.
+ */
+
+ ctx->flags = data->flags & NFS4_MOUNT_FLAGMASK;
+ ctx->rsize = data->rsize;
+ ctx->wsize = data->wsize;
+ ctx->timeo = data->timeo;
+ ctx->retrans = data->retrans;
+ ctx->acregmin = data->acregmin;
+ ctx->acregmax = data->acregmax;
+ ctx->acdirmin = data->acdirmin;
+ ctx->acdirmax = data->acdirmax;
+ ctx->nfs_server.protocol = data->proto;
+ nfs_validate_transport_protocol(ctx);
+ if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
+ goto out_invalid_transport_udp;
+done:
ctx->skip_reconfig_option_check = true;
return 0;
-generic:
- return generic_parse_monolithic(fc, data);
-
-out_no_data:
- if (is_remount_fc(fc)) {
- ctx->skip_reconfig_option_check = true;
- return 0;
- }
- return nfs_invalf(fc, "NFS4: mount program didn't pass any mount data");
-
out_inval_auth:
return nfs_invalf(fc, "NFS4: Invalid number of RPC auth flavours %d",
data->auth_flavourlen);
--
2.28.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code
2020-09-17 8:22 remove compat_sys_mount Christoph Hellwig
2020-09-17 8:22 ` [PATCH 1/5] nfs: simplify nfs4_parse_monolithic Christoph Hellwig
@ 2020-09-17 8:22 ` Christoph Hellwig
2020-09-17 17:16 ` Al Viro
2020-09-17 8:22 ` [PATCH 3/5] fs: remove compat_sys_mount Christoph Hellwig
` (2 subsequent siblings)
4 siblings, 1 reply; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-17 8:22 UTC (permalink / raw)
To: Al Viro
Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Trond Myklebust,
Anna Schumaker, linux-alpha, linux-kernel, linux-fsdevel,
linux-nfs
There is no reason the generic fs code should bother with NFS specific
binary mount data - lift the conversion into nfs4_parse_monolithic
instead.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/compat.c | 75 ---------------------------------------------
fs/nfs/fs_context.c | 62 +++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 75 deletions(-)
diff --git a/fs/compat.c b/fs/compat.c
index 436d228cf71c09..9b00523d7fa571 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -19,73 +19,6 @@
#include <linux/uaccess.h>
#include "internal.h"
-struct compat_nfs_string {
- compat_uint_t len;
- compat_uptr_t data;
-};
-
-static inline void compat_nfs_string(struct nfs_string *dst,
- struct compat_nfs_string *src)
-{
- dst->data = compat_ptr(src->data);
- dst->len = src->len;
-}
-
-struct compat_nfs4_mount_data_v1 {
- compat_int_t version;
- compat_int_t flags;
- compat_int_t rsize;
- compat_int_t wsize;
- compat_int_t timeo;
- compat_int_t retrans;
- compat_int_t acregmin;
- compat_int_t acregmax;
- compat_int_t acdirmin;
- compat_int_t acdirmax;
- struct compat_nfs_string client_addr;
- struct compat_nfs_string mnt_path;
- struct compat_nfs_string hostname;
- compat_uint_t host_addrlen;
- compat_uptr_t host_addr;
- compat_int_t proto;
- compat_int_t auth_flavourlen;
- compat_uptr_t auth_flavours;
-};
-
-static int do_nfs4_super_data_conv(void *raw_data)
-{
- int version = *(compat_uint_t *) raw_data;
-
- if (version == 1) {
- struct compat_nfs4_mount_data_v1 *raw = raw_data;
- struct nfs4_mount_data *real = raw_data;
-
- /* copy the fields backwards */
- real->auth_flavours = compat_ptr(raw->auth_flavours);
- real->auth_flavourlen = raw->auth_flavourlen;
- real->proto = raw->proto;
- real->host_addr = compat_ptr(raw->host_addr);
- real->host_addrlen = raw->host_addrlen;
- compat_nfs_string(&real->hostname, &raw->hostname);
- compat_nfs_string(&real->mnt_path, &raw->mnt_path);
- compat_nfs_string(&real->client_addr, &raw->client_addr);
- real->acdirmax = raw->acdirmax;
- real->acdirmin = raw->acdirmin;
- real->acregmax = raw->acregmax;
- real->acregmin = raw->acregmin;
- real->retrans = raw->retrans;
- real->timeo = raw->timeo;
- real->wsize = raw->wsize;
- real->rsize = raw->rsize;
- real->flags = raw->flags;
- real->version = raw->version;
- }
-
- return 0;
-}
-
-#define NFS4_NAME "nfs4"
-
COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
const char __user *, dir_name,
const char __user *, type, compat_ulong_t, flags,
@@ -111,14 +44,6 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
if (IS_ERR(options))
goto out2;
- if (kernel_type && options) {
- if (!strcmp(kernel_type, NFS4_NAME)) {
- retval = -EINVAL;
- if (do_nfs4_super_data_conv(options))
- goto out3;
- }
- }
-
retval = do_mount(kernel_dev, dir_name, kernel_type, flags, options);
out3:
diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
index cbf6a4ba5e5806..222afba70bc08e 100644
--- a/fs/nfs/fs_context.c
+++ b/fs/nfs/fs_context.c
@@ -1039,6 +1039,65 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
}
#if IS_ENABLED(CONFIG_NFS_V4)
+struct compat_nfs_string {
+ compat_uint_t len;
+ compat_uptr_t data;
+};
+
+static inline void compat_nfs_string(struct nfs_string *dst,
+ struct compat_nfs_string *src)
+{
+ dst->data = compat_ptr(src->data);
+ dst->len = src->len;
+}
+
+struct compat_nfs4_mount_data_v1 {
+ compat_int_t version;
+ compat_int_t flags;
+ compat_int_t rsize;
+ compat_int_t wsize;
+ compat_int_t timeo;
+ compat_int_t retrans;
+ compat_int_t acregmin;
+ compat_int_t acregmax;
+ compat_int_t acdirmin;
+ compat_int_t acdirmax;
+ struct compat_nfs_string client_addr;
+ struct compat_nfs_string mnt_path;
+ struct compat_nfs_string hostname;
+ compat_uint_t host_addrlen;
+ compat_uptr_t host_addr;
+ compat_int_t proto;
+ compat_int_t auth_flavourlen;
+ compat_uptr_t auth_flavours;
+};
+
+static void nfs4_compat_mount_data_conv(struct nfs4_mount_data *data)
+{
+ struct compat_nfs4_mount_data_v1 *compat =
+ (struct compat_nfs4_mount_data_v1 *)data;
+
+ /* copy the fields backwards */
+ data->auth_flavours = compat_ptr(compat->auth_flavours);
+ data->auth_flavourlen = compat->auth_flavourlen;
+ data->proto = compat->proto;
+ data->host_addr = compat_ptr(compat->host_addr);
+ data->host_addrlen = compat->host_addrlen;
+ compat_nfs_string(&data->hostname, &compat->hostname);
+ compat_nfs_string(&data->mnt_path, &compat->mnt_path);
+ compat_nfs_string(&data->client_addr, &compat->client_addr);
+ data->acdirmax = compat->acdirmax;
+ data->acdirmin = compat->acdirmin;
+ data->acregmax = compat->acregmax;
+ data->acregmin = compat->acregmin;
+ data->retrans = compat->retrans;
+ data->timeo = compat->timeo;
+ data->wsize = compat->wsize;
+ data->rsize = compat->rsize;
+ data->flags = compat->flags;
+ data->version = compat->version;
+}
+
/*
* Validate NFSv4 mount options
*/
@@ -1061,6 +1120,9 @@ static int nfs4_parse_monolithic(struct fs_context *fc,
if (data->version != 1)
return generic_parse_monolithic(fc, data);
+ if (in_compat_syscall())
+ nfs4_compat_mount_data_conv(data);
+
if (data->host_addrlen > sizeof(ctx->nfs_server.address))
goto out_no_address;
if (data->host_addrlen == 0)
--
2.28.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/5] fs: remove compat_sys_mount
2020-09-17 8:22 remove compat_sys_mount Christoph Hellwig
2020-09-17 8:22 ` [PATCH 1/5] nfs: simplify nfs4_parse_monolithic Christoph Hellwig
2020-09-17 8:22 ` [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code Christoph Hellwig
@ 2020-09-17 8:22 ` Christoph Hellwig
2020-09-17 8:22 ` [PATCH 4/5] alpha: simplify osf_mount Christoph Hellwig
2020-09-17 8:22 ` [PATCH 5/5] fs: remove do_mounts Christoph Hellwig
4 siblings, 0 replies; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-17 8:22 UTC (permalink / raw)
To: Al Viro
Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Trond Myklebust,
Anna Schumaker, linux-alpha, linux-kernel, linux-fsdevel,
linux-nfs
compat_sys_mount is identical to the regular sys_mount now, so remove it
and use the native version everywhere.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/arm64/include/asm/unistd32.h | 2 +-
arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +-
arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +-
arch/parisc/kernel/syscalls/syscall.tbl | 2 +-
arch/powerpc/kernel/syscalls/syscall.tbl | 2 +-
arch/s390/kernel/syscalls/syscall.tbl | 2 +-
arch/sparc/kernel/syscalls/syscall.tbl | 2 +-
arch/x86/entry/syscalls/syscall_32.tbl | 2 +-
fs/Makefile | 1 -
fs/compat.c | 57 -------------------
fs/internal.h | 3 -
fs/namespace.c | 4 +-
include/linux/compat.h | 6 --
include/uapi/asm-generic/unistd.h | 2 +-
tools/include/uapi/asm-generic/unistd.h | 2 +-
.../arch/powerpc/entry/syscalls/syscall.tbl | 2 +-
.../perf/arch/s390/entry/syscalls/syscall.tbl | 2 +-
17 files changed, 14 insertions(+), 81 deletions(-)
delete mode 100644 fs/compat.c
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index 734860ac7cf9d5..5fd095d6545022 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -53,7 +53,7 @@ __SYSCALL(__NR_lseek, compat_sys_lseek)
#define __NR_getpid 20
__SYSCALL(__NR_getpid, sys_getpid)
#define __NR_mount 21
-__SYSCALL(__NR_mount, compat_sys_mount)
+__SYSCALL(__NR_mount, sys_mount)
/* 22 was sys_umount */
__SYSCALL(22, sys_ni_syscall)
#define __NR_setuid 23
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index f9df9edb67a407..61fa9e7013cbc1 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -167,7 +167,7 @@
157 n32 sync sys_sync
158 n32 acct sys_acct
159 n32 settimeofday compat_sys_settimeofday
-160 n32 mount compat_sys_mount
+160 n32 mount sys_mount
161 n32 umount2 sys_umount
162 n32 swapon sys_swapon
163 n32 swapoff sys_swapoff
diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index 195b43cf27c848..b992e89be7ff8a 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -29,7 +29,7 @@
18 o32 unused18 sys_ni_syscall
19 o32 lseek sys_lseek
20 o32 getpid sys_getpid
-21 o32 mount sys_mount compat_sys_mount
+21 o32 mount sys_mount
22 o32 umount sys_oldumount
23 o32 setuid sys_setuid
24 o32 getuid sys_getuid
diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
index def64d221cd4fb..07efd978182fea 100644
--- a/arch/parisc/kernel/syscalls/syscall.tbl
+++ b/arch/parisc/kernel/syscalls/syscall.tbl
@@ -29,7 +29,7 @@
18 common stat sys_newstat compat_sys_newstat
19 common lseek sys_lseek compat_sys_lseek
20 common getpid sys_getpid
-21 common mount sys_mount compat_sys_mount
+21 common mount sys_mount
22 common bind sys_bind
23 common setuid sys_setuid
24 common getuid sys_getuid
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index c2d737ff2e7bec..a36ad4fec73c19 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -34,7 +34,7 @@
18 spu oldstat sys_ni_syscall
19 common lseek sys_lseek compat_sys_lseek
20 common getpid sys_getpid
-21 nospu mount sys_mount compat_sys_mount
+21 nospu mount sys_mount
22 32 umount sys_oldumount
22 64 umount sys_ni_syscall
22 spu umount sys_ni_syscall
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index 10456bc936fb09..4b803dfbee2be9 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -26,7 +26,7 @@
16 32 lchown - sys_lchown16
19 common lseek sys_lseek compat_sys_lseek
20 common getpid sys_getpid sys_getpid
-21 common mount sys_mount compat_sys_mount
+21 common mount sys_mount sys_mount
22 common umount sys_oldumount sys_oldumount
23 32 setuid - sys_setuid16
24 32 getuid - sys_getuid16
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index 4af114e84f2022..d5ff798fa08f80 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -201,7 +201,7 @@
164 64 utrap_install sys_utrap_install
165 common quotactl sys_quotactl
166 common set_tid_address sys_set_tid_address
-167 common mount sys_mount compat_sys_mount
+167 common mount sys_mount
168 common ustat sys_ustat compat_sys_ustat
169 common setxattr sys_setxattr
170 common lsetxattr sys_lsetxattr
diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index 9d11028736661b..5a40b226fb7b7a 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -32,7 +32,7 @@
18 i386 oldstat sys_stat
19 i386 lseek sys_lseek compat_sys_lseek
20 i386 getpid sys_getpid
-21 i386 mount sys_mount compat_sys_mount
+21 i386 mount sys_mount
22 i386 umount sys_oldumount
23 i386 setuid sys_setuid16
24 i386 getuid sys_getuid16
diff --git a/fs/Makefile b/fs/Makefile
index 1c7b0e3f6daa11..d72ee2ce7af080 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_FS_DAX) += dax.o
obj-$(CONFIG_FS_ENCRYPTION) += crypto/
obj-$(CONFIG_FS_VERITY) += verity/
obj-$(CONFIG_FILE_LOCKING) += locks.o
-obj-$(CONFIG_COMPAT) += compat.o
obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o
obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o
obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
diff --git a/fs/compat.c b/fs/compat.c
deleted file mode 100644
index 9b00523d7fa571..00000000000000
--- a/fs/compat.c
+++ /dev/null
@@ -1,57 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * linux/fs/compat.c
- *
- * Kernel compatibililty routines for e.g. 32 bit syscall support
- * on 64 bit kernels.
- *
- * Copyright (C) 2002 Stephen Rothwell, IBM Corporation
- * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
- * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
- * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs
- * Copyright (C) 2003 Pavel Machek (pavel@ucw.cz)
- */
-
-#include <linux/compat.h>
-#include <linux/nfs4_mount.h>
-#include <linux/syscalls.h>
-#include <linux/slab.h>
-#include <linux/uaccess.h>
-#include "internal.h"
-
-COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
- const char __user *, dir_name,
- const char __user *, type, compat_ulong_t, flags,
- const void __user *, data)
-{
- char *kernel_type;
- void *options;
- char *kernel_dev;
- int retval;
-
- kernel_type = copy_mount_string(type);
- retval = PTR_ERR(kernel_type);
- if (IS_ERR(kernel_type))
- goto out;
-
- kernel_dev = copy_mount_string(dev_name);
- retval = PTR_ERR(kernel_dev);
- if (IS_ERR(kernel_dev))
- goto out1;
-
- options = copy_mount_options(data);
- retval = PTR_ERR(options);
- if (IS_ERR(options))
- goto out2;
-
- retval = do_mount(kernel_dev, dir_name, kernel_type, flags, options);
-
- out3:
- kfree(options);
- out2:
- kfree(kernel_dev);
- out1:
- kfree(kernel_type);
- out:
- return retval;
-}
diff --git a/fs/internal.h b/fs/internal.h
index 10517ece45167f..a7cd0f64faa4ab 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -82,9 +82,6 @@ int may_linkat(struct path *link);
/*
* namespace.c
*/
-extern void *copy_mount_options(const void __user *);
-extern char *copy_mount_string(const void __user *);
-
extern struct vfsmount *lookup_mnt(const struct path *);
extern int finish_automount(struct vfsmount *, struct path *);
diff --git a/fs/namespace.c b/fs/namespace.c
index bae0e95b3713a3..12b431b61462b9 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3072,7 +3072,7 @@ static void shrink_submounts(struct mount *mnt)
}
}
-void *copy_mount_options(const void __user * data)
+static void *copy_mount_options(const void __user * data)
{
char *copy;
unsigned size;
@@ -3097,7 +3097,7 @@ void *copy_mount_options(const void __user * data)
return copy;
}
-char *copy_mount_string(const void __user *data)
+static char *copy_mount_string(const void __user *data)
{
return data ? strndup_user(data, PATH_MAX) : NULL;
}
diff --git a/include/linux/compat.h b/include/linux/compat.h
index b354ce58966e2d..92db17cc5c5e33 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -522,12 +522,6 @@ asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
compat_ulong_t arg);
-/* fs/namespace.c */
-asmlinkage long compat_sys_mount(const char __user *dev_name,
- const char __user *dir_name,
- const char __user *type, compat_ulong_t flags,
- const void __user *data);
-
/* fs/open.c */
asmlinkage long compat_sys_statfs(const char __user *pathname,
struct compat_statfs __user *buf);
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 995b36c2ea7d8a..fc98c943760976 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -140,7 +140,7 @@ __SYSCALL(__NR_renameat, sys_renameat)
#define __NR_umount2 39
__SYSCALL(__NR_umount2, sys_umount)
#define __NR_mount 40
-__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
+__SYSCALL(__NR_mount, sys_mount)
#define __NR_pivot_root 41
__SYSCALL(__NR_pivot_root, sys_pivot_root)
diff --git a/tools/include/uapi/asm-generic/unistd.h b/tools/include/uapi/asm-generic/unistd.h
index 995b36c2ea7d8a..fc98c943760976 100644
--- a/tools/include/uapi/asm-generic/unistd.h
+++ b/tools/include/uapi/asm-generic/unistd.h
@@ -140,7 +140,7 @@ __SYSCALL(__NR_renameat, sys_renameat)
#define __NR_umount2 39
__SYSCALL(__NR_umount2, sys_umount)
#define __NR_mount 40
-__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
+__SYSCALL(__NR_mount, sys_mount)
#define __NR_pivot_root 41
__SYSCALL(__NR_pivot_root, sys_pivot_root)
diff --git a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
index 3ca6fe057a0b1f..c2866c65965061 100644
--- a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
+++ b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
@@ -32,7 +32,7 @@
18 spu oldstat sys_ni_syscall
19 common lseek sys_lseek compat_sys_lseek
20 common getpid sys_getpid
-21 nospu mount sys_mount compat_sys_mount
+21 nospu mount sys_mount
22 32 umount sys_oldumount
22 64 umount sys_ni_syscall
22 spu umount sys_ni_syscall
diff --git a/tools/perf/arch/s390/entry/syscalls/syscall.tbl b/tools/perf/arch/s390/entry/syscalls/syscall.tbl
index 6a0bbea225db0d..8e0806f6c38eb0 100644
--- a/tools/perf/arch/s390/entry/syscalls/syscall.tbl
+++ b/tools/perf/arch/s390/entry/syscalls/syscall.tbl
@@ -26,7 +26,7 @@
16 32 lchown - compat_sys_s390_lchown16
19 common lseek sys_lseek compat_sys_lseek
20 common getpid sys_getpid sys_getpid
-21 common mount sys_mount compat_sys_mount
+21 common mount sys_mount
22 common umount sys_oldumount compat_sys_oldumount
23 32 setuid - compat_sys_s390_setuid16
24 32 getuid - compat_sys_s390_getuid16
--
2.28.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4/5] alpha: simplify osf_mount
2020-09-17 8:22 remove compat_sys_mount Christoph Hellwig
` (2 preceding siblings ...)
2020-09-17 8:22 ` [PATCH 3/5] fs: remove compat_sys_mount Christoph Hellwig
@ 2020-09-17 8:22 ` Christoph Hellwig
2020-10-11 14:22 ` Guenter Roeck
2020-09-17 8:22 ` [PATCH 5/5] fs: remove do_mounts Christoph Hellwig
4 siblings, 1 reply; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-17 8:22 UTC (permalink / raw)
To: Al Viro
Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Trond Myklebust,
Anna Schumaker, linux-alpha, linux-kernel, linux-fsdevel,
linux-nfs
Merge the mount_args structures and mount helpers to simplify the code a
bit.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/alpha/kernel/osf_sys.c | 111 +++++++++---------------------------
1 file changed, 28 insertions(+), 83 deletions(-)
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index d5367a1c6300c1..5fd155b13503b5 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -421,109 +421,54 @@ SYSCALL_DEFINE3(osf_fstatfs64, unsigned long, fd,
*
* Although to be frank, neither are the native Linux/i386 ones..
*/
-struct ufs_args {
+struct osf_mount_args {
char __user *devname;
int flags;
uid_t exroot;
+ /* this has lots more here for cdfs at least, but we don't bother */
};
-struct cdfs_args {
- char __user *devname;
- int flags;
- uid_t exroot;
-
- /* This has lots more here, which Linux handles with the option block
- but I'm too lazy to do the translation into ASCII. */
-};
-
-struct procfs_args {
- char __user *devname;
- int flags;
- uid_t exroot;
-};
-
-/*
- * We can't actually handle ufs yet, so we translate UFS mounts to
- * ext2fs mounts. I wouldn't mind a UFS filesystem, but the UFS
- * layout is so braindead it's a major headache doing it.
- *
- * Just how long ago was it written? OTOH our UFS driver may be still
- * unhappy with OSF UFS. [CHECKME]
- */
-static int
-osf_ufs_mount(const char __user *dirname,
- struct ufs_args __user *args, int flags)
+SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
+ int, flag, void __user *, data)
{
- int retval;
- struct cdfs_args tmp;
+ struct osf_mount_args tmp;
struct filename *devname;
-
- retval = -EFAULT;
- if (copy_from_user(&tmp, args, sizeof(tmp)))
- goto out;
- devname = getname(tmp.devname);
- retval = PTR_ERR(devname);
- if (IS_ERR(devname))
- goto out;
- retval = do_mount(devname->name, dirname, "ext2", flags, NULL);
- putname(devname);
- out:
- return retval;
-}
-
-static int
-osf_cdfs_mount(const char __user *dirname,
- struct cdfs_args __user *args, int flags)
-{
+ const char *fstype;
int retval;
- struct cdfs_args tmp;
- struct filename *devname;
-
- retval = -EFAULT;
- if (copy_from_user(&tmp, args, sizeof(tmp)))
- goto out;
- devname = getname(tmp.devname);
- retval = PTR_ERR(devname);
- if (IS_ERR(devname))
- goto out;
- retval = do_mount(devname->name, dirname, "iso9660", flags, NULL);
- putname(devname);
- out:
- return retval;
-}
-
-static int
-osf_procfs_mount(const char __user *dirname,
- struct procfs_args __user *args, int flags)
-{
- struct procfs_args tmp;
if (copy_from_user(&tmp, args, sizeof(tmp)))
return -EFAULT;
- return do_mount("", dirname, "proc", flags, NULL);
-}
-
-SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
- int, flag, void __user *, data)
-{
- int retval;
-
switch (typenr) {
- case 1:
- retval = osf_ufs_mount(path, data, flag);
+ case 1: /* ufs */
+ /*
+ * We can't actually handle ufs yet, so we translate UFS mounts
+ * to ext2 mounts. I wouldn't mind a UFS filesystem, but the UFS
+ * layout is so braindead it's a major headache doing it.
+ *
+ * Just how long ago was it written? OTOH our UFS driver may be
+ * still unhappy with OSF UFS. [CHECKME]
+ */
+ fstype = "ext2";
+ devname = getname(tmp.devname);
break;
- case 6:
- retval = osf_cdfs_mount(path, data, flag);
+ case 6: /* cdfs */
+ fstype = "iso9660";
+ devname = getname(tmp.devname);
break;
- case 9:
- retval = osf_procfs_mount(path, data, flag);
+ case 9: /* procfs */
+ fstype = "proc";
+ devname = getname_kernel("");
break;
default:
- retval = -EINVAL;
printk("osf_mount(%ld, %x)\n", typenr, flag);
+ return -EINVAL;
}
+ if (IS_ERR(devname))
+ return PTR_ERR(devname);
+ retval = do_mount(devname.name, dirname, fstype, flags, NULL);
+ putname(devname);
return retval;
}
--
2.28.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5/5] fs: remove do_mounts
2020-09-17 8:22 remove compat_sys_mount Christoph Hellwig
` (3 preceding siblings ...)
2020-09-17 8:22 ` [PATCH 4/5] alpha: simplify osf_mount Christoph Hellwig
@ 2020-09-17 8:22 ` Christoph Hellwig
2020-10-11 14:17 ` Guenter Roeck
4 siblings, 1 reply; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-17 8:22 UTC (permalink / raw)
To: Al Viro
Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Trond Myklebust,
Anna Schumaker, linux-alpha, linux-kernel, linux-fsdevel,
linux-nfs
There are only two callers left, one of which is is in the alpha-specific
OSF/1 compat code. Just open code it in both.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/alpha/kernel/osf_sys.c | 7 ++++++-
fs/namespace.c | 25 ++++++++-----------------
include/linux/fs.h | 2 --
3 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 5fd155b13503b5..8acd5101097576 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -434,6 +434,7 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
struct osf_mount_args tmp;
struct filename *devname;
const char *fstype;
+ struct path path;
int retval;
if (copy_from_user(&tmp, args, sizeof(tmp)))
@@ -467,7 +468,11 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
if (IS_ERR(devname))
return PTR_ERR(devname);
- retval = do_mount(devname.name, dirname, fstype, flags, NULL);
+ retval = user_path_at(AT_FDCWD, dirname, LOOKUP_FOLLOW, &path);
+ if (!retval) {
+ ret = path_mount(devname.name, &path, fstype, flags, NULL);
+ path_put(&path);
+ }
putname(devname);
return retval;
}
diff --git a/fs/namespace.c b/fs/namespace.c
index 12b431b61462b9..2ff373ebeaf27f 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3193,20 +3193,6 @@ int path_mount(const char *dev_name, struct path *path,
data_page);
}
-long do_mount(const char *dev_name, const char __user *dir_name,
- const char *type_page, unsigned long flags, void *data_page)
-{
- struct path path;
- int ret;
-
- ret = user_path_at(AT_FDCWD, dir_name, LOOKUP_FOLLOW, &path);
- if (ret)
- return ret;
- ret = path_mount(dev_name, &path, type_page, flags, data_page);
- path_put(&path);
- return ret;
-}
-
static struct ucounts *inc_mnt_namespaces(struct user_namespace *ns)
{
return inc_ucount(ns, current_euid(), UCOUNT_MNT_NAMESPACES);
@@ -3390,10 +3376,11 @@ EXPORT_SYMBOL(mount_subtree);
SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
char __user *, type, unsigned long, flags, void __user *, data)
{
- int ret;
+ struct path path;
char *kernel_type;
char *kernel_dev;
void *options;
+ int ret;
kernel_type = copy_mount_string(type);
ret = PTR_ERR(kernel_type);
@@ -3410,8 +3397,12 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
if (IS_ERR(options))
goto out_data;
- ret = do_mount(kernel_dev, dir_name, kernel_type, flags, options);
-
+ ret = user_path_at(AT_FDCWD, dir_name, LOOKUP_FOLLOW, &path);
+ if (ret)
+ goto out_options;
+ ret = path_mount(kernel_dev, &path, kernel_type, flags, options);
+ path_put(&path);
+out_options:
kfree(options);
out_data:
kfree(kernel_dev);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7519ae003a082c..bd9878bdd4bfe9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2292,8 +2292,6 @@ extern struct vfsmount *kern_mount(struct file_system_type *);
extern void kern_unmount(struct vfsmount *mnt);
extern int may_umount_tree(struct vfsmount *);
extern int may_umount(struct vfsmount *);
-extern long do_mount(const char *, const char __user *,
- const char *, unsigned long, void *);
extern struct vfsmount *collect_mounts(const struct path *);
extern void drop_collected_mounts(struct vfsmount *);
extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
--
2.28.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code
2020-09-17 8:22 ` [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code Christoph Hellwig
@ 2020-09-17 17:16 ` Al Viro
2020-09-17 17:18 ` Christoph Hellwig
0 siblings, 1 reply; 15+ messages in thread
From: Al Viro @ 2020-09-17 17:16 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Trond Myklebust,
Anna Schumaker, linux-alpha, linux-kernel, linux-fsdevel,
linux-nfs
On Thu, Sep 17, 2020 at 10:22:33AM +0200, Christoph Hellwig wrote:
> There is no reason the generic fs code should bother with NFS specific
> binary mount data - lift the conversion into nfs4_parse_monolithic
> instead.
Considering the size of struct compat_nfs4_mount_data_v1... Do we really
need to bother with that "copy in place, so we go through the fields
backwards" logics? Just make that
> +static void nfs4_compat_mount_data_conv(struct nfs4_mount_data *data)
> +{
struct compat_nfs4_mount_data_v1 compat;
compat = *(struct compat_nfs4_mount_data_v1 *)data;
and copy the damnt thing without worrying about the field order...
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code
2020-09-17 17:16 ` Al Viro
@ 2020-09-17 17:18 ` Christoph Hellwig
2020-09-21 6:48 ` Christoph Hellwig
0 siblings, 1 reply; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-17 17:18 UTC (permalink / raw)
To: Al Viro
Cc: Christoph Hellwig, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Trond Myklebust, Anna Schumaker, linux-alpha,
linux-kernel, linux-fsdevel, linux-nfs
On Thu, Sep 17, 2020 at 06:16:04PM +0100, Al Viro wrote:
> On Thu, Sep 17, 2020 at 10:22:33AM +0200, Christoph Hellwig wrote:
> > There is no reason the generic fs code should bother with NFS specific
> > binary mount data - lift the conversion into nfs4_parse_monolithic
> > instead.
>
> Considering the size of struct compat_nfs4_mount_data_v1... Do we really
> need to bother with that "copy in place, so we go through the fields
> backwards" logics? Just make that
>
> > +static void nfs4_compat_mount_data_conv(struct nfs4_mount_data *data)
> > +{
> struct compat_nfs4_mount_data_v1 compat;
> compat = *(struct compat_nfs4_mount_data_v1 *)data;
> and copy the damnt thing without worrying about the field order...
Maybe. But then again why bother? I just sticked to the existing
code as much as possible.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code
2020-09-17 17:18 ` Christoph Hellwig
@ 2020-09-21 6:48 ` Christoph Hellwig
2020-09-21 16:05 ` Anna Schumaker
0 siblings, 1 reply; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-21 6:48 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker, Al Viro
Cc: Christoph Hellwig, Richard Henderson, Ivan Kokshaysky,
Matt Turner, linux-alpha, linux-kernel, linux-fsdevel, linux-nfs
On Thu, Sep 17, 2020 at 07:18:26PM +0200, Christoph Hellwig wrote:
> On Thu, Sep 17, 2020 at 06:16:04PM +0100, Al Viro wrote:
> > On Thu, Sep 17, 2020 at 10:22:33AM +0200, Christoph Hellwig wrote:
> > > There is no reason the generic fs code should bother with NFS specific
> > > binary mount data - lift the conversion into nfs4_parse_monolithic
> > > instead.
> >
> > Considering the size of struct compat_nfs4_mount_data_v1... Do we really
> > need to bother with that "copy in place, so we go through the fields
> > backwards" logics? Just make that
> >
> > > +static void nfs4_compat_mount_data_conv(struct nfs4_mount_data *data)
> > > +{
> > struct compat_nfs4_mount_data_v1 compat;
> > compat = *(struct compat_nfs4_mount_data_v1 *)data;
> > and copy the damnt thing without worrying about the field order...
>
> Maybe. But then again why bother? I just sticked to the existing
> code as much as possible.
Trond, Anna: what is your preference?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code
2020-09-21 6:48 ` Christoph Hellwig
@ 2020-09-21 16:05 ` Anna Schumaker
2020-09-21 18:11 ` Christoph Hellwig
0 siblings, 1 reply; 15+ messages in thread
From: Anna Schumaker @ 2020-09-21 16:05 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Trond Myklebust, Al Viro, Richard Henderson, Ivan Kokshaysky,
Matt Turner, linux-alpha, Linux Kernel Mailing List,
linux-fsdevel, Linux NFS Mailing List
This is for the binary mount stuff? That was already legacy code when
I first started, and mount uses text options now. My preference is for
keeping it as close to the original code as possible.
I'm curious if you've been able to test this? I'm not sure if there is
a way to force binary mount data through mount.nfs
Anna
On Mon, Sep 21, 2020 at 2:49 AM Christoph Hellwig <hch@lst.de> wrote:
>
> On Thu, Sep 17, 2020 at 07:18:26PM +0200, Christoph Hellwig wrote:
> > On Thu, Sep 17, 2020 at 06:16:04PM +0100, Al Viro wrote:
> > > On Thu, Sep 17, 2020 at 10:22:33AM +0200, Christoph Hellwig wrote:
> > > > There is no reason the generic fs code should bother with NFS specific
> > > > binary mount data - lift the conversion into nfs4_parse_monolithic
> > > > instead.
> > >
> > > Considering the size of struct compat_nfs4_mount_data_v1... Do we really
> > > need to bother with that "copy in place, so we go through the fields
> > > backwards" logics? Just make that
> > >
> > > > +static void nfs4_compat_mount_data_conv(struct nfs4_mount_data *data)
> > > > +{
> > > struct compat_nfs4_mount_data_v1 compat;
> > > compat = *(struct compat_nfs4_mount_data_v1 *)data;
> > > and copy the damnt thing without worrying about the field order...
> >
> > Maybe. But then again why bother? I just sticked to the existing
> > code as much as possible.
>
> Trond, Anna: what is your preference?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code
2020-09-21 16:05 ` Anna Schumaker
@ 2020-09-21 18:11 ` Christoph Hellwig
2020-09-23 3:45 ` Al Viro
0 siblings, 1 reply; 15+ messages in thread
From: Christoph Hellwig @ 2020-09-21 18:11 UTC (permalink / raw)
To: Anna Schumaker
Cc: Christoph Hellwig, Trond Myklebust, Al Viro, Richard Henderson,
Ivan Kokshaysky, Matt Turner, linux-alpha,
Linux Kernel Mailing List, linux-fsdevel, Linux NFS Mailing List
On Mon, Sep 21, 2020 at 12:05:52PM -0400, Anna Schumaker wrote:
> This is for the binary mount stuff? That was already legacy code when
> I first started, and mount uses text options now. My preference is for
> keeping it as close to the original code as possible.
Ok. Al, are you fine with the series as-is then?
>
> I'm curious if you've been able to test this? I'm not sure if there is
> a way to force binary mount data through mount.nfs
The test is pretty trivial - even the most recent nfsutils supports the
binary mount data. You just need to patch out the detection for a
modern kernel.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code
2020-09-21 18:11 ` Christoph Hellwig
@ 2020-09-23 3:45 ` Al Viro
0 siblings, 0 replies; 15+ messages in thread
From: Al Viro @ 2020-09-23 3:45 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Anna Schumaker, Trond Myklebust, Richard Henderson,
Ivan Kokshaysky, Matt Turner, linux-alpha,
Linux Kernel Mailing List, linux-fsdevel, Linux NFS Mailing List
On Mon, Sep 21, 2020 at 08:11:23PM +0200, Christoph Hellwig wrote:
> On Mon, Sep 21, 2020 at 12:05:52PM -0400, Anna Schumaker wrote:
> > This is for the binary mount stuff? That was already legacy code when
> > I first started, and mount uses text options now. My preference is for
> > keeping it as close to the original code as possible.
>
> Ok. Al, are you fine with the series as-is then?
I can live with that. I'm not fond of in_compat_syscall() proliferation,
but in this case it's reasonably sane...
OK, applied.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/5] fs: remove do_mounts
2020-09-17 8:22 ` [PATCH 5/5] fs: remove do_mounts Christoph Hellwig
@ 2020-10-11 14:17 ` Guenter Roeck
2020-10-11 18:01 ` Al Viro
0 siblings, 1 reply; 15+ messages in thread
From: Guenter Roeck @ 2020-10-11 14:17 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Al Viro, Richard Henderson, Ivan Kokshaysky, Matt Turner,
Trond Myklebust, Anna Schumaker, linux-alpha, linux-kernel,
linux-fsdevel, linux-nfs
On Thu, Sep 17, 2020 at 10:22:36AM +0200, Christoph Hellwig wrote:
> There are only two callers left, one of which is is in the alpha-specific
> OSF/1 compat code. Just open code it in both.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> arch/alpha/kernel/osf_sys.c | 7 ++++++-
> fs/namespace.c | 25 ++++++++-----------------
> include/linux/fs.h | 2 --
> 3 files changed, 14 insertions(+), 20 deletions(-)
>
> diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
> index 5fd155b13503b5..8acd5101097576 100644
> --- a/arch/alpha/kernel/osf_sys.c
> +++ b/arch/alpha/kernel/osf_sys.c
> @@ -434,6 +434,7 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
^^^^
> struct osf_mount_args tmp;
> struct filename *devname;
> const char *fstype;
> + struct path path;
^^^^^^^^^^^^^^^^
Someone didn't bother test building this patch.
arch/alpha/kernel/osf_sys.c: In function '__do_sys_osf_mount':
arch/alpha/kernel/osf_sys.c:437:14: error: 'path' redeclared as different kind of symbol
Guenter
> int retval;
>
> if (copy_from_user(&tmp, args, sizeof(tmp)))
> @@ -467,7 +468,11 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
>
> if (IS_ERR(devname))
> return PTR_ERR(devname);
> - retval = do_mount(devname.name, dirname, fstype, flags, NULL);
> + retval = user_path_at(AT_FDCWD, dirname, LOOKUP_FOLLOW, &path);
> + if (!retval) {
> + ret = path_mount(devname.name, &path, fstype, flags, NULL);
> + path_put(&path);
> + }
> putname(devname);
> return retval;
> }
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 12b431b61462b9..2ff373ebeaf27f 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -3193,20 +3193,6 @@ int path_mount(const char *dev_name, struct path *path,
> data_page);
> }
>
> -long do_mount(const char *dev_name, const char __user *dir_name,
> - const char *type_page, unsigned long flags, void *data_page)
> -{
> - struct path path;
> - int ret;
> -
> - ret = user_path_at(AT_FDCWD, dir_name, LOOKUP_FOLLOW, &path);
> - if (ret)
> - return ret;
> - ret = path_mount(dev_name, &path, type_page, flags, data_page);
> - path_put(&path);
> - return ret;
> -}
> -
> static struct ucounts *inc_mnt_namespaces(struct user_namespace *ns)
> {
> return inc_ucount(ns, current_euid(), UCOUNT_MNT_NAMESPACES);
> @@ -3390,10 +3376,11 @@ EXPORT_SYMBOL(mount_subtree);
> SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
> char __user *, type, unsigned long, flags, void __user *, data)
> {
> - int ret;
> + struct path path;
> char *kernel_type;
> char *kernel_dev;
> void *options;
> + int ret;
>
> kernel_type = copy_mount_string(type);
> ret = PTR_ERR(kernel_type);
> @@ -3410,8 +3397,12 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
> if (IS_ERR(options))
> goto out_data;
>
> - ret = do_mount(kernel_dev, dir_name, kernel_type, flags, options);
> -
> + ret = user_path_at(AT_FDCWD, dir_name, LOOKUP_FOLLOW, &path);
> + if (ret)
> + goto out_options;
> + ret = path_mount(kernel_dev, &path, kernel_type, flags, options);
> + path_put(&path);
> +out_options:
> kfree(options);
> out_data:
> kfree(kernel_dev);
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 7519ae003a082c..bd9878bdd4bfe9 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2292,8 +2292,6 @@ extern struct vfsmount *kern_mount(struct file_system_type *);
> extern void kern_unmount(struct vfsmount *mnt);
> extern int may_umount_tree(struct vfsmount *);
> extern int may_umount(struct vfsmount *);
> -extern long do_mount(const char *, const char __user *,
> - const char *, unsigned long, void *);
> extern struct vfsmount *collect_mounts(const struct path *);
> extern void drop_collected_mounts(struct vfsmount *);
> extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/5] alpha: simplify osf_mount
2020-09-17 8:22 ` [PATCH 4/5] alpha: simplify osf_mount Christoph Hellwig
@ 2020-10-11 14:22 ` Guenter Roeck
0 siblings, 0 replies; 15+ messages in thread
From: Guenter Roeck @ 2020-10-11 14:22 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Al Viro, Richard Henderson, Ivan Kokshaysky, Matt Turner,
Trond Myklebust, Anna Schumaker, linux-alpha, linux-kernel,
linux-fsdevel, linux-nfs
On Thu, Sep 17, 2020 at 10:22:35AM +0200, Christoph Hellwig wrote:
> Merge the mount_args structures and mount helpers to simplify the code a
> bit.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> arch/alpha/kernel/osf_sys.c | 111 +++++++++---------------------------
> 1 file changed, 28 insertions(+), 83 deletions(-)
>
> diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
> index d5367a1c6300c1..5fd155b13503b5 100644
> --- a/arch/alpha/kernel/osf_sys.c
> +++ b/arch/alpha/kernel/osf_sys.c
> @@ -421,109 +421,54 @@ SYSCALL_DEFINE3(osf_fstatfs64, unsigned long, fd,
> *
> * Although to be frank, neither are the native Linux/i386 ones..
> */
> -struct ufs_args {
> +struct osf_mount_args {
> char __user *devname;
> int flags;
> uid_t exroot;
> + /* this has lots more here for cdfs at least, but we don't bother */
> };
>
> -struct cdfs_args {
> - char __user *devname;
> - int flags;
> - uid_t exroot;
> -
> - /* This has lots more here, which Linux handles with the option block
> - but I'm too lazy to do the translation into ASCII. */
> -};
> -
> -struct procfs_args {
> - char __user *devname;
> - int flags;
> - uid_t exroot;
> -};
> -
> -/*
> - * We can't actually handle ufs yet, so we translate UFS mounts to
> - * ext2fs mounts. I wouldn't mind a UFS filesystem, but the UFS
> - * layout is so braindead it's a major headache doing it.
> - *
> - * Just how long ago was it written? OTOH our UFS driver may be still
> - * unhappy with OSF UFS. [CHECKME]
> - */
> -static int
> -osf_ufs_mount(const char __user *dirname,
> - struct ufs_args __user *args, int flags)
> +SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
> + int, flag, void __user *, data)
> {
> - int retval;
> - struct cdfs_args tmp;
> + struct osf_mount_args tmp;
> struct filename *devname;
> -
> - retval = -EFAULT;
> - if (copy_from_user(&tmp, args, sizeof(tmp)))
> - goto out;
> - devname = getname(tmp.devname);
> - retval = PTR_ERR(devname);
> - if (IS_ERR(devname))
> - goto out;
> - retval = do_mount(devname->name, dirname, "ext2", flags, NULL);
> - putname(devname);
> - out:
> - return retval;
> -}
> -
> -static int
> -osf_cdfs_mount(const char __user *dirname,
> - struct cdfs_args __user *args, int flags)
> -{
> + const char *fstype;
> int retval;
> - struct cdfs_args tmp;
> - struct filename *devname;
> -
> - retval = -EFAULT;
> - if (copy_from_user(&tmp, args, sizeof(tmp)))
> - goto out;
> - devname = getname(tmp.devname);
> - retval = PTR_ERR(devname);
> - if (IS_ERR(devname))
> - goto out;
> - retval = do_mount(devname->name, dirname, "iso9660", flags, NULL);
> - putname(devname);
> - out:
> - return retval;
> -}
> -
> -static int
> -osf_procfs_mount(const char __user *dirname,
> - struct procfs_args __user *args, int flags)
> -{
> - struct procfs_args tmp;
>
> if (copy_from_user(&tmp, args, sizeof(tmp)))
> return -EFAULT;
>
arch/alpha/kernel/osf_sys.c:440:27: error: 'args' undeclared (first use in this function)
> - return do_mount("", dirname, "proc", flags, NULL);
> -}
> -
> -SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
> - int, flag, void __user *, data)
> -{
> - int retval;
> -
> switch (typenr) {
> - case 1:
> - retval = osf_ufs_mount(path, data, flag);
> + case 1: /* ufs */
> + /*
> + * We can't actually handle ufs yet, so we translate UFS mounts
> + * to ext2 mounts. I wouldn't mind a UFS filesystem, but the UFS
> + * layout is so braindead it's a major headache doing it.
> + *
> + * Just how long ago was it written? OTOH our UFS driver may be
> + * still unhappy with OSF UFS. [CHECKME]
> + */
> + fstype = "ext2";
> + devname = getname(tmp.devname);
> break;
> - case 6:
> - retval = osf_cdfs_mount(path, data, flag);
> + case 6: /* cdfs */
> + fstype = "iso9660";
> + devname = getname(tmp.devname);
> break;
> - case 9:
> - retval = osf_procfs_mount(path, data, flag);
> + case 9: /* procfs */
> + fstype = "proc";
> + devname = getname_kernel("");
> break;
> default:
> - retval = -EINVAL;
> printk("osf_mount(%ld, %x)\n", typenr, flag);
> + return -EINVAL;
> }
>
> + if (IS_ERR(devname))
> + return PTR_ERR(devname);
> + retval = do_mount(devname.name, dirname, fstype, flags, NULL);
arch/alpha/kernel/osf_sys.c:471:34: error:
'dirname' undeclared (first use in this function); did you mean 'devname'?
> + putname(devname);
> return retval;
> }
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/5] fs: remove do_mounts
2020-10-11 14:17 ` Guenter Roeck
@ 2020-10-11 18:01 ` Al Viro
0 siblings, 0 replies; 15+ messages in thread
From: Al Viro @ 2020-10-11 18:01 UTC (permalink / raw)
To: Guenter Roeck
Cc: Christoph Hellwig, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Trond Myklebust, Anna Schumaker, linux-alpha,
linux-kernel, linux-fsdevel, linux-nfs
On Sun, Oct 11, 2020 at 07:17:49AM -0700, Guenter Roeck wrote:
> Someone didn't bother test building this patch.
>
> arch/alpha/kernel/osf_sys.c: In function '__do_sys_osf_mount':
> arch/alpha/kernel/osf_sys.c:437:14: error: 'path' redeclared as different kind of symbol
Quite. Matter of fact, there's another problem (path_mount()
that needs to be moved from fs/internal.h for that) and IMO this
is simply not worth bothering with. I don't see any benefits
in the last commit in there; the next-to-last one has some
point, and it's not hard to fix, but since it clearly got
no testing whatsoever... Christoph, if you want it back,
resend it later, *after* having tested it. qemu-system-alpha
works well enough to boot the last released debian/alpha.
For now I'm dropping the last two commits from that branch.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-10-11 18:01 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 8:22 remove compat_sys_mount Christoph Hellwig
2020-09-17 8:22 ` [PATCH 1/5] nfs: simplify nfs4_parse_monolithic Christoph Hellwig
2020-09-17 8:22 ` [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code Christoph Hellwig
2020-09-17 17:16 ` Al Viro
2020-09-17 17:18 ` Christoph Hellwig
2020-09-21 6:48 ` Christoph Hellwig
2020-09-21 16:05 ` Anna Schumaker
2020-09-21 18:11 ` Christoph Hellwig
2020-09-23 3:45 ` Al Viro
2020-09-17 8:22 ` [PATCH 3/5] fs: remove compat_sys_mount Christoph Hellwig
2020-09-17 8:22 ` [PATCH 4/5] alpha: simplify osf_mount Christoph Hellwig
2020-10-11 14:22 ` Guenter Roeck
2020-09-17 8:22 ` [PATCH 5/5] fs: remove do_mounts Christoph Hellwig
2020-10-11 14:17 ` Guenter Roeck
2020-10-11 18:01 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).