The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear
at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.38
------>
commit c70181b33d491585a96360b02e8067f66567c0ce
Author: Kirill Tkhai <[email protected]>
Date: Wed Jun 9 18:16:02 2021 +0300
ms/netfilter: account ebt_table_info to kmemcg
[This is not in ms kernel yet, but we are not interested in waiting
for next iteration (comment changing was reuested).
https://lkml.org/lkml/2018/12/28/457]
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.
Reported-by: [email protected]
Signed-off-by: Shakeel Butt <[email protected]>
Signed-off-by: Kirill Tkhai <[email protected]>
(cherry picked from vz7 commit 93ffc59d9f9e ("ms/netfilter: account
ebt_table_info to kmemcg"))
ms commit: e2c8d550a973 ("netfilter: ebtables: account ebt_table_info to
kmemcg")
VZ 8 rebase part https://jira.sw.ru/browse/PSBM-127837
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
---
net/bridge/netfilter/ebtables.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index bb8f9e816fb9..be24fff3ab3e 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1132,14 +1132,16 @@ static int do_replace(struct net *net, const void
__user *user,
tmp.name[sizeof(tmp.name) - 1] = 0;
countersize = COUNTER_OFFSET(tmp.nentries) * nr_cpu_ids;
- newinfo = vmalloc(sizeof(*newinfo) + countersize);
+ newinfo = __vmalloc(sizeof(*newinfo) + countersize, GFP_KERNEL_ACCOUNT,
+ PAGE_KERNEL);
if (!newinfo)
return -ENOMEM;
if (countersize)
memset(newinfo->counters, 0, countersize);
- newinfo->entries = vmalloc(tmp.entries_size);
+ newinfo->entries = __vmalloc(tmp.entries_size, GFP_KERNEL_ACCOUNT,
+ PAGE_KERNEL);
if (!newinfo->entries) {
ret = -ENOMEM;
goto free_newinfo;
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel