compat_sys_mount
Subsystems (4)
PATCH 1/1 compat_sys_mount
This patch replaces 6 implementations of various quality of sys32_mount with a shiny new compat_sys_mount(). It's been tested on parisc64 and sparc64 and fixes a bug exposed by the latest revision of Debian's initscripts. Thanks to Arnd Bergmann and Dave Miller for their suggestions, fixes and testing. Please apply.
arch/ia64/ia32/ia32_entry.S | 2 arch/ia64/ia32/sys_ia32.c | 154 --------------------------- arch/parisc/kernel/sys_parisc32.c | 99 ----------------- arch/parisc/kernel/syscall_table.S | 2 arch/ppc64/kernel/misc.S | 2 arch/ppc64/kernel/sys_ppc32.c | 206 ------------------------------------- arch/s390/kernel/compat_linux.c | 154 --------------------------- arch/s390/kernel/compat_wrapper.S | 2 arch/sparc64/kernel/sys_sparc32.c | 206 ------------------------------------- arch/sparc64/kernel/systbls.S | 2 arch/x86_64/ia32/ia32entry.S | 2 arch/x86_64/ia32/sys_ia32.c | 36 ------ fs/compat.c | 152 +++++++++++++++++++++++++++ fs/namespace.c | 2 include/net/scm.h | 1 15 files changed, 160 insertions(+), 862 deletions(-)
Index: arch/ia64/ia32/ia32_entry.S
===================================================================
RCS file: /var/cvs/linux-2.6/arch/ia64/ia32/ia32_entry.S,v retrieving revision 1.5
arch/ia64/ia32/ia32_entry.S +1 -1
@@ -229,7 +229,7 @@ ia32_syscall_table: data8 sys_ni_syscall data8 sys32_lseek data8 sys_getpid /* 20 */ - data8 sys_mount + data8 compat_sys_mount data8 sys_oldumount data8 sys_setuid /* 16-bit version */ data8 sys_getuid /* 16-bit version */
Index: arch/ia64/ia32/sys_ia32.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/ia64/ia32/sys_ia32.c,v retrieving revision 1.12
arch/ia64/ia32/sys_ia32.c +0 -154
166 lines not on this page · raw message
Index: arch/parisc/kernel/sys_parisc32.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/sys_parisc32.c,v retrieving revision 1.13
arch/parisc/kernel/sys_parisc32.c +0 -99
105 lines not on this page · raw message
Index: arch/parisc/kernel/syscall_table.S
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/syscall_table.S,v retrieving revision 1.5
arch/parisc/kernel/syscall_table.S +1 -1
@@ -84,7 +84,7 @@ ENTRY_DIFF(lseek) ENTRY_SAME(getpid) /* 20 */ /* the 'void * data' parameter may need re-packing in wide */ - ENTRY_DIFF(mount) + ENTRY_COMP(mount) /* concerned about struct sockaddr in wide/narrow */ /* ---> I think sockaddr is OK unless the compiler packs the struct */ /* differently to align the char array */
Index: arch/ppc64/kernel/misc.S
===================================================================
RCS file: /var/cvs/linux-2.6/arch/ppc64/kernel/misc.S,v retrieving revision 1.8
arch/ppc64/kernel/misc.S +1 -1
@@ -593,7 +593,7 @@ _GLOBAL(sys_call_table32) .llong .sys_ni_syscall /* old stat syscall */ .llong .ppc32_lseek .llong .sys_getpid /* 20 */ - .llong .sys32_mount + .llong .compat_sys_mount .llong .sys_oldumount .llong .sys_setuid .llong .sys_getuid
Index: arch/ppc64/kernel/sys_ppc32.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/ppc64/kernel/sys_ppc32.c,v retrieving revision 1.9
arch/ppc64/kernel/sys_ppc32.c +0 -206
218 lines not on this page · raw message
Index: arch/s390/kernel/compat_linux.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/s390/kernel/compat_linux.c,v retrieving revision 1.10
arch/s390/kernel/compat_linux.c +0 -154
166 lines not on this page · raw message
Index: arch/s390/kernel/compat_wrapper.S
===================================================================
RCS file: /var/cvs/linux-2.6/arch/s390/kernel/compat_wrapper.S,v retrieving revision 1.5
arch/s390/kernel/compat_wrapper.S +1 -1
@@ -102,7 +102,7 @@ sys32_mount_wrapper: llgtr %r4,%r4 # char * llgfr %r5,%r5 # unsigned long llgtr %r6,%r6 # void * - jg sys32_mount # branch to system call + jg compat_sys_mount # branch to system call .globl sys32_oldumount_wrapper sys32_oldumount_wrapper:
Index: arch/sparc64/kernel/sys_sparc32.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/sparc64/kernel/sys_sparc32.c,v retrieving revision 1.10
arch/sparc64/kernel/sys_sparc32.c +0 -206
218 lines not on this page · raw message
Index: arch/sparc64/kernel/systbls.S
===================================================================
RCS file: /var/cvs/linux-2.6/arch/sparc64/kernel/systbls.S,v retrieving revision 1.6
arch/sparc64/kernel/systbls.S +1 -1
@@ -52,7 +52,7 @@ sys_call_table32: /*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 .word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount /*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall - .word sys_quotactl, sys_set_tid_address, sys32_mount, sys_ustat, sys_setxattr + .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys_setxattr /*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr /*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
Index: arch/x86_64/ia32/ia32entry.S
===================================================================
RCS file: /var/cvs/linux-2.6/arch/x86_64/ia32/ia32entry.S,v retrieving revision 1.6
arch/x86_64/ia32/ia32entry.S +1 -1
@@ -326,7 +326,7 @@ ia32_sys_call_table: .quad sys_stat .quad sys32_lseek .quad sys_getpid /* 20 */ - .quad sys_mount /* mount */ + .quad compat_sys_mount /* mount */ .quad sys_oldumount /* old_umount */ .quad sys_setuid16 .quad sys_getuid16
Index: arch/x86_64/ia32/sys_ia32.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/x86_64/ia32/sys_ia32.c,v retrieving revision 1.11
arch/x86_64/ia32/sys_ia32.c +0 -36
@@ -40,9 +40,6 @@#include <linux/slab.h> #include <linux/uio.h> #include <linux/nfs_fs.h> -#include <linux/smb_fs.h> -#include <linux/smb_mount.h> -#include <linux/ncp_fs.h> #include <linux/quota.h> #include <linux/module.h> #include <linux/sunrpc/svc.h>
@@ -872,39 +869,6 @@ asmlinkage long sys32_sysfs(int option, u32 arg1, u32 arg2) { return sys_sysfs(option, arg1, arg2); -} - -static char *badfs[] = { -"smbfs" ,"ncpfs" ,NULL -}; - -static int checktype (char *user_type) -{ -int err =0 ; -char **s,*kernel_type =getname (user_type); -if (!kernel_type ||IS_ERR (kernel_type)) -return -EFAULT ; -for (s = badfs; *s; ++s) -if (!strcmp (kernel_type, *s)) { -printk (KERN_ERR "mount32: unsupported fs `%s' -- use 64bit mount\n" , *s); - err = -EINVAL ; -break ; - } -putname (user_type); -return err; -} - -asmlinkage long -sys32_mount (char *dev_name,char *dir_name,char *type, -unsigned long new_flags,u32 data) -{ -int err; -if (!capable (CAP_SYS_ADMIN )) -return -EPERM ; - err =checktype (type); -if (err) -return err; -return sys_mount (dev_name, dir_name, type, new_flags, (void *)AA (data)); } struct sysinfo32 {
Index: fs/compat.c
===================================================================
RCS file: /var/cvs/linux-2.6/fs/compat.c,v
retrieving revision 1.7
fs/compat.c +152 -0
161 lines not on this page · raw message
Index: fs/namespace.c
===================================================================
RCS file: /var/cvs/linux-2.6/fs/namespace.c,v
retrieving revision 1.5
fs/namespace.c +1 -1
@@ -694,7 +694,7 @@ out:return err; } -static int copy_mount_options (const void __user *data,unsigned long *where) +int copy_mount_options (const void __user *data,unsigned long *where) {int i;unsigned long page;
Index: include/net/scm.h
===================================================================
RCS file: /var/cvs/linux-2.6/include/net/scm.h,v
retrieving revision 1.2
include/net/scm.h +1 -0
@@ -2,6 +2,7 @@#define __LINUX_NET_SCM_H#include <linux/limits.h> +#include <linux/net.h> /* Well, we should have at least one descriptor open * to accept passed FDs 8)
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
Quoted 6 lines · Matthew Wilcox
This patch replaces 6 implementations of various quality of
sys32_mountwith a shiny newcompat_sys_mount(). It's been tested on parisc64 and sparc64 and fixes a bug exposed by the latest revision of Debian's initscripts. Thanks to Arnd Bergmann and Dave Miller for their suggestions, fixes and testing.
Ok. This clashed with a number of architectures having fixed the bugs on their own lately, but I tried to merge it all and it looked obvious, so it _should_ be ok. Can you guys verify that the merge was ok, and that all the fixes that the architectures had are also in the new compat layer version?
Linus