summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-08-13 21:36:18 +0000
committerderaadt <deraadt@openbsd.org>2019-08-13 21:36:18 +0000
commit39cbba3c6e68874f2bedca06e9b13bea6e995fc2 (patch)
treeae9963f3fadafa3a60d8cf71b473c3ed46035228 /usr.sbin/config
parentReorganize the ipmi(4) code a bit in anticipation of adding SSIF support: (diff)
downloadwireguard-openbsd-39cbba3c6e68874f2bedca06e9b13bea6e995fc2.tar.xz
wireguard-openbsd-39cbba3c6e68874f2bedca06e9b13bea6e995fc2.zip
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;