summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-12-06 15:42:35 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-12-06 15:42:35 +0000
commit246de0b48bc2d962f2399398df2e71cab68e8d95 (patch)
tree921ad3c1ed219364b5d180213c4cbe115ca9343f /target/linux
parented370f4b31683b2ff34a4348e2706d57cc43ed2c (diff)
generic: workaround arptables arpt_arp structure padding issue (#14577)
Linaro GCC 4.6-2013.05 incorrectly pads the arpt_arp structure on at least the ar71xx target, resulting in a two bytes shorter struct in the kernel compared to what arptables userspace expects. When comparing sizeof(struct arpt_arp) in kernel and userspace, the former yields 162 byte, while the latter is 164 byte. As a consequence, the subsequent target_offset and next_offset members of the parent arpt_entry structure contain invalid values when processed by the arptables binary, leading to bad memory accesses in the populate_cache() procedure, subsequently causing a segfault. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38999 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/patches-3.10/614-netfilter_arpt_arp_padding_fix.patch16
1 files changed, 16 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.10/614-netfilter_arpt_arp_padding_fix.patch b/target/linux/generic/patches-3.10/614-netfilter_arpt_arp_padding_fix.patch
new file mode 100644
index 0000000000..70a8d04fa2
--- /dev/null
+++ b/target/linux/generic/patches-3.10/614-netfilter_arpt_arp_padding_fix.patch
@@ -0,0 +1,16 @@
+--- a/include/uapi/linux/netfilter_arp/arp_tables.h
++++ b/include/uapi/linux/netfilter_arp/arp_tables.h
+@@ -68,6 +68,13 @@ struct arpt_arp {
+ __u8 flags;
+ /* Inverse flags */
+ __u16 invflags;
++
++ /* For some reason Linaro GCC 4.6-2013.05 omits the two
++ * byte padding here when building for MIPS 34kc, leading to
++ * userspace abi mismatches.
++ * Add a dummy field to align this struct to 4 bytes
++ */
++ __u16 padding;
+ };
+
+ /* Values for "flag" field in struct arpt_ip (general arp structure).