summaryrefslogtreecommitdiffstats
path: root/recipes-security/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2017-08-14 08:56:26 +0800
committerArmin Kuster <akuster808@gmail.com>2017-08-22 18:04:38 -0700
commit81243359f234ceb478fa2b5dd0aa982bd524bcf1 (patch)
treef002891e172468eeea3f1c294c6ef5318073df2c /recipes-security/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch
parent6f53f67a0abe438d65a0c7bec335b93326305d9b (diff)
downloadmeta-security-master-wip2.tar.gz
samhain: update to 4.2.2master-wip2
* update to version 4.2.2 * Add new recipe for standalone mode * Add systemd support * Add patches to fix several issues * samhain-standalone: add ptest support * samhain-server: no need to depend on samhain-server-native * Move common things from the bb to the inc file Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'recipes-security/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch')
-rw-r--r--recipes-security/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/recipes-security/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch b/recipes-security/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch
new file mode 100644
index 0000000..0608660
--- /dev/null
+++ b/recipes-security/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch
@@ -0,0 +1,44 @@
1commit 0f6bdc219e598de08a3f37887efa5dfa50e2b996
2Author: Aws Ismail <aws.ismail@windriver.com>
3Date: Fri Jun 22 15:47:08 2012 -0400
4
5Hash fix for MIPS64 and AARCH64
6
7Samhain uses the addresses of local variables in generating hash
8values. The hashing function is designed only for 32-bit values.
9For MIPS64 when a 64-bit address is passed in the resulting hash
10exceeds the limits of the underlying mechanism and samhain
11ultimately fails. The solution is to simply take the lower
1232-bits of the address and use that in generating hash values.
13
14Signed-off-by: Greg Moffatt <greg.moffatt@windriver.com>
15
16Upstream-Status: Pending
17
18Signed-off-by: Aws Ismail <aws.ismail@windriver.com>
19Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
20
21diff --git a/src/dnmalloc.c b/src/dnmalloc.c
22index da9a5c5..fc91400 100644
23--- a/src/dnmalloc.c
24+++ b/src/dnmalloc.c
25@@ -2703,11 +2703,19 @@ static void freecilst_add(chunkinfoptr p) {
26 }
27
28 /* Calculate the hash table entry for a chunk */
29+#if defined(CONFIG_ARCH_MIPS64) || defined(CONFIG_ARCH_AARCH64)
30+#ifdef STARTHEAP_IS_ZERO
31+#define hash(p) ((((unsigned long) p) & 0x7fffffff) >> 7)
32+#else
33+#define hash(p) ((((unsigned long) p - (unsigned long) startheap) & 0x7fffffff) >> 7)
34+#endif
35+#else
36 #ifdef STARTHEAP_IS_ZERO
37 #define hash(p) (((unsigned long) p) >> 7)
38 #else
39 #define hash(p) (((unsigned long) p - (unsigned long) startheap) >> 7)
40 #endif
41+#endif /* CONFIG_ARCH_MIPS64 */
42
43 static void
44 hashtable_add (chunkinfoptr ci)