[mupen64plus] 143/262: Update noexecstack.patch, Backport actual commit from upstream
Sven Eckelmann
ecsv-guest at moszumanska.debian.org
Thu Nov 26 05:59:28 UTC 2015
This is an automated email from the git hooks/post-receive script.
ecsv-guest pushed a commit to branch master
in repository mupen64plus.
commit ee582769c445e29186659381772d32b0cb24cd32
Author: Sven Eckelmann <sven.eckelmann at gmx.de>
Date: Sat Oct 3 01:28:02 2009 +0200
Update noexecstack.patch, Backport actual commit from upstream
---
debian/changelog | 1 +
debian/patches/noexecstack.patch | 33 ++++++++++++++++++++++++---------
2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 0b49813..6bea1a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ mupen64plus (1.5+dfsg1-6) UNRELEASED; urgency=low
- Add Origin information to patches
- Update fix_readpng.patch, Backport actual commit from upstream
- Update ftbfs-glibc210.patch, Backport actual commit from upstream
+ - Update noexecstack.patch, Backport actual commit from upstream
-- Sven Eckelmann <sven.eckelmann at gmx.de> Sat, 03 Oct 2009 00:36:41 +0200
diff --git a/debian/patches/noexecstack.patch b/debian/patches/noexecstack.patch
index 66ca3bf..3c0f37b 100644
--- a/debian/patches/noexecstack.patch
+++ b/debian/patches/noexecstack.patch
@@ -9,6 +9,7 @@ Origin: backported, commit:1414
Bug: http://code.google.com/p/mupen64plus/issues/detail?id=268
Bug-Debian: http://bugs.debian.org/547644
Author: Sven Eckelmann <sven.eckelmann at gmx.de>
+Author: Richard Goedeken <Richard at fascinationsoftware.com>
---
diff --git a/Makefile b/Makefile
@@ -30,21 +31,22 @@ index 01493e6e7f70fcd49ec784b97b54882404dbb599..2368afa38816069f4fd176c1936c23f4
ifeq ($(DBG), 1)
CFLAGS += -DDBG
diff --git a/r4300/recomp.c b/r4300/recomp.c
-index 876fc55213fde588365ec948abaf60abb56f07f6..d3672f30f52ed9fbd0391d434c660b0bfd45d774 100644
+index 876fc55213fde588365ec948abaf60abb56f07f6..aafe8642602d88d7f1dd2fbeb08a8968d341e9a7 100644
--- a/r4300/recomp.c
+++ b/r4300/recomp.c
-@@ -20,6 +20,10 @@
+@@ -20,6 +20,11 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdlib.h>
+#if defined(__GNUC__)
++#include <unistd.h>
+#include <malloc.h>
+#include <sys/mman.h>
+#endif
#include "recomp.h"
#include "recomph.h" //include for function prototypes
-@@ -2168,7 +2172,7 @@ void init_block(int *source, precomp_block *block)
+@@ -2168,7 +2173,7 @@ void init_block(int *source, precomp_block *block)
if (!block->block)
{
long memsize = ((length+1)+(length>>2)) * sizeof(precomp_instr);
@@ -53,7 +55,7 @@ index 876fc55213fde588365ec948abaf60abb56f07f6..d3672f30f52ed9fbd0391d434c660b0b
memset(block->block, 0, memsize);
already_exist = 0;
}
-@@ -2178,12 +2182,12 @@ void init_block(int *source, precomp_block *block)
+@@ -2178,12 +2183,12 @@ void init_block(int *source, precomp_block *block)
if (!block->code)
{
#if defined(PROFILE_R4300)
@@ -69,7 +71,7 @@ index 876fc55213fde588365ec948abaf60abb56f07f6..d3672f30f52ed9fbd0391d434c660b0b
}
else
{
-@@ -2574,3 +2578,35 @@ void prefetch_opcode(unsigned int op)
+@@ -2574,3 +2579,48 @@ void prefetch_opcode(unsigned int op)
recomp_ops[((src >> 26) & 0x3F)]();
}
@@ -79,9 +81,19 @@ index 876fc55213fde588365ec948abaf60abb56f07f6..d3672f30f52ed9fbd0391d434c660b0b
+void *malloc_exec(size_t size)
+{
+#if defined(__GNUC__)
-+ void* block = valloc(size);
-+ if (block != NULL)
-+ mprotect(block, size, PROT_READ | PROT_WRITE | PROT_EXEC);
++ int pagesize = sysconf(_SC_PAGE_SIZE);
++ if (pagesize == -1)
++ { printf("Memory error: couldn't determine system memory page size.\n"); return NULL; }
++
++ /* Allocate a buffer aligned on a page boundary;
++ initial protection is PROT_READ | PROT_WRITE */
++ void *block = NULL;
++ if (posix_memalign(&block, pagesize, size) != 0)
++ { printf("Memory error: couldn't allocate %i byte block of %i-byte aligned memory.\n", size, pagesize); return NULL; }
++
++ if (mprotect(block, size, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
++ { printf("Memory error: couldn't set RWX permissions on %i byte block of memory.\n", size); return NULL; }
++
+ return block;
+#else
+ return malloc(size);
@@ -94,7 +106,8 @@ index 876fc55213fde588365ec948abaf60abb56f07f6..d3672f30f52ed9fbd0391d434c660b0b
+void *realloc_exec(void *ptr, size_t size, size_t newsize)
+{
+ void* block = malloc_exec(newsize);
-+ if (block != NULL) {
++ if (block != NULL)
++ {
+ size_t copysize;
+ if (size < newsize)
+ copysize = size;
@@ -105,6 +118,8 @@ index 876fc55213fde588365ec948abaf60abb56f07f6..d3672f30f52ed9fbd0391d434c660b0b
+ free(ptr);
+ return block;
+}
++
++
diff --git a/r4300/recomp.h b/r4300/recomp.h
index d286bef27a9b107e0c5da36ca444a59ed7b9cf8d..1b2c859c7bcdf189d2d75cb8d6e2626f461a2852 100644
--- a/r4300/recomp.h
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus.git
More information about the Pkg-games-commits
mailing list