Source-Changes-HG archive

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

[src/trunk]: src/sys Allow syscall_establish() to install new syscalls when t...



details:   https://anonhg.NetBSD.org/src/rev/fefa1325a9a6
branches:  trunk
changeset: 365283:fefa1325a9a6
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Aug 10 21:44:58 2018 +0000

description:
Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys.  Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

        sys/arch/usermode/modules/syscallemu/syscallemu.c

diffstat:

 sys/arch/i386/i386/linux_syscall.c                     |   5 ++-
 sys/compat/aoutm68k/aoutm68k_exec.c                    |   6 ++-
 sys/compat/freebsd/freebsd_exec.c                      |   6 ++-
 sys/compat/ibcs2/ibcs2_exec.c                          |   6 ++-
 sys/compat/linux/common/linux_exec.c                   |   6 ++-
 sys/compat/linux32/common/linux32_exec.c               |   6 ++-
 sys/compat/netbsd32/netbsd32_netbsd.c                  |   6 ++-
 sys/compat/osf1/osf1_exec.c                            |   6 ++-
 sys/compat/sunos/sunos_exec.c                          |   6 ++-
 sys/compat/sunos32/sunos32_exec.c                      |   6 ++-
 sys/compat/svr4/svr4_exec.c                            |   6 ++-
 sys/compat/svr4_32/svr4_32_exec.c                      |   6 ++-
 sys/compat/ultrix/ultrix_misc.c                        |   6 ++-
 sys/kern/kern_exec.c                                   |   5 ++-
 sys/kern/kern_syscall.c                                |  19 +++++++++----
 sys/kern/makesyscalls.sh                               |  26 +++++++++++++++--
 sys/rump/include/rump-sys/kern.h                       |   3 +-
 sys/rump/kern/lib/libsys_cygwin/sys_cygwin_component.c |   4 ++-
 sys/rump/kern/lib/libsys_linux/sys_linux_component.c   |   4 ++-
 sys/rump/kern/lib/libsys_sunos/sys_sunos_component.c   |   4 ++-
 sys/rump/librump/rumpkern/emul.c                       |   5 ++-
 sys/sys/proc.h                                         |   4 ++-
 sys/sys/systm.h                                        |   3 +-
 23 files changed, 109 insertions(+), 45 deletions(-)

diffs (truncated from 721 to 300 lines):

diff -r e08bd27ac36d -r fefa1325a9a6 sys/arch/i386/i386/linux_syscall.c
--- a/sys/arch/i386/i386/linux_syscall.c        Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/arch/i386/i386/linux_syscall.c        Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_syscall.c,v 1.53 2017/08/12 07:21:57 maxv Exp $  */
+/*     $NetBSD: linux_syscall.c,v 1.54 2018/08/10 21:44:58 pgoyette Exp $      */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.53 2017/08/12 07:21:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.54 2018/08/10 21:44:58 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,6 +53,7 @@
 
 static void linux_syscall(struct trapframe *);
 extern struct sysent linux_sysent[];
+extern const uint32_t linux_sysent_nomodbits[];
 
 void
 linux_syscall_intern(struct proc *p)
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/aoutm68k/aoutm68k_exec.c
--- a/sys/compat/aoutm68k/aoutm68k_exec.c       Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/compat/aoutm68k/aoutm68k_exec.c       Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aoutm68k_exec.c,v 1.29 2018/05/06 13:40:50 kamil Exp $ */
+/*     $NetBSD: aoutm68k_exec.c,v 1.30 2018/08/10 21:44:58 pgoyette Exp $      */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aoutm68k_exec.c,v 1.29 2018/05/06 13:40:50 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aoutm68k_exec.c,v 1.30 2018/08/10 21:44:58 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -49,6 +49,7 @@
 #include <compat/aoutm68k/aoutm68k_syscall.h>
 
 extern struct sysent aoutm68k_sysent[];
+extern const uint32_t aoutm68k_sysent_nomodbits[];
 extern char sigcode[], esigcode[];
 void aoutm68k_syscall_intern(struct proc *);
 
@@ -64,6 +65,7 @@
        .e_nsysent =            AOUTM68K_SYS_NSYSENT,
 #endif
        .e_sysent =             aoutm68k_sysent,
+       .e_nomodbits =          aoutm68k_sysent_nomodbits,
 #ifdef SYSCALL_DEBUG
        .e_syscallnames =       syscallnames,
 #endif
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/freebsd/freebsd_exec.c
--- a/sys/compat/freebsd/freebsd_exec.c Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/compat/freebsd/freebsd_exec.c Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: freebsd_exec.c,v 1.41 2018/05/06 13:40:50 kamil Exp $  */
+/*     $NetBSD: freebsd_exec.c,v 1.42 2018/08/10 21:44:58 pgoyette Exp $       */
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_exec.c,v 1.41 2018/05/06 13:40:50 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_exec.c,v 1.42 2018/08/10 21:44:58 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -54,6 +54,7 @@
 #include <compat/freebsd/freebsd_machdep.h>
 
 extern struct sysent freebsd_sysent[];
+extern const uint32_t freebsd_sysent_nomodbits[];
 extern const char * const freebsd_syscallnames[];
 
 struct uvm_object *emul_freebsd_object;
@@ -72,6 +73,7 @@
        .e_nsysent =            FREEBSD_SYS_NSYSENT,
 #endif
        .e_sysent =             freebsd_sysent,
+       .e_nomodbits =          freebsd_sysent_nomodbits,
 #ifdef SYSCALL_DEBUG
        .e_syscallnames =       freebsd_syscallnames,
 #else
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/ibcs2/ibcs2_exec.c
--- a/sys/compat/ibcs2/ibcs2_exec.c     Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/compat/ibcs2/ibcs2_exec.c     Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_exec.c,v 1.78 2018/05/06 13:40:51 kamil Exp $    */
+/*     $NetBSD: ibcs2_exec.c,v 1.79 2018/08/10 21:44:58 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1998 Scott Bartram
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec.c,v 1.78 2018/05/06 13:40:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec.c,v 1.79 2018/08/10 21:44:58 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -64,6 +64,7 @@
 static void ibcs2_e_proc_exec(struct proc *, struct exec_package *);
 
 extern struct sysent ibcs2_sysent[];
+extern const uint32_t ibcs2_sysent_nomodbits[];
 extern const char * const ibcs2_syscallnames[];
 extern char ibcs2_sigcode[], ibcs2_esigcode[];
 #ifndef __HAVE_SYSCALL_INTERN
@@ -86,6 +87,7 @@
        .e_nsysent =            IBCS2_SYS_NSYSENT,
 #endif
        .e_sysent =             ibcs2_sysent,
+       .e_nomodbits =          ibcs2_sysent_nomodbits,
 #ifdef SYSCALL_DEBUG
        .e_syscallnames =       ibcs2_syscallnames,
 #else
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/linux/common/linux_exec.c
--- a/sys/compat/linux/common/linux_exec.c      Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/compat/linux/common/linux_exec.c      Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_exec.c,v 1.119 2018/05/06 13:40:51 kamil Exp $   */
+/*     $NetBSD: linux_exec.c,v 1.120 2018/08/10 21:44:58 pgoyette Exp $        */
 
 /*-
  * Copyright (c) 1994, 1995, 1998, 2000, 2007, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.119 2018/05/06 13:40:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.120 2018/08/10 21:44:58 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -70,6 +70,7 @@
 #include <compat/linux/common/linux_emuldata.h>
 
 extern struct sysent linux_sysent[];
+extern const uint32_t linux_sysent_nomodbits[];
 extern const char * const linux_syscallnames[];
 extern char linux_sigcode[], linux_esigcode[];
 
@@ -89,6 +90,7 @@
        .e_nsysent =            LINUX_SYS_NSYSENT,
 #endif
        .e_sysent =             linux_sysent,
+       .e_nomodbits =          linux_sysent_nomodbits,
        .e_syscallnames =       linux_syscallnames,
        .e_sendsig =            linux_sendsig,
        .e_trapsignal =         linux_trapsignal,
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/linux32/common/linux32_exec.c
--- a/sys/compat/linux32/common/linux32_exec.c  Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/compat/linux32/common/linux32_exec.c  Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux32_exec.c,v 1.23 2018/05/06 13:40:51 kamil Exp $ */
+/*     $NetBSD: linux32_exec.c,v 1.24 2018/08/10 21:44:58 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 1994-2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_exec.c,v 1.23 2018/05/06 13:40:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_exec.c,v 1.24 2018/08/10 21:44:58 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,6 +55,7 @@
 #include <compat/linux32/linux32_syscall.h>
 
 extern struct sysent linux32_sysent[];
+extern const uint32_t linux32_sysent_nomodbits[];
 extern const char * const linux32_syscallnames[];
 extern char linux32_sigcode[], linux32_esigcode[];
 
@@ -74,6 +75,7 @@
        .e_nsysent =            LINUX32_SYS_NSYSENT,
 #endif
        .e_sysent =             linux32_sysent,
+       .e_nomodbits =          linux32_sysent_nomodbits,
        .e_syscallnames =       linux32_syscallnames,
        .e_sendsig =            linux32_sendsig,
        .e_trapsignal =         linux_trapsignal,
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c     Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c     Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_netbsd.c,v 1.217 2018/07/31 21:00:02 rjs Exp $        */
+/*     $NetBSD: netbsd32_netbsd.c,v 1.218 2018/08/10 21:44:58 pgoyette Exp $   */
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.217 2018/07/31 21:00:02 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.218 2018/08/10 21:44:58 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -90,6 +90,7 @@
 #endif
 
 extern struct sysent netbsd32_sysent[];
+extern const uint32_t netbsd32_sysent_nomodbits[];
 #ifdef SYSCALL_DEBUG
 extern const char * const netbsd32_syscallnames[];
 #endif
@@ -122,6 +123,7 @@
        .e_nsysent =            NETBSD32_SYS_NSYSENT,
 #endif
        .e_sysent =             netbsd32_sysent,
+       .e_nomodbits =          netbsd32_sysent_nomodbits,
 #ifdef SYSCALL_DEBUG
        .e_syscallnames =       netbsd32_syscallnames,
 #else
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/osf1/osf1_exec.c
--- a/sys/compat/osf1/osf1_exec.c       Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/compat/osf1/osf1_exec.c       Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_exec.c,v 1.46 2018/05/06 13:40:51 kamil Exp $ */
+/* $NetBSD: osf1_exec.c,v 1.47 2018/08/10 21:44:58 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_exec.c,v 1.46 2018/05/06 13:40:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_exec.c,v 1.47 2018/08/10 21:44:58 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -50,6 +50,7 @@
 #include <compat/osf1/osf1_cvt.h>
 
 extern struct sysent osf1_sysent[];
+extern const uint32_t osf1_sysent_nomodbits[];
 extern const char * const osf1_syscallnames[];
 extern char osf1_sigcode[], osf1_esigcode[];
 #ifdef __HAVE_SYSCALL_INTERN
@@ -70,6 +71,7 @@
        .e_nsysent =            OSF1_SYS_NSYSENT,
 #endif
        .e_sysent =             osf1_sysent,
+       .e_nomodbits =          osf1_sysent_nomodbits,
 #ifdef SYSCALL_DEBUG
        .e_syscallnames =       osf1_syscallnames,
 #else
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/sunos/sunos_exec.c
--- a/sys/compat/sunos/sunos_exec.c     Fri Aug 10 21:06:42 2018 +0000
+++ b/sys/compat/sunos/sunos_exec.c     Fri Aug 10 21:44:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sunos_exec.c,v 1.56 2018/05/06 13:40:51 kamil Exp $    */
+/*     $NetBSD: sunos_exec.c,v 1.57 2018/08/10 21:44:59 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1993 Theo de Raadt
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos_exec.c,v 1.56 2018/05/06 13:40:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_exec.c,v 1.57 2018/08/10 21:44:59 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -52,6 +52,7 @@
 
 extern int nsunos_sysent;
 extern struct sysent sunos_sysent[];
+extern const uint32_t sunos_sysent_nomodbits[];
 #ifdef SYSCALL_DEBUG
 extern const char * const sunos_syscallnames[];
 #endif
@@ -72,6 +73,7 @@
        .e_nsysent =            SUNOS_SYS_NSYSENT,
 #endif
        .e_sysent =             sunos_sysent,
+       .e_nomodbits =          sunos_sysent_nomodbits,
 #ifdef SYSCALL_DEBUG
        .e_syscallnames =       sunos_syscallnames,
 #else
diff -r e08bd27ac36d -r fefa1325a9a6 sys/compat/sunos32/sunos32_exec.c
--- a/sys/compat/sunos32/sunos32_exec.c Fri Aug 10 21:06:42 2018 +0000



Home | Main Index | Thread Index | Old Index