summaryrefslogtreecommitdiff
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-08-13 21:36:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-08-13 21:36:19 +0000
commit46da9636a4959c81e0974caf99f364db627ecc1d (patch)
tree71cd035b35d7f10233931d3ef44b37f74b405fec /usr.sbin/config
parentc953d6473f9bb997c7daa12b81443b2b17296026 (diff)
config -eu uses a second copy of the nlist array[], which should never
become different or the #define's for the slots could diverge. To avoid this, make one a copy of the other at runtime.
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/ukc.c8
-rw-r--r--usr.sbin/config/ukc.h24
2 files changed, 8 insertions, 24 deletions
diff --git a/usr.sbin/config/ukc.c b/usr.sbin/config/ukc.c
index 7fcc46a484c..def912035b1 100644
--- a/usr.sbin/config/ukc.c
+++ b/usr.sbin/config/ukc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ukc.c,v 1.24 2019/08/11 17:08:33 deraadt Exp $ */
+/* $OpenBSD: ukc.c,v 1.25 2019/08/13 21:36:18 deraadt Exp $ */
/*
* Copyright (c) 1999-2001 Mats O Jansson. All rights reserved.
@@ -40,6 +40,7 @@
#define UKC_MAIN
#include "ukc.h"
#include "exec.h"
+#include "config.h"
void init(void);
__dead void usage(void);
@@ -74,6 +75,11 @@ ukc(char *file, char *outfile, int uflag, int force)
errx(1, "nlist: %s", file);
if (uflag) {
+ struct nlist *knl;
+
+ knl = emalloc(sizeof(nl));
+ memcpy(knl, &nl, sizeof nl);
+
if ((kd = kvm_openfiles(NULL,NULL,NULL,O_RDONLY, errbuf)) == 0)
errx(1, "kvm_openfiles: %s", errbuf);
diff --git a/usr.sbin/config/ukc.h b/usr.sbin/config/ukc.h
index b8ef2463caf..071437b9b70 100644
--- a/usr.sbin/config/ukc.h
+++ b/usr.sbin/config/ukc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ukc.h,v 1.15 2019/08/11 17:08:33 deraadt Exp $ */
+/* $OpenBSD: ukc.h,v 1.16 2019/08/13 21:36:18 deraadt Exp $ */
/*
* Copyright (c) 1999-2001 Mats O Jansson. All rights reserved.
@@ -71,28 +71,6 @@ struct nlist nl[] = {
{ "_nkmempages" },
{ NULL },
};
-struct nlist knl[] = {
- { "_locnames" },
- { "_locnamp" },
- { "_cfroots" },
- { "_cfroots_size" },
- { "_pv_size" },
- { "_pv" },
- { "_cfdata" },
- { "_kernel_text" },
- { "_version" },
- { "_extraloc" },
- { "_rextraloc" },
- { "_textraloc" },
- { "_userconf_histlen" },
- { "_userconf_history" },
- { "_tz" },
- { "_pdevnames" },
- { "_pdevnames_size" },
- { "_pdevinit" },
- { "_nkmempages" },
- { NULL },
-};
int maxdev = 0;
int totdev = 0;
int maxpseudo = 0;