Package: nfstrace
Version: 0.4.2-3
Followup-For: Bug #832069
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu zesty ubuntu-patch

Hi Andrew,

This bug is also reproducible on armhf in some kernel configurations, so the
problem was reproduced in Ubuntu and I've prepared a patch to fix this as
well.  Please find attached a fix for the unaligned memory access problem.

Thanks for considering,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru nfstrace-0.4.2/debian/patches/no-unaligned-access.patch nfstrace-0.4.2/debian/patches/no-unaligned-access.patch
--- nfstrace-0.4.2/debian/patches/no-unaligned-access.patch	1969-12-31 16:00:00.000000000 -0800
+++ nfstrace-0.4.2/debian/patches/no-unaligned-access.patch	2016-10-05 20:56:19.000000000 -0700
@@ -0,0 +1,27 @@
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Description: Fix unaligned access in buffer copies
+ There's a TODO in the source about fixing alignment of the address being
+ copied.  This unaligned access is a problem on armhf with some kernel
+ configurations, and is generally slower even on other architectures due
+ to the fixups.  Just use memcpy instead which is bound to do the right
+ thing.
+
+Index: nfstrace-0.4.2/src/filtration/sessions_hash.h
+===================================================================
+--- nfstrace-0.4.2.orig/src/filtration/sessions_hash.h
++++ nfstrace-0.4.2/src/filtration/sessions_hash.h
+@@ -105,12 +105,8 @@
+ 
+     static inline void copy_ipv6(uint32_t dst[4], const uint8_t src[16])
+     {
+-        // TODO:: fix alignment of src!
+-        const uint32_t* s { reinterpret_cast<const uint32_t*>(src) };
+-        dst[0] = s[0];
+-        dst[1] = s[1];
+-        dst[2] = s[2];
+-        dst[3] = s[3];
++        uint8_t* d { reinterpret_cast<uint8_t*>(dst) };
++        memcpy(d, src, sizeof(uint32_t) * 4);
+     }
+ 
+     struct IPv6PortsKeyHash
diff -Nru nfstrace-0.4.2/debian/patches/series nfstrace-0.4.2/debian/patches/series
--- nfstrace-0.4.2/debian/patches/series	2016-10-04 02:53:11.000000000 -0700
+++ nfstrace-0.4.2/debian/patches/series	2016-10-18 22:52:19.000000000 -0700
@@ -1,2 +1,3 @@
 reproducible_build.patch
 gcc6-ftbfs.patch
+no-unaligned-access.patch

Reply via email to