Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libsa Support loading read-only data sections. ARM64...



details:   https://anonhg.NetBSD.org/src/rev/8987a482266c
branches:  trunk
changeset: 992303:8987a482266c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Aug 23 17:35:42 2018 +0000

description:
Support loading read-only data sections. ARM64 ELF kernels need this. ok skrll@

diffstat:

 sys/lib/libsa/loadfile_elf32.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 2edf1a488e23 -r 8987a482266c sys/lib/libsa/loadfile_elf32.c
--- a/sys/lib/libsa/loadfile_elf32.c    Thu Aug 23 16:25:37 2018 +0000
+++ b/sys/lib/libsa/loadfile_elf32.c    Thu Aug 23 17:35:42 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.52 2017/12/21 14:28:39 maxv Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.53 2018/08/23 17:35:42 jmcneill Exp $ */
 
 /*
  * Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc.
@@ -256,7 +256,7 @@
 #endif /* _STANDALONE */
 
 #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)
 
 #ifndef MD_LOADSEG /* Allow processor ABI specific segment loads */
@@ -708,7 +708,7 @@
                        goto loadseg;
 
                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;
 
                if ((IS_TEXT(phdr[i]) && (flags & LOAD_TEXT)) ||



Home | Main Index | Thread Index | Old Index