l4p/tcp: fix SIGSEGV when reading IPv6 address 17/22617/1
authorMariusz Drost <mariuszx.drost@intel.com>
Wed, 9 Oct 2019 09:16:20 +0000 (10:16 +0100)
committerMariusz Drost <mariuszx.drost@intel.com>
Wed, 9 Oct 2019 09:32:09 +0000 (10:32 +0100)
IPv6 address is obtained through pointer to mbuf (part storing IPv6
addr). Structure which then holds that pointer defines it as a pointer
to _m128i data type. Because of that, when code is optimized,
instruction vmovdqa is used, which requires data to be aligned to
16-bytes. Pointer from mbuf does not have to be aligned in that way,
which may cause SIGSEGV.

Solution is to add attribute packed and aligned(1) to structure holding
IPv6 address. With that, vmovdqu assembly instruction is used, which is
the equivalent of vmovdqa, but for unaligned data.

Signed-off-by: Mariusz Drost <mariuszx.drost@intel.com>
Change-Id: I66e7ce2a317de2cdbc763ec8e31141605b5e5469

lib/libtle_l4p/net_misc.h

index 2d8dac2..d5896de 100644 (file)
@@ -64,7 +64,7 @@ union ipv6_addrs {
                rte_xmm_t src;
                rte_xmm_t dst;
        };
-};
+} __attribute__((packed, aligned(1)));
 
 union ip_addrs {
        union ipv4_addrs v4;