]> git.pld-linux.org Git - packages/XFree86.git/blob - XFree86-elfloader-linux-non-exec-stack.patch
- 4.8.0 (probably the last XFree86 version ever, for comparison and archival reasons)
[packages/XFree86.git] / XFree86-elfloader-linux-non-exec-stack.patch
1 --- xc/programs/Xserver/hw/xfree86/loader/elfloader.c.orig      2007-04-09 17:37:17.000000000 +0200
2 +++ xc/programs/Xserver/hw/xfree86/loader/elfloader.c   2007-12-02 16:51:49.442062089 +0100
3 @@ -1165,7 +1165,7 @@
4             ErrorF("ELFCreateGOT() Unable to reallocate memory!!!!\n");
5             return FALSE;
6         }
7 -#   if (defined(linux) && defined(__ia64__)) || \
8 +#   if defined(linux) || \
9         defined(__OpenBSD__) || defined(__NetBSD__)
10         {
11             unsigned long page_size = getpagesize();
12 @@ -3483,10 +3483,16 @@
13         elffile->lsection[j].size = SecSize(i);
14         elffile->lsection[j].flags = flags;
15         switch (SecType(i)) {
16 -#if defined(__OpenBSD__) || defined(__NetBSD__)
17 +#if defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__)
18         case SHT_PROGBITS:
19 -           mprotect(elffile->lsection[j].saddr, SecSize(i),
20 +       {
21 +           unsigned long page_size = getpagesize();
22 +           unsigned long round;
23 +
24 +           round = (unsigned long)elffile->lsection[j].saddr & (page_size -1);
25 +           mprotect( (char*)elffile->lsection[j].saddr - round, SecSize(i) + round,
26                      PROT_READ | PROT_WRITE | PROT_EXEC);
27 +       }
28             break;
29  #endif
30         case SHT_SYMTAB:
31 @@ -3688,7 +3694,7 @@
32         ErrorF("Unable to allocate ELF sections\n");
33         return NULL;
34      }
35 -#  if (defined(linux) && defined(__ia64__)) || \
36 +#  if defined(linux) || \
37        defined(__OpenBSD__) || defined(__NetBSD__)
38      {
39         unsigned long page_size = getpagesize();
This page took 0.029215 seconds and 3 git commands to generate.