From 1490d3327ffb2264d3589a2053da14b241dd49ee Mon Sep 17 00:00:00 2001 From: dsl Date: Sat, 14 Jul 2007 15:41:30 +0000 Subject: [PATCH] Version mount(2) so that the length of the 'data' buffer is passed into the kernel. --- sys/kern/init_sysent.c | 26 ++++++++++++++++---------- sys/kern/syscalls.c | 12 ++++++++---- sys/kern/syscalls.conf | 4 ++-- sys/kern/vfs_syscalls.c | 26 ++++++++++++++++++++++---- sys/sys/mount.h | 4 ++-- sys/sys/syscall.h | 13 ++++++++----- sys/sys/syscallargs.h | 18 ++++++++++++++---- 7 files changed, 72 insertions(+), 31 deletions(-) diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index ec2b172f3102..a58c38d3ebc1 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -1,14 +1,14 @@ -/* $NetBSD: init_sysent.c,v 1.190 2007/04/30 14:47:32 rmind Exp $ */ +/* $NetBSD: init_sysent.c,v 1.191 2007/07/14 15:41:31 dsl Exp $ */ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.169 2007/04/30 14:44:30 rmind Exp + * created from NetBSD: syscalls.master,v 1.170 2007/07/14 15:38:40 dsl Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.190 2007/04/30 14:47:32 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.191 2007/07/14 15:41:31 dsl Exp $"); #include "opt_ktrace.h" #include "opt_nfsserver.h" @@ -91,6 +91,12 @@ __KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.190 2007/04/30 14:47:32 rmind Exp #define compat_30(func) sys_nosys #endif +#ifdef COMPAT_40 +#define compat_40(func) __CONCAT(compat_40_,func) +#else +#define compat_40(func) sys_nosys +#endif + #define s(type) sizeof(type) struct sysent sysent[] = { @@ -141,8 +147,8 @@ struct sysent sysent[] = { { 0, 0, SYCALL_MPSAFE | 0, sys_getpid }, /* 20 = getpid */ #endif - { 4, s(struct sys_mount_args), 0, - sys_mount }, /* 21 = mount */ + { 4, s(struct compat_40_sys_mount_args), 0, + compat_40(sys_mount) }, /* 21 = compat_40 mount */ { 2, s(struct sys_unmount_args), 0, sys_unmount }, /* 22 = unmount */ { 1, s(struct sys_setuid_args), 0, @@ -1064,13 +1070,13 @@ struct sysent sysent[] = { { 4, s(struct sys_lio_listio_args), 0, sys_lio_listio }, /* 406 = lio_listio */ { 0, 0, 0, - sys_nosys }, /* 407 = filler */ + sys_nosys }, /* 407 = unimplemented */ { 0, 0, 0, - sys_nosys }, /* 408 = filler */ + sys_nosys }, /* 408 = unimplemented */ { 0, 0, 0, - sys_nosys }, /* 409 = filler */ - { 0, 0, 0, - sys_nosys }, /* 410 = filler */ + sys_nosys }, /* 409 = unimplemented */ + { 5, s(struct sys___mount50_args), 0, + sys___mount50 }, /* 410 = __mount50 */ { 0, 0, 0, sys_nosys }, /* 411 = filler */ { 0, 0, 0, diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 32f165c1e1f5..117761d77bf0 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -1,14 +1,14 @@ -/* $NetBSD: syscalls.c,v 1.186 2007/04/30 14:47:32 rmind Exp $ */ +/* $NetBSD: syscalls.c,v 1.187 2007/07/14 15:41:31 dsl Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.169 2007/04/30 14:44:30 rmind Exp + * created from NetBSD: syscalls.master,v 1.170 2007/07/14 15:38:40 dsl Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.186 2007/04/30 14:47:32 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.187 2007/07/14 15:41:31 dsl Exp $"); #if defined(_KERNEL_OPT) #include "opt_ktrace.h" @@ -53,7 +53,7 @@ const char *const syscallnames[] = { #else "getpid", /* 20 = getpid */ #endif - "mount", /* 21 = mount */ + "compat_40_mount", /* 21 = compat_40 mount */ "unmount", /* 22 = unmount */ "setuid", /* 23 = setuid */ #ifdef COMPAT_43 @@ -541,4 +541,8 @@ const char *const syscallnames[] = { "aio_suspend", /* 404 = aio_suspend */ "aio_write", /* 405 = aio_write */ "lio_listio", /* 406 = lio_listio */ + "#407 (unimplemented)", /* 407 = unimplemented */ + "#408 (unimplemented)", /* 408 = unimplemented */ + "#409 (unimplemented)", /* 409 = unimplemented */ + "__mount50", /* 410 = __mount50 */ }; diff --git a/sys/kern/syscalls.conf b/sys/kern/syscalls.conf index 711fb4db189c..e9a7b2b97ccd 100644 --- a/sys/kern/syscalls.conf +++ b/sys/kern/syscalls.conf @@ -1,10 +1,10 @@ -# $NetBSD: syscalls.conf,v 1.10 2005/12/11 12:24:30 christos Exp $ +# $NetBSD: syscalls.conf,v 1.11 2007/07/14 15:41:31 dsl Exp $ sysnames="syscalls.c" sysnumhdr="../sys/syscall.h" syssw="init_sysent.c" sysarghdr="../sys/syscallargs.h" -compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30" +compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40" libcompatopts="" switchname="sysent" diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index e866d24a8852..936ed8cb2ff4 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.320 2007/07/12 19:35:37 dsl Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.321 2007/07/14 15:41:31 dsl Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.320 2007/07/12 19:35:37 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.321 2007/07/14 15:41:31 dsl Exp $"); #include "opt_compat_netbsd.h" #include "opt_compat_43.h" @@ -390,11 +390,12 @@ mount_getargs(struct lwp *l, struct vnode *vp, const char *path, int flags, return (error); } +#ifdef COMPAT_40 /* ARGSUSED */ int -sys_mount(struct lwp *l, void *v, register_t *retval) +compat_40_sys_mount(struct lwp *l, void *v, register_t *retval) { - struct sys_mount_args /* { + struct compat_40_sys_mount_args /* { syscallarg(const char *) type; syscallarg(const char *) path; syscallarg(int) flags; @@ -405,6 +406,23 @@ sys_mount(struct lwp *l, void *v, register_t *retval) return do_sys_mount(l, NULL, SCARG(uap, type), SCARG(uap, path), SCARG(uap, flags), SCARG(uap, data), UIO_USERSPACE, 0, &dummy); } +#endif + +int +sys___mount50(struct lwp *l, void *v, register_t *retval) +{ + struct sys___mount50_args /* { + syscallarg(const char *) type; + syscallarg(const char *) path; + syscallarg(int) flags; + syscallarg(void *) data; + syscallarg(size_t) data_len; + } */ *uap = v; + + return do_sys_mount(l, NULL, SCARG(uap, type), SCARG(uap, path), + SCARG(uap, flags), SCARG(uap, data), UIO_USERSPACE, + SCARG(uap, data_len), retval); +} int do_sys_mount(struct lwp *l, struct vfsops *vfsops, const char *type, diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 4aee7c4b36fb..030f68781654 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1,4 +1,4 @@ -/* $NetBSD: mount.h,v 1.160 2007/07/12 19:35:37 dsl Exp $ */ +/* $NetBSD: mount.h,v 1.161 2007/07/14 15:41:30 dsl Exp $ */ /* * Copyright (c) 1989, 1991, 1993 @@ -364,10 +364,10 @@ int getfh(const char *, void *, size_t *) __RENAME(__getfh30); #endif -int mount(const char *, const char *, int, void *); int unmount(const char *, int); #if defined(_NETBSD_SOURCE) #ifndef __LIBC12_SOURCE__ +int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50); int fhopen(const void *, size_t, int) __RENAME(__fhopen40); int fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat40); #endif diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index ceb9eaa14693..da42604063a9 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -1,10 +1,10 @@ -/* $NetBSD: syscall.h,v 1.184 2007/04/30 14:47:32 rmind Exp $ */ +/* $NetBSD: syscall.h,v 1.185 2007/07/14 15:41:30 dsl Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.169 2007/04/30 14:44:30 rmind Exp + * created from NetBSD: syscalls.master,v 1.170 2007/07/14 15:38:40 dsl Exp */ #ifndef _SYS_SYSCALL_H_ @@ -77,8 +77,8 @@ #define SYS_getpid 20 #endif -/* syscall: "mount" ret: "int" args: "const char *" "const char *" "int" "void *" */ -#define SYS_mount 21 +/* syscall: "compat_40_mount" ret: "int" args: "const char *" "const char *" "int" "void *" */ +#define SYS_compat_40_mount 21 /* syscall: "unmount" ret: "int" args: "const char *" "int" */ #define SYS_unmount 22 @@ -1144,6 +1144,9 @@ /* syscall: "lio_listio" ret: "int" args: "int" "struct aiocb *const *" "int" "struct sigevent *" */ #define SYS_lio_listio 406 -#define SYS_MAXSYSCALL 407 +/* syscall: "__mount50" ret: "int" args: "const char *" "const char *" "int" "void *" "size_t" */ +#define SYS___mount50 410 + +#define SYS_MAXSYSCALL 411 #define SYS_NSYSENT 512 #endif /* _SYS_SYSCALL_H_ */ diff --git a/sys/sys/syscallargs.h b/sys/sys/syscallargs.h index df0cc3ede74b..3d7ba977e134 100644 --- a/sys/sys/syscallargs.h +++ b/sys/sys/syscallargs.h @@ -1,10 +1,10 @@ -/* $NetBSD: syscallargs.h,v 1.166 2007/04/30 14:47:33 rmind Exp $ */ +/* $NetBSD: syscallargs.h,v 1.167 2007/07/14 15:41:31 dsl Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.169 2007/04/30 14:44:30 rmind Exp + * created from NetBSD: syscalls.master,v 1.170 2007/07/14 15:38:40 dsl Exp */ #ifndef _SYS_SYSCALLARGS_H_ @@ -118,7 +118,7 @@ struct compat_43_sys_lseek_args { #else #endif -struct sys_mount_args { +struct compat_40_sys_mount_args { syscallarg(const char *) type; syscallarg(const char *) path; syscallarg(int) flags; @@ -1779,6 +1779,14 @@ struct sys_lio_listio_args { syscallarg(struct sigevent *) sig; }; +struct sys___mount50_args { + syscallarg(const char *) type; + syscallarg(const char *) path; + syscallarg(int) flags; + syscallarg(void *) data; + syscallarg(size_t) data_len; +}; + /* * System call prototypes. */ @@ -1826,7 +1834,7 @@ int sys_getpid_with_ppid(struct lwp *, void *, register_t *); int sys_getpid(struct lwp *, void *, register_t *); #endif -int sys_mount(struct lwp *, void *, register_t *); +int compat_40_sys_mount(struct lwp *, void *, register_t *); int sys_unmount(struct lwp *, void *, register_t *); @@ -2520,4 +2528,6 @@ int sys_aio_write(struct lwp *, void *, register_t *); int sys_lio_listio(struct lwp *, void *, register_t *); +int sys___mount50(struct lwp *, void *, register_t *); + #endif /* _SYS_SYSCALLARGS_H_ */