summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2019-11-29 20:53:13 +0000
committerkettenis <kettenis@openbsd.org>2019-11-29 20:53:13 +0000
commit934484026c7a2904fb164ecd78330ff78899d549 (patch)
tree7a299b6dbcde9ccc290c58929b8dadf4ee37e6fe
parentMove kcov(4)'s p_kd into the "zero on create" section to simplify fork code (diff)
downloadwireguard-openbsd-934484026c7a2904fb164ecd78330ff78899d549.tar.xz
wireguard-openbsd-934484026c7a2904fb164ecd78330ff78899d549.zip
Add an element to the marks array to store the virtual address of the
entry point. ok mlarkin@, deraadt@
-rw-r--r--sys/lib/libsa/loadfile.h5
-rw-r--r--sys/lib/libsa/loadfile_elf.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/lib/libsa/loadfile.h b/sys/lib/libsa/loadfile.h
index be0f7469d24..c7d836f5dac 100644
--- a/sys/lib/libsa/loadfile.h
+++ b/sys/lib/libsa/loadfile.h
@@ -1,5 +1,5 @@
/* $NetBSD: loadfile.h,v 1.1 1999/04/28 09:08:50 christos Exp $ */
-/* $OpenBSD: loadfile.h,v 1.6 2019/04/10 04:17:37 deraadt Exp $ */
+/* $OpenBSD: loadfile.h,v 1.7 2019/11/29 20:53:13 kettenis Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -40,7 +40,8 @@
#define MARK_END 4
#define MARK_RANDOM 5
#define MARK_ERANDOM 6
-#define MARK_MAX 7
+#define MARK_VENTRY 7
+#define MARK_MAX 8
/*
* Bit flags for sections to load
diff --git a/sys/lib/libsa/loadfile_elf.c b/sys/lib/libsa/loadfile_elf.c
index ffe0ad2ff28..0399ede1d76 100644
--- a/sys/lib/libsa/loadfile_elf.c
+++ b/sys/lib/libsa/loadfile_elf.c
@@ -1,5 +1,5 @@
/* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */
-/* $OpenBSD: loadfile_elf.c,v 1.15 2019/10/29 02:55:49 deraadt Exp $ */
+/* $OpenBSD: loadfile_elf.c,v 1.16 2019/11/29 20:53:13 kettenis Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -284,6 +284,7 @@ ELFNAME(exec)(int fd, Elf_Ehdr *elf, uint64_t *marks, int flags)
marks[MARK_START] = LOADADDR(minp);
marks[MARK_ENTRY] = LOADADDR(elf->e_entry);
+ marks[MARK_VENTRY] = elf->e_entry;
marks[MARK_NSYM] = 1; /* XXX: Kernel needs >= 0 */
marks[MARK_SYM] = LOADADDR(elfp);
marks[MARK_END] = LOADADDR(maxp);