Source-Changes-HG archive

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

[src/trunk]: src/lib/libkvm Get rid of usrstack/USRSTACK. Document that the o...



details:   https://anonhg.NetBSD.org/src/rev/fff4c4bf71a0
branches:  trunk
changeset: 359576:fff4c4bf71a0
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 10 19:51:30 2022 +0000

description:
Get rid of usrstack/USRSTACK. Document that the old version of getargv is
broken because of ASLR.

diffstat:

 lib/libkvm/kvm.c           |  6 +++---
 lib/libkvm/kvm_aarch64.c   |  5 ++---
 lib/libkvm/kvm_alpha.c     |  5 ++---
 lib/libkvm/kvm_arm.c       |  6 ++----
 lib/libkvm/kvm_hppa.c      |  5 ++---
 lib/libkvm/kvm_i386.c      |  5 ++---
 lib/libkvm/kvm_m68k.c      |  6 ++----
 lib/libkvm/kvm_mips.c      |  5 ++---
 lib/libkvm/kvm_or1k.c      |  5 ++---
 lib/libkvm/kvm_powerpc.c   |  6 ++----
 lib/libkvm/kvm_powerpc64.c |  6 ++----
 lib/libkvm/kvm_private.h   |  3 +--
 lib/libkvm/kvm_proc.c      |  8 +++++---
 lib/libkvm/kvm_riscv.c     |  5 ++---
 lib/libkvm/kvm_sh3.c       |  5 ++---
 lib/libkvm/kvm_sparc.c     |  5 ++---
 lib/libkvm/kvm_sparc64.c   |  5 ++---
 lib/libkvm/kvm_vax.c       |  5 ++---
 lib/libkvm/kvm_x86_64.c    |  5 ++---
 19 files changed, 41 insertions(+), 60 deletions(-)

diffs (truncated from 520 to 300 lines):

diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm.c
--- a/lib/libkvm/kvm.c  Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm.c  Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm.c,v 1.109 2020/05/02 14:31:13 christos Exp $       */
+/*     $NetBSD: kvm.c,v 1.110 2022/01/10 19:51:30 christos Exp $       */
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm.c      8.2 (Berkeley) 2/13/94";
 #else
-__RCSID("$NetBSD: kvm.c,v 1.109 2020/05/02 14:31:13 christos Exp $");
+__RCSID("$NetBSD: kvm.c,v 1.110 2022/01/10 19:51:30 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -289,7 +289,7 @@
 
        /*
         * Call the MD open hook.  This sets:
-        *      usrstack, min_uva, max_uva
+        *      min_uva, max_uva
         */
        if (_kvm_mdopen(kd)) {
                _kvm_err(kd, kd->program, "md init failed");
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_aarch64.c
--- a/lib/libkvm/kvm_aarch64.c  Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_aarch64.c  Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_aarch64.c,v 1.10 2020/11/10 19:14:11 skrll Exp $ */
+/* $NetBSD: kvm_aarch64.c,v 1.11 2022/01/10 19:51:30 christos Exp $ */
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
 
 #include "kvm_private.h"
 
-__RCSID("$NetBSD: kvm_aarch64.c,v 1.10 2020/11/10 19:14:11 skrll Exp $");
+__RCSID("$NetBSD: kvm_aarch64.c,v 1.11 2022/01/10 19:51:30 christos Exp $");
 
 /*ARGSUSED*/
 void
@@ -197,7 +197,6 @@
 _kvm_mdopen(kvm_t *kd)
 {
 
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_alpha.c
--- a/lib/libkvm/kvm_alpha.c    Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_alpha.c    Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_alpha.c,v 1.27 2014/02/19 20:21:22 dsl Exp $ */
+/* $NetBSD: kvm_alpha.c,v 1.28 2022/01/10 19:51:30 christos Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -50,7 +50,7 @@
 
 #include "kvm_private.h"
 
-__RCSID("$NetBSD: kvm_alpha.c,v 1.27 2014/02/19 20:21:22 dsl Exp $");
+__RCSID("$NetBSD: kvm_alpha.c,v 1.28 2022/01/10 19:51:30 christos Exp $");
 
 /*ARGSUSED*/
 void
@@ -186,7 +186,6 @@
 _kvm_mdopen(kvm_t *kd)
 {
 
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_arm.c
--- a/lib/libkvm/kvm_arm.c      Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_arm.c      Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_arm.c,v 1.6 2010/09/20 23:23:16 jym Exp $       */
+/* $NetBSD: kvm_arm.c,v 1.7 2022/01/10 19:51:30 christos Exp $  */
 
 /*-
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: kvm_arm.c,v 1.6 2010/09/20 23:23:16 jym Exp $");
+__RCSID("$NetBSD: kvm_arm.c,v 1.7 2022/01/10 19:51:30 christos Exp $");
 #endif                         /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
@@ -194,13 +194,11 @@
        extern struct ps_strings *__ps_strings;
 
 #if 0                          /* XXX - These vary across arm machines... */
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 #endif
        /* This is somewhat hack-ish, but it works. */
        max_uva = (uintptr_t) (__ps_strings + 1);
-       kd->usrstack = max_uva;
        kd->max_uva = max_uva;
        kd->min_uva = 0;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_hppa.c
--- a/lib/libkvm/kvm_hppa.c     Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_hppa.c     Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm_hppa.c,v 1.7 2014/02/19 20:21:22 dsl Exp $ */
+/*     $NetBSD: kvm_hppa.c,v 1.8 2022/01/10 19:51:30 christos Exp $    */
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm_hp300.c        8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: kvm_hppa.c,v 1.7 2014/02/19 20:21:22 dsl Exp $");
+__RCSID("$NetBSD: kvm_hppa.c,v 1.8 2022/01/10 19:51:30 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -197,7 +197,6 @@
 _kvm_mdopen(kvm_t *kd)
 {
 
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_i386.c
--- a/lib/libkvm/kvm_i386.c     Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_i386.c     Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm_i386.c,v 1.31 2020/04/25 05:17:16 maxv Exp $       */
+/*     $NetBSD: kvm_i386.c,v 1.32 2022/01/10 19:51:30 christos Exp $   */
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm_hp300.c        8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: kvm_i386.c,v 1.31 2020/04/25 05:17:16 maxv Exp $");
+__RCSID("$NetBSD: kvm_i386.c,v 1.32 2022/01/10 19:51:30 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -228,7 +228,6 @@
 _kvm_mdopen(kvm_t *kd)
 {
 
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_m68k.c
--- a/lib/libkvm/kvm_m68k.c     Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_m68k.c     Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm_m68k.c,v 1.19 2014/01/27 21:00:01 matt Exp $       */
+/*     $NetBSD: kvm_m68k.c,v 1.20 2022/01/10 19:51:30 christos Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 #include "kvm_private.h"
 #include "kvm_m68k.h"
 
-__RCSID("$NetBSD: kvm_m68k.c,v 1.19 2014/01/27 21:00:01 matt Exp $");
+__RCSID("$NetBSD: kvm_m68k.c,v 1.20 2022/01/10 19:51:30 christos Exp $");
 
 struct name_ops {
        const char *name;
@@ -157,13 +157,11 @@
        extern struct ps_strings *__ps_strings;
 
 #if 0  /* XXX - These vary across m68k machines... */
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 #endif
        /* This is somewhat hack-ish, but it works. */
        max_uva = (u_long) (__ps_strings + 1);
-       kd->usrstack = max_uva;
        kd->max_uva  = max_uva;
        kd->min_uva  = 0;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_mips.c
--- a/lib/libkvm/kvm_mips.c     Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_mips.c     Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_mips.c,v 1.22 2014/02/19 20:21:22 dsl Exp $ */
+/* $NetBSD: kvm_mips.c,v 1.23 2022/01/10 19:51:30 christos Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: kvm_mips.c,v 1.22 2014/02/19 20:21:22 dsl Exp $");
+__RCSID("$NetBSD: kvm_mips.c,v 1.23 2022/01/10 19:51:30 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -236,7 +236,6 @@
 _kvm_mdopen(kvm_t *kd)
 {
 
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_or1k.c
--- a/lib/libkvm/kvm_or1k.c     Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_or1k.c     Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm_or1k.c,v 1.1 2014/09/03 19:34:26 matt Exp $        */
+/*     $NetBSD: kvm_or1k.c,v 1.2 2022/01/10 19:51:30 christos Exp $    */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -51,7 +51,7 @@
 #include <machine/kcore.h>
 #include <machine/vmparam.h>
 
-__RCSID("$NetBSD: kvm_or1k.c,v 1.1 2014/09/03 19:34:26 matt Exp $");
+__RCSID("$NetBSD: kvm_or1k.c,v 1.2 2022/01/10 19:51:30 christos Exp $");
 
 void
 _kvm_freevtop(kvm_t *kd)
@@ -118,7 +118,6 @@
 int
 _kvm_mdopen(kvm_t *kd)
 {
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_powerpc.c
--- a/lib/libkvm/kvm_powerpc.c  Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_powerpc.c  Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm_powerpc.c,v 1.13 2014/01/27 21:00:01 matt Exp $    */
+/*     $NetBSD: kvm_powerpc.c,v 1.14 2022/01/10 19:51:30 christos Exp $        */
 
 /*
  * Copyright (c) 2005 Wasabi Systems, Inc.
@@ -91,7 +91,7 @@
 #include <powerpc/oea/bat.h>
 #include <powerpc/oea/pte.h>
 
-__RCSID("$NetBSD: kvm_powerpc.c,v 1.13 2014/01/27 21:00:01 matt Exp $");
+__RCSID("$NetBSD: kvm_powerpc.c,v 1.14 2022/01/10 19:51:30 christos Exp $");
 
 static int     _kvm_match_601bat(kvm_t *, vaddr_t, paddr_t *, int *);
 static int     _kvm_match_bat(kvm_t *, vaddr_t, paddr_t *, int *);
@@ -367,13 +367,11 @@
        extern struct ps_strings *__ps_strings;
 
 #if 0   /* XXX - These vary across powerpc machines... */
-       kd->usrstack = USRSTACK;
        kd->min_uva = VM_MIN_ADDRESS;
        kd->max_uva = VM_MAXUSER_ADDRESS;
 #endif
        /* This is somewhat hack-ish, but it works. */
        max_uva = (uintptr_t) (__ps_strings + 1);
-       kd->usrstack = max_uva;
        kd->max_uva  = max_uva;
        kd->min_uva  = 0;
 
diff -r 3f879fd3e19b -r fff4c4bf71a0 lib/libkvm/kvm_powerpc64.c
--- a/lib/libkvm/kvm_powerpc64.c        Mon Jan 10 19:23:00 2022 +0000
+++ b/lib/libkvm/kvm_powerpc64.c        Mon Jan 10 19:51:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm_powerpc64.c,v 1.6 2014/08/23 02:25:23 matt Exp $   */
+/*     $NetBSD: kvm_powerpc64.c,v 1.7 2022/01/10 19:51:30 christos Exp $       */
 
 /*
  * Copyright (c) 2005 Wasabi Systems, Inc.
@@ -90,7 +90,7 @@
 #include <powerpc/oea/bat.h>
 #include <powerpc/oea/pte.h>
 
-__RCSID("$NetBSD: kvm_powerpc64.c,v 1.6 2014/08/23 02:25:23 matt Exp $");
+__RCSID("$NetBSD: kvm_powerpc64.c,v 1.7 2022/01/10 19:51:30 christos Exp $");
 
 void
 _kvm_freevtop(kvm_t *kd)
@@ -170,13 +170,11 @@
        extern struct ps_strings *__ps_strings;
 



Home | Main Index | Thread Index | Old Index