linux-stable/net/bridge
Shakeel Butt e2c8d550a9 netfilter: ebtables: account ebt_table_info to kmemcg
The [ip,ip6,arp]_tables use x_tables_info internally and the underlying
memory is already accounted to kmemcg. Do the same for ebtables. The
syzbot, by using setsockopt(EBT_SO_SET_ENTRIES), was able to OOM the
whole system from a restricted memcg, a potential DoS.

By accounting the ebt_table_info, the memory used for ebt_table_info can
be contained within the memcg of the allocating process. However the
lifetime of ebt_table_info is independent of the allocating process and
is tied to the network namespace. So, the oom-killer will not be able to
relieve the memory pressure due to ebt_table_info memory. The memory for
ebt_table_info is allocated through vmalloc. Currently vmalloc does not
handle the oom-killed allocating process correctly and one large
allocation can bypass memcg limit enforcement. So, with this patch,
at least the small allocations will be contained. For large allocations,
we need to fix vmalloc.

Reported-by: syzbot+7713f3aa67be76b1552c@syzkaller.appspotmail.com
Signed-off-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2019-01-11 00:55:36 +01:00
..
netfilter netfilter: ebtables: account ebt_table_info to kmemcg 2019-01-11 00:55:36 +01:00
br.c net: bridge: Handle NETDEV_PRE_CHANGEADDR from ports 2018-12-13 18:41:38 -08:00
br_arp_nd_proxy.c net: bridge: convert neigh_suppress_enabled option to a bit 2018-09-26 10:04:23 -07:00
br_device.c bridge: support for ndo_fdb_get 2018-12-16 14:42:34 -08:00
br_fdb.c bridge: support for ndo_fdb_get 2018-12-16 14:42:34 -08:00
br_forward.c net: bridge: add support for backup port 2018-07-23 09:32:15 -07:00
br_if.c net: bridge: Issue NETDEV_PRE_CHANGEADDR 2018-12-13 18:41:38 -08:00
br_input.c net: bridge: add no_linklocal_learn bool option 2018-11-27 15:04:15 -08:00
br_ioctl.c net: bridge: add notifications for the bridge dev on vlan change 2017-11-02 15:53:40 +09:00
br_mdb.c net: switchdev: Add extack argument to switchdev_port_obj_add() 2018-12-12 16:34:21 -08:00
br_multicast.c net: bridge: remove unneeded variable 'err' 2018-12-18 15:50:13 -08:00
br_netfilter_hooks.c net: bridge: fix a bug on using a neighbour cache entry without checking its state 2019-01-07 12:09:02 -05:00
br_netfilter_ipv6.c net: convert bridge_nf to use skb extension infrastructure 2018-12-19 11:21:37 -08:00
br_netlink.c net: bridge: remove unneeded variable 'err' 2018-12-18 15:50:13 -08:00
br_netlink_tunnel.c bridge: netlink: make setlink/dellink notifications more accurate 2017-10-29 11:03:43 +09:00
br_nf_core.c xfrm: Move dst->path into struct xfrm_dst 2017-11-30 09:54:26 -05:00
br_private.h bridge: support for ndo_fdb_get 2018-12-16 14:42:34 -08:00
br_private_stp.h
br_private_tunnel.h bridge: netlink: make setlink/dellink notifications more accurate 2017-10-29 11:03:43 +09:00
br_stp.c net: bridge: add notifications for the bridge dev on vlan change 2017-11-02 15:53:40 +09:00
br_stp_bpdu.c net: introduce __skb_put_[zero, data, u8] 2017-06-20 13:30:14 -04:00
br_stp_if.c net: bridge: add notifications for the bridge dev on vlan change 2017-11-02 15:53:40 +09:00
br_stp_timer.c net: bridge: Convert timers to use timer_setup() 2017-11-03 15:42:49 +09:00
br_switchdev.c net: switchdev: Add extack argument to switchdev_port_obj_add() 2018-12-12 16:34:21 -08:00
br_sysfs_br.c net: bridge: mark hash_elasticity as obsolete 2018-12-05 17:01:51 -08:00
br_sysfs_if.c net: bridge: remove redundant checks for null p->dev and p->br 2018-11-25 10:25:43 -08:00
br_vlan.c net: bridge: Propagate extack to switchdev 2018-12-12 16:34:21 -08:00
br_vlan_tunnel.c bridge: vlan_tunnel: explicitly reset metadata attrs to NULL on failure 2017-02-17 13:33:41 -05:00
Kconfig docs: fix some broken documentation references 2018-09-20 11:09:53 -06:00
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-04 09:26:51 +09:00