Package: release.debian.org User: release.debian....@packages.debian.org Usertags: pu Tags: jessie Severity: normal
In order to address the Sparc fallout in the Wheezy update (#814544), here is the fix for Jessie. This patch is also part of last unstable upload (0.99+dfsg-2). Sebastian
diff -Nru clamav-0.99+dfsg/debian/changelog clamav-0.99+dfsg/debian/changelog --- clamav-0.99+dfsg/debian/changelog 2015-12-14 21:44:42.000000000 +0100 +++ clamav-0.99+dfsg/debian/changelog 2016-02-22 21:15:44.000000000 +0100 @@ -1,3 +1,10 @@ +clamav (0.99+dfsg-0+deb8u2) stable; urgency=medium + + * Add libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch to get the + testsuite passed on sparc. It also seem avoid invalid loads on ARMv5 cpus. + + -- Sebastian Andrzej Siewior <sebast...@breakpoint.cc> Mon, 22 Feb 2016 21:12:51 +0100 + clamav (0.99+dfsg-0+deb8u1) stable; urgency=medium [ Andreas Cadhalpun ] diff -Nru clamav-0.99+dfsg/debian/.git-dpm clamav-0.99+dfsg/debian/.git-dpm --- clamav-0.99+dfsg/debian/.git-dpm 2015-12-11 21:20:24.000000000 +0100 +++ clamav-0.99+dfsg/debian/.git-dpm 2016-02-22 21:15:44.000000000 +0100 @@ -1,6 +1,6 @@ # see git-dpm(1) from git-dpm package -1cc3015d9abdb6a121251aab899dc1baf3117baf -1cc3015d9abdb6a121251aab899dc1baf3117baf +bbc0790fa239ec754ca1693244acacd2e55f97b5 +bbc0790fa239ec754ca1693244acacd2e55f97b5 30b6c6f47c6648ee0ba78a71d4664f5917d83bcb 30b6c6f47c6648ee0ba78a71d4664f5917d83bcb clamav_0.99+dfsg.orig.tar.xz diff -Nru clamav-0.99+dfsg/debian/patches/libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch clamav-0.99+dfsg/debian/patches/libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch --- clamav-0.99+dfsg/debian/patches/libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch 1970-01-01 01:00:00.000000000 +0100 +++ clamav-0.99+dfsg/debian/patches/libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch 2016-02-22 21:15:44.000000000 +0100 @@ -0,0 +1,94 @@ +From bbc0790fa239ec754ca1693244acacd2e55f97b5 Mon Sep 17 00:00:00 2001 +From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc> +Date: Sat, 20 Feb 2016 15:53:48 +0100 +Subject: libclamav: yara: avoid unaliged access to 64bit variable + +The derefence of an unaligned 64bit variable results in a SIGBUS abort +on 32bit SPARC. ARMv5 CPUs seem to perform the load but load garbish. +This memcpy() workaround forces the compiler to do something that works +on even if the data was not properly aligned. For X86 it means no +change. ARM on other hand will produce slightly different code depending +on the CPU used. + +Patch-Name: libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch +Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc> +--- + libclamav/yara_exec.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/libclamav/yara_exec.c b/libclamav/yara_exec.c +index dbd7ae8..808a030 100644 +--- a/libclamav/yara_exec.c ++++ b/libclamav/yara_exec.c +@@ -184,7 +184,7 @@ int yr_execute_code( + #endif + + case OP_PUSH: +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + push(r1); + break; +@@ -194,38 +194,38 @@ int yr_execute_code( + break; + + case OP_CLEAR_M: +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + mem[r1] = 0; + break; + + case OP_ADD_M: +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + pop(r2); + mem[r1] += r2; + break; + + case OP_INCR_M: +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + mem[r1]++; + break; + + case OP_PUSH_M: +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + push(mem[r1]); + break; + + case OP_POP_M: +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + pop(mem[r1]); + break; + + case OP_SWAPUNDEF: +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + pop(r2); + if (r2 != UNDEFINED) +@@ -540,7 +540,7 @@ int yr_execute_code( + + // r1 = number of arguments + +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + + // pop arguments from stack and copy them to args array +@@ -854,7 +854,7 @@ int yr_execute_code( + + #if REAL_YARA //not supported ClamAV + case OP_IMPORT: +- r1 = *(uint64_t*)(ip + 1); ++ memcpy(&r1, ip + 1, sizeof(uint64_t)); + ip += sizeof(uint64_t); + + FAIL_ON_ERROR(yr_modules_load( diff -Nru clamav-0.99+dfsg/debian/patches/series clamav-0.99+dfsg/debian/patches/series --- clamav-0.99+dfsg/debian/patches/series 2015-12-11 21:20:24.000000000 +0100 +++ clamav-0.99+dfsg/debian/patches/series 2016-02-22 21:15:44.000000000 +0100 @@ -8,3 +8,4 @@ clamav_add_private_fts_implementation.patch fix-ssize_t-size_t-off_t-printf-modifier.patch libclamav-use-libmspack.patch +libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch