summaryrefslogtreecommitdiffstats
path: root/sys/lib
diff options
context:
space:
mode:
authortom <tom@openbsd.org>2004-02-10 01:01:13 +0000
committertom <tom@openbsd.org>2004-02-10 01:01:13 +0000
commit10f94942bf44566eb8be7000633072f3efba6c70 (patch)
tree30777ce6cf271ed0f99daf45370c87155289203d /sys/lib
parentThese files are out-of-date and not really relevant to the install. (diff)
downloadwireguard-openbsd-10f94942bf44566eb8be7000633072f3efba6c70.tar.xz
wireguard-openbsd-10f94942bf44566eb8be7000633072f3efba6c70.zip
Allow /boot to load read-only data segments in ELF kernels.
Thanks to miod@ for testing on many archs. ok deraadt@.
Diffstat (limited to 'sys/lib')
-rw-r--r--sys/lib/libsa/loadfile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/lib/libsa/loadfile.c b/sys/lib/libsa/loadfile.c
index c9b8ee1a7d9..b861b93c6c8 100644
--- a/sys/lib/libsa/loadfile.c
+++ b/sys/lib/libsa/loadfile.c
@@ -1,5 +1,5 @@
/* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */
-/* $OpenBSD: loadfile.c,v 1.8 2003/08/11 06:37:39 mickey Exp $ */
+/* $OpenBSD: loadfile.c,v 1.9 2004/02/10 01:01:13 tom Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -285,11 +285,11 @@ elf_exec(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
for (first = 1, i = 0; i < elf->e_phnum; i++) {
if (phdr[i].p_type != PT_LOAD ||
- (phdr[i].p_flags & (PF_W|PF_X)) == 0)
+ (phdr[i].p_flags & (PF_W|PF_R|PF_X)) == 0)
continue;
#define IS_TEXT(p) (p.p_flags & PF_X)
-#define IS_DATA(p) (p.p_flags & PF_W)
+#define IS_DATA(p) ((p.p_flags & PF_X) == 0)
#define IS_BSS(p) (p.p_filesz < p.p_memsz)
/*
* XXX: Assume first address is lowest