File modify_ldt-initialize-scratch.patch of Package trinity
From: Jiri Slaby <jslaby@suse.cz>
Date: Mon, 20 Jan 2014 21:29:10 +0100
Subject: modify_ldt: initialize scratch
Patch-mainline: no, submitted jan 20th 2014
We store a pointer in the scratch area, but only conditionally. Hence
there can be an uninitialized value which causes problems in the
tear-down path:
*** Error in `trinity': double free or corruption (!prev):
0x0000000002484530 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x740af)[0x7f2a66eb60af]
/lib64/libc.so.6(+0x798de)[0x7f2a66ebb8de]
/lib64/libc.so.6(+0x7a5e6)[0x7f2a66ebc5e6]
trinity[0x40abc8]
trinity[0x40dabc]
trinity[0x40338a]
trinity[0x40704c]
trinity[0x402c47]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f2a66e63b15]
trinity[0x402f13]
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
syscalls/modify_ldt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/syscalls/modify_ldt.c b/syscalls/modify_ldt.c
index de9cbbeee6f3..c0cac1aa3490 100644
--- a/syscalls/modify_ldt.c
+++ b/syscalls/modify_ldt.c
@@ -18,6 +18,7 @@ static void sanitise_modify_ldt(int childno)
void *ldt;
//struct user_desc *desc;
+ shm->scratch[childno] = 0;
switch (shm->a1[childno]) {
case 0:
/* read the ldt into the memory pointed to by ptr.
--
1.8.5.2