diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-12-19 13:15:05 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-12-19 13:15:25 -0500 |
commit | 33a9bf25d218173400e1115011ed867e84b4bf38 (patch) | |
tree | dc2f7e8dab42279c2402f48261e88cd484b96999 /sys-apps | |
parent | www-apps/guacamole: version bump to 0.9.9 and remove of 0.8.3. Also use compi... (diff) | |
download | gentoo-33a9bf25d218173400e1115011ed867e84b4bf38.tar.gz gentoo-33a9bf25d218173400e1115011ed867e84b4bf38.tar.bz2 gentoo-33a9bf25d218173400e1115011ed867e84b4bf38.zip |
sys-apps/sandbox: fix memory corruption #568714
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/sandbox/files/sandbox-2.10-memory-corruption.patch | 42 | ||||
-rw-r--r-- | sys-apps/sandbox/sandbox-2.10-r1.ebuild (renamed from sys-apps/sandbox/sandbox-2.10.ebuild) | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/sys-apps/sandbox/files/sandbox-2.10-memory-corruption.patch b/sys-apps/sandbox/files/sandbox-2.10-memory-corruption.patch new file mode 100644 index 000000000000..7dd27c9d2246 --- /dev/null +++ b/sys-apps/sandbox/files/sandbox-2.10-memory-corruption.patch @@ -0,0 +1,42 @@ +From 529a388ebb1b4e9d6ad8a1bb61dd8211833a5976 Mon Sep 17 00:00:00 2001 +From: Denis Lisov <dennis.lissov@gmail.com> +Date: Sat, 19 Dec 2015 19:13:58 +0300 +Subject: [PATCH] libsandbox: fix old_malloc_size check on realloc + +Realloc uses SB_MALLOC_TO_SIZE assuming it returns the usable size, +while it is really the mmap size, which is greater. Thus it may fail +to reallocate even if required. + +URL: https://bugs.gentoo.org/568714 +Signed-off-by: Denis Lisov <dennis.lissov@gmail.com> +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +--- + libsandbox/memory.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/libsandbox/memory.c b/libsandbox/memory.c +index 8581128..a2d69a2 100644 +--- a/libsandbox/memory.c ++++ b/libsandbox/memory.c +@@ -40,7 +40,8 @@ static int sb_munmap(void *addr, size_t length) + + #define SB_MALLOC_TO_MMAP(ptr) ((void*)((uintptr_t)(ptr) - MIN_ALIGN)) + #define SB_MMAP_TO_MALLOC(ptr) ((void*)((uintptr_t)(ptr) + MIN_ALIGN)) +-#define SB_MALLOC_TO_SIZE(ptr) (*((size_t*)SB_MALLOC_TO_MMAP(ptr))) ++#define SB_MALLOC_TO_MMAP_SIZE(ptr) (*((size_t*)SB_MALLOC_TO_MMAP(ptr))) ++#define SB_MALLOC_TO_SIZE(ptr) (SB_MALLOC_TO_MMAP_SIZE(ptr) - MIN_ALIGN) + + void *malloc(size_t size) + { +@@ -57,7 +58,7 @@ void free(void *ptr) + { + if (ptr == NULL) + return; +- if (munmap(SB_MALLOC_TO_MMAP(ptr), SB_MALLOC_TO_SIZE(ptr))) ++ if (munmap(SB_MALLOC_TO_MMAP(ptr), SB_MALLOC_TO_MMAP_SIZE(ptr))) + sb_ebort("sandbox memory corruption with free(%p): %s\n", + ptr, strerror(errno)); + } +-- +2.6.2 + diff --git a/sys-apps/sandbox/sandbox-2.10.ebuild b/sys-apps/sandbox/sandbox-2.10-r1.ebuild index 2550852a27ae..9df5d2946a02 100644 --- a/sys-apps/sandbox/sandbox-2.10.ebuild +++ b/sys-apps/sandbox/sandbox-2.10-r1.ebuild @@ -46,6 +46,7 @@ sb_foreach_abi() { src_unpack() { unpacker cd "${S}" + epatch "${FILESDIR}"/${P}-memory-corruption.patch #568714 epatch_user } |