summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Cosgrove <tom@cvs.openbsd.org>2004-02-10 01:01:14 +0000
committerTom Cosgrove <tom@cvs.openbsd.org>2004-02-10 01:01:14 +0000
commit178138fbd46c0e9d1ba58e9dbaffc20e2960f1b6 (patch)
treefffdb09ca35d7b9fd35ed4d5e297d4803c90b9cb
parent49df626df1011b4dafdb1f2fe9d42f1364576567 (diff)
Allow /boot to load read-only data segments in ELF kernels.
Thanks to miod@ for testing on many archs. ok deraadt@.
-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