]> www.infradead.org Git - users/jedix/linux-maple.git/commit
netfilter: x_tables: don't reject valid target size on some architectures
authorFlorian Westphal <fw@strlen.de>
Wed, 1 Jun 2016 00:04:44 +0000 (02:04 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 30 Sep 2016 06:05:50 +0000 (23:05 -0700)
commit7e5e9c3ed3e872fb0785e8b043fa359c72b220dd
treea514984c6d30a764f7fed746084942f2c79e1f05
parente89f33af509bc678338c1b14dee09e2f91ece3a5
netfilter: x_tables: don't reject valid target size on some architectures

Orabug: 24690280
CVE: CVE-2016-3134

[ Upstream commit 7b7eba0f3515fca3296b8881d583f7c1042f5226 ]

Quoting John Stultz:
  In updating a 32bit arm device from 4.6 to Linus' current HEAD, I
  noticed I was having some trouble with networking, and realized that
  /proc/net/ip_tables_names was suddenly empty.
  Digging through the registration process, it seems we're catching on the:

   if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 &&
       target_offset + sizeof(struct xt_standard_target) != next_offset)
         return -EINVAL;

  Where next_offset seems to be 4 bytes larger then the
  offset + standard_target struct size.

next_offset needs to be aligned via XT_ALIGN (so we can access all members
of ip(6)t_entry struct).

This problem didn't show up on i686 as it only needs 4-byte alignment for
u64, but iptables userspace on other 32bit arches does insert extra padding.

Reported-by: John Stultz <john.stultz@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Fixes: 7ed2abddd20cf ("netfilter: x_tables: check standard target size too")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit d97246b5d16b77b57d835b6b4d1bde8ea6566b46)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
net/netfilter/x_tables.c