Package: release.debian.org User: release.debian....@packages.debian.org Usertags: pu Tags: wheezy Severity: normal
In order to address the Sparc fallout in the Wheezy update (#814544), here is the fix. This patch is also part of last unstable upload (0.99+dfsg-2) and pending for Jessie (0.99+dfsg-0+deb8u2, #815598). Sebastian
diff -Nru clamav-0.99+dfsg/debian/changelog clamav-0.99+dfsg/debian/changelog --- clamav-0.99+dfsg/debian/changelog 2016-02-18 04:02:24.000000000 +0100 +++ clamav-0.99+dfsg/debian/changelog 2016-02-22 23:06:12.000000000 +0100 @@ -1,3 +1,10 @@ +clamav (0.99+dfsg-0+deb7u2) oldstable; 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 23:05:03 +0100 + clamav (0.99+dfsg-0+deb7u1) oldstable; 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 2016-02-12 20:46:38.000000000 +0100 +++ clamav-0.99+dfsg/debian/.git-dpm 2016-02-22 23:06:12.000000000 +0100 @@ -1,6 +1,6 @@ # see git-dpm(1) from git-dpm package -94ee2eaadaedd8160a123737fa554be6acb8b761 -94ee2eaadaedd8160a123737fa554be6acb8b761 +b470f97a68f64348adbd019ffcbff49fe155454f +b470f97a68f64348adbd019ffcbff49fe155454f 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 23:06:12.000000000 +0100 @@ -0,0 +1,94 @@ +From b470f97a68f64348adbd019ffcbff49fe155454f 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 2016-02-12 20:46:38.000000000 +0100 +++ clamav-0.99+dfsg/debian/patches/series 2016-02-22 23:06:12.000000000 +0100 @@ -10,3 +10,4 @@ libclamav-add-libmspack-0.5alpha.patch libclamav-use-internal-libmspack.patch libmspack-fix-autoreconf.patch +libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch