From c5739d43dbecee6eae3e29844ece857fb19ac092 Mon Sep 17 00:00:00 2001 From: mycroft Date: Fri, 27 Sep 2002 19:48:24 +0000 Subject: [PATCH] Change the munmap() of the text-data gap to mprotect(PROT_NONE). This avoids having scattered little mappings, although it's probably not the best way... --- libexec/ld.elf_so/map_object.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/ld.elf_so/map_object.c b/libexec/ld.elf_so/map_object.c index 63e012a1575a..a1a55e3a5f01 100644 --- a/libexec/ld.elf_so/map_object.c +++ b/libexec/ld.elf_so/map_object.c @@ -1,4 +1,4 @@ -/* $NetBSD: map_object.c,v 1.20 2002/09/24 12:44:58 mycroft Exp $ */ +/* $NetBSD: map_object.c,v 1.21 2002/09/27 19:48:24 mycroft Exp $ */ /* * Copyright 1996 John D. Polstra. @@ -226,8 +226,8 @@ _rtld_map_object(path, fd, sb) /* Unmap the gap between the text and data. */ gap_addr = base_addr + round_up(text_vlimit - base_vaddr); gap_size = data_addr - gap_addr; - if (gap_size != 0 && munmap(gap_addr, gap_size) == -1) { - _rtld_error("munmap of text -> data gap failed: %s", + if (gap_size != 0 && mprotect(gap_addr, gap_size, PROT_NONE) == -1) { + _rtld_error("mprotect of text -> data gap failed: %s", xstrerror(errno)); goto bad2; }