Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Separate the compat_netbsd32_coredump from the compa...



details:   https://anonhg.NetBSD.org/src/rev/dabb45e54484
branches:  trunk
changeset: 941929:dabb45e54484
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Nov 01 18:51:02 2020 +0000

description:
Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!

diffstat:

 sys/compat/netbsd32/netbsd32.h                |   3 +-
 sys/compat/netbsd32/netbsd32_core.c           |  34 +++++++++++++++++++-------
 sys/kern/compat_stub.c                        |   3 +-
 sys/kern/files.kern                           |   4 +-
 sys/kern/kern_core.c                          |  24 ++++++------------
 sys/kern/kern_sig.c                           |  20 +++++++++++----
 sys/kern/sys_ptrace_common.c                  |   6 +---
 sys/modules/Makefile                          |   3 +-
 sys/modules/compat_netbsd32/Makefile          |   5 +--
 sys/modules/compat_netbsd32_coredump/Makefile |  17 +++++++++++++
 sys/modules/coredump/Makefile                 |  21 ++++++++++------
 sys/sys/compat_stub.h                         |   4 ++-
 sys/sys/param.h                               |   4 +-
 sys/sys/signalvar.h                           |   3 +-
 14 files changed, 95 insertions(+), 56 deletions(-)

diffs (truncated from 420 to 300 lines):

diff -r 2efc45fa4805 -r dabb45e54484 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h    Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32.h    Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32.h,v 1.133 2020/05/16 18:31:48 christos Exp $  */
+/*     $NetBSD: netbsd32.h,v 1.134 2020/11/01 18:51:02 pgoyette Exp $  */
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -1212,6 +1212,7 @@
 
 struct coredump_iostate;
 int    coredump_netbsd32(struct lwp *, struct coredump_iostate *);
+int    real_coredump_netbsd32(struct lwp *, struct coredump_iostate *);
 
 /*
  * random other stuff
diff -r 2efc45fa4805 -r dabb45e54484 sys/compat/netbsd32/netbsd32_core.c
--- a/sys/compat/netbsd32/netbsd32_core.c       Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_core.c       Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_core.c,v 1.15 2019/11/20 19:37:53 pgoyette Exp $      */
+/*     $NetBSD: netbsd32_core.c,v 1.16 2020/11/01 18:51:02 pgoyette Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,22 +45,36 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_core.c,v 1.15 2019/11/20 19:37:53 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_core.c,v 1.16 2020/11/01 18:51:02 pgoyette Exp $");
 
+#include <sys/compat_stub.h>
+#include <sys/exec_elf.h>
 #include <sys/lwp.h>
+#include <sys/module.h>
+
+#define DEPS "compat_netbsd32,compat_netbsd32_ptrace,coredump"
+
+MODULE(MODULE_CLASS_MISC, compat_netbsd32_coredump, DEPS);
 
 #define        CORENAME(x)     __CONCAT(x,32)
 #define        COREINC         <compat/netbsd32/netbsd32.h>
 
-struct coredump_iostate;
-
-int    CORENAME(real_coredump_netbsd)(struct lwp *, struct coredump_iostate *);
-
 #include "../../kern/core_netbsd.c"
 
-int
-CORENAME(coredump_netbsd)(struct lwp *l, struct coredump_iostate *iocookie)     
+static int
+compat_netbsd32_coredump_modcmd(modcmd_t cmd, void *arg)
 {
-       return CORENAME(real_coredump_netbsd)(l, iocookie);
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               MODULE_HOOK_SET(coredump_netbsd32_hook, real_coredump_netbsd32);
+               MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
+               return 0;
+       case MODULE_CMD_FINI:
+               MODULE_HOOK_UNSET(coredump_netbsd32_hook);
+               MODULE_HOOK_UNSET(coredump_elf32_hook);
+               return 0;
+       default:
+               return ENOTTY;
+       }
 }
-
diff -r 2efc45fa4805 -r dabb45e54484 sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c    Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/kern/compat_stub.c    Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.20 2020/10/19 19:33:02 christos Exp $    */
+/* $NetBSD: compat_stub.c,v 1.21 2020/11/01 18:51:02 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -280,6 +280,7 @@
 struct coredump_offset_hook_t coredump_offset_hook;
 struct coredump_write_hook_t coredump_write_hook;
 struct coredump_netbsd_hook_t coredump_netbsd_hook;
+struct coredump_netbsd32_hook_t coredump_netbsd32_hook;
 struct coredump_elf32_hook_t coredump_elf32_hook;
 struct coredump_elf64_hook_t coredump_elf64_hook;
 struct uvm_coredump_walkmap_hook_t uvm_coredump_walkmap_hook;
diff -r 2efc45fa4805 -r dabb45e54484 sys/kern/files.kern
--- a/sys/kern/files.kern       Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/kern/files.kern       Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.kern,v 1.53 2020/10/19 19:33:02 christos Exp $
+#      $NetBSD: files.kern,v 1.54 2020/11/01 18:51:02 pgoyette Exp $
 
 #
 # kernel sources
@@ -167,7 +167,7 @@
 file   kern/sys_process.c              ptrace_hooks | ktrace
 file   kern/sys_process_lwpstatus.c    kern
 file   kern/sys_ptrace.c               ptrace
-file   kern/sys_ptrace_common.c        ptrace
+file   kern/sys_ptrace_common.c        ptrace | procfs
 file   kern/sys_pset.c                 kern
 file   kern/sys_select.c               kern
 file   kern/sys_sig.c                  kern
diff -r 2efc45fa4805 -r dabb45e54484 sys/kern/kern_core.c
--- a/sys/kern/kern_core.c      Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/kern/kern_core.c      Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_core.c,v 1.33 2020/10/26 17:35:39 christos Exp $  */
+/*     $NetBSD: kern_core.c,v 1.34 2020/11/01 18:51:02 pgoyette Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.33 2020/10/26 17:35:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.34 2020/11/01 18:51:02 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -58,13 +58,7 @@
 #include <sys/compat_stub.h>
 #include <sys/exec_elf.h>
 
-#ifdef COMPAT_NETBSD32
-#define COREDUMP_MODULE_DEP    "compat_netbsd32_ptrace"
-#else
-#define COREDUMP_MODULE_DEP    NULL
-#endif
-
-MODULE(MODULE_CLASS_MISC, coredump, COREDUMP_MODULE_DEP);
+MODULE(MODULE_CLASS_MISC, coredump, NULL);
 
 struct coredump_iostate {
        struct lwp *io_lwp;
@@ -89,12 +83,11 @@
                MODULE_HOOK_SET(coredump_write_hook, coredump_write);
                MODULE_HOOK_SET(coredump_offset_hook, coredump_offset);
                MODULE_HOOK_SET(coredump_netbsd_hook, real_coredump_netbsd);
-#ifdef EXEC_ELF32
+#if defined(EXEC_ELF64)
+               MODULE_HOOK_SET(coredump_elf64_hook, real_coredump_elf64);
+#elif defined(EXEC_ELF32)
                MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
 #endif
-#ifdef EXEC_ELF64
-               MODULE_HOOK_SET(coredump_elf64_hook, real_coredump_elf64);
-#endif
                MODULE_HOOK_SET(uvm_coredump_walkmap_hook,
                    uvm_coredump_walkmap);
                MODULE_HOOK_SET(uvm_coredump_count_segs_hook,
@@ -103,10 +96,9 @@
        case MODULE_CMD_FINI:
                MODULE_HOOK_UNSET(uvm_coredump_count_segs_hook);
                MODULE_HOOK_UNSET(uvm_coredump_walkmap_hook);
-#ifdef EXEC_ELF64
+#if defined(EXEC_ELF64)
                MODULE_HOOK_UNSET(coredump_elf64_hook);
-#endif
-#ifdef EXEC_ELF32
+#elif defined(EXEC_ELF32)
                MODULE_HOOK_UNSET(coredump_elf32_hook);
 #endif
                MODULE_HOOK_UNSET(coredump_netbsd_hook);
diff -r 2efc45fa4805 -r dabb45e54484 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/kern/kern_sig.c       Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.394 2020/10/30 22:19:00 christos Exp $  */
+/*     $NetBSD: kern_sig.c,v 1.395 2020/11/01 18:51:02 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.394 2020/10/30 22:19:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.395 2020/11/01 18:51:02 pgoyette Exp $");
 
 #include "opt_execfmt.h"
 #include "opt_ptrace.h"
@@ -2348,16 +2348,27 @@
  * Since the "real" code may (or may not) be present in loadable module,
  * we provide routines here which calls the module hooks.
  */
+
 int
 coredump_netbsd(struct lwp *l, struct coredump_iostate *iocookie)
 {
+
        int retval;
 
        MODULE_HOOK_CALL(coredump_netbsd_hook, (l, iocookie), ENOSYS, retval);
        return retval;
 }
 
-#ifdef EXEC_ELF32
+int
+coredump_netbsd32(struct lwp *l, struct coredump_iostate *iocookie)
+{
+
+       int retval;
+
+       MODULE_HOOK_CALL(coredump_netbsd32_hook, (l, iocookie), ENOSYS, retval);
+       return retval;
+}
+
 int
 coredump_elf32(struct lwp *l, struct coredump_iostate *iocookie)
 {
@@ -2366,9 +2377,7 @@
        MODULE_HOOK_CALL(coredump_elf32_hook, (l, iocookie), ENOSYS, retval);
        return retval;
 }
-#endif
 
-#ifdef EXEC_ELF64
 int
 coredump_elf64(struct lwp *l, struct coredump_iostate *iocookie)
 {
@@ -2377,7 +2386,6 @@
        MODULE_HOOK_CALL(coredump_elf64_hook, (l, iocookie), ENOSYS, retval);
        return retval;
 }
-#endif
 
 /*
  * Put process 'p' into the stopped state and optionally, notify the parent.
diff -r 2efc45fa4805 -r dabb45e54484 sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c      Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/kern/sys_ptrace_common.c      Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_ptrace_common.c,v 1.88 2020/10/25 15:55:36 pgoyette Exp $  */
+/*     $NetBSD: sys_ptrace_common.c,v 1.89 2020/11/01 18:51:02 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.88 2020/10/25 15:55:36 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.89 2020/11/01 18:51:02 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -143,7 +143,6 @@
 
 #include <machine/reg.h>
 
-#ifdef PTRACE
 # ifdef PTRACE_DEBUG
 #  define DPRINTF(a) uprintf a
 # else
@@ -1572,7 +1571,6 @@
 #endif
        return 0;
 }
-#endif /* PTRACE */
 
 MODULE(MODULE_CLASS_EXEC, ptrace_common, NULL);
  
diff -r 2efc45fa4805 -r dabb45e54484 sys/modules/Makefile
--- a/sys/modules/Makefile      Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/modules/Makefile      Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.247 2020/10/14 10:26:59 ryo Exp $
+#      $NetBSD: Makefile,v 1.248 2020/11/01 18:51:02 pgoyette Exp $
 
 .include <bsd.own.mk>
 
@@ -298,6 +298,7 @@
 SUBDIR+=       compat_netbsd32_60      compat_netbsd32_80
 SUBDIR+=       compat_netbsd32_90
 SUBDIR+=       compat_netbsd32_43
+SUBDIR+=       compat_netbsd32_coredump
 SUBDIR+=       compat_netbsd32_mqueue
 SUBDIR+=       compat_netbsd32_nfssrv
 SUBDIR+=       compat_netbsd32_ptrace
diff -r 2efc45fa4805 -r dabb45e54484 sys/modules/compat_netbsd32/Makefile
--- a/sys/modules/compat_netbsd32/Makefile      Sun Nov 01 18:48:13 2020 +0000
+++ b/sys/modules/compat_netbsd32/Makefile      Sun Nov 01 18:51:02 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.35 2020/05/16 18:31:52 christos Exp $
+#      $NetBSD: Makefile,v 1.36 2020/11/01 18:51:03 pgoyette Exp $
 
 .include "../Makefile.inc"
 .include "../Makefile.assym"
@@ -29,8 +29,7 @@
 .if ${NETBSD32_DRMKMS:Uno} == "yes"
 SRCS+= netbsd32_drm.c
 .endif
-SRCS+= netbsd32_acl.c
-SRCS+= netbsd32_core.c         netbsd32_event.c



Home | Main Index | Thread Index | Old Index