[xorg-commit-diffs] xc/programs/Xserver/hw/xfree86/loader elfloader.c, 1.1.4.1.6.4, 1.1.4.1.6.5

Egbert Eich xorg-commit at pdx.freedesktop.org
Fri Apr 2 09:25:24 PST 2004


Committed by: eich

Update of /cvs/xorg/xc/programs/Xserver/hw/xfree86/loader
In directory pdx:/tmp/cvs-serv23355/programs/Xserver/hw/xfree86/loader

Modified Files:
      Tag: XORG-RELEASE-1
	elfloader.c 
Log Message:
 69. Mark PLT table executable on OSes that don't allow to execute data
     areas by default (Bugzilla 395, John Dennis).



Index: elfloader.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v
retrieving revision 1.1.4.1.6.4
retrieving revision 1.1.4.1.6.5
diff -u -d -r1.1.4.1.6.4 -r1.1.4.1.6.5
--- a/elfloader.c	18 Mar 2004 02:18:27 -0000	1.1.4.1.6.4
+++ b/elfloader.c	2 Apr 2004 17:25:21 -0000	1.1.4.1.6.5
@@ -1096,6 +1096,18 @@
 	ErrorF("ELFCreatePLT() Unable to allocate memory!!!!\n");
 	return;
     }
+#   if defined(linux) || defined(__OpenBSD__)
+    {
+	unsigned long page_size = getpagesize();
+	unsigned long round;
+
+	round = (unsigned long)elffile->plt & (page_size - 1);
+	mprotect(elffile->plt - round,
+		 (elffile->pltsize + round + page_size - 1) & ~(page_size - 1),
+		 PROT_READ | PROT_WRITE | PROT_EXEC);
+    }
+#   endif
+									      
     elffile->sections[elffile->pltndx].sh_size = elffile->pltsize;
 # ifdef ELFDEBUG
     ELFDEBUG("ELFCreatePLT: PLT address %lx\n", elffile->plt);




More information about the xorg-commit-diffs mailing list