From: Georgi Nikolov <gnikolov@icdsoft.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>, Florian Westphal <fw@strlen.de>,
Andrew Morton <akpm@linux-foundation.org>,
bugzilla-daemon@bugzilla.kernel.org, linux-mm@kvack.org,
netfilter-devel@vger.kernel.org
Subject: Re: [Bug 200651] New: cgroups iptables-restor: vmalloc: allocation failure
Date: Tue, 7 Aug 2018 14:02:00 +0300 [thread overview]
Message-ID: <5b5e872e-5785-2cfd-7d53-e19e017e5636@icdsoft.com> (raw)
In-Reply-To: <85c86f17-6f96-6f01-2a3c-e2bad0ccb317@icdsoft.com>
On 08/06/2018 11:42 AM, Georgi Nikolov wrote:
> On 08/02/2018 11:50 AM, Michal Hocko wrote:
>> In other words, why don't we simply do the following? Note that this is
>> not tested. I have also no idea what is the lifetime of this allocation.
>> Is it bound to any specific process or is it a namespace bound? If the
>> later then the memcg OOM killer might wipe the whole memcg down without
>> making any progress. This would make the whole namespace unsuable until
>> somebody intervenes. Is this acceptable?
>> ---
>> From 4dec96eb64954a7e58264ed551afadf62ca4c5f7 Mon Sep 17 00:00:00 2001
>> From: Michal Hocko <mhocko@suse.com>
>> Date: Thu, 2 Aug 2018 10:38:57 +0200
>> Subject: [PATCH] netfilter/x_tables: do not fail xt_alloc_table_info too
>> easilly
>>
>> eacd86ca3b03 ("net/netfilter/x_tables.c: use kvmalloc()
>> in xt_alloc_table_info()") has unintentionally fortified
>> xt_alloc_table_info allocation when __GFP_RETRY has been dropped from
>> the vmalloc fallback. Later on there was a syzbot report that this
>> can lead to OOM killer invocations when tables are too large and
>> 0537250fdc6c ("netfilter: x_tables: make allocation less aggressive")
>> has been merged to restore the original behavior. Georgi Nikolov however
>> noticed that he is not able to install his iptables anymore so this can
>> be seen as a regression.
>>
>> The primary argument for 0537250fdc6c was that this allocation path
>> shouldn't really trigger the OOM killer and kill innocent tasks. On the
>> other hand the interface requires root and as such should allow what the
>> admin asks for. Root inside a namespaces makes this more complicated
>> because those might be not trusted in general. If they are not then such
>> namespaces should be restricted anyway. Therefore drop the __GFP_NORETRY
>> and replace it by __GFP_ACCOUNT to enfore memcg constrains on it.
>>
>> Fixes: 0537250fdc6c ("netfilter: x_tables: make allocation less aggressive")
>> Reported-by: Georgi Nikolov <gnikolov@icdsoft.com>
>> Suggested-by: Vlastimil Babka <vbabka@suse.cz>
>> Signed-off-by: Michal Hocko <mhocko@suse.com>
>> ---
>> net/netfilter/x_tables.c | 7 +------
>> 1 file changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
>> index d0d8397c9588..b769408e04ab 100644
>> --- a/net/netfilter/x_tables.c
>> +++ b/net/netfilter/x_tables.c
>> @@ -1178,12 +1178,7 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
>> if (sz < sizeof(*info) || sz >= XT_MAX_TABLE_SIZE)
>> return NULL;
>>
>> - /* __GFP_NORETRY is not fully supported by kvmalloc but it should
>> - * work reasonably well if sz is too large and bail out rather
>> - * than shoot all processes down before realizing there is nothing
>> - * more to reclaim.
>> - */
>> - info = kvmalloc(sz, GFP_KERNEL | __GFP_NORETRY);
>> + info = kvmalloc(sz, GFP_KERNEL | __GFP_ACCOUNT);
>> if (!info)
>> return NULL;
>>
> I will check if this change fixes the problem.
>
> Regards,
>
> --
> Georgi Nikolov
I can't reproduce it anymore.
If i understand correctly this way memory allocated will be
accounted to kmem of this cgroup (if inside cgroup).
next prev parent reply other threads:[~2018-08-07 11:02 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-200651-27@https.bugzilla.kernel.org/>
2018-07-25 19:52 ` Andrew Morton
2018-07-26 7:18 ` Vlastimil Babka
2018-07-26 7:26 ` Michal Hocko
2018-07-26 7:34 ` Vlastimil Babka
2018-07-26 7:42 ` Michal Hocko
2018-07-26 7:50 ` Vlastimil Babka
2018-07-26 8:03 ` Michal Hocko
2018-07-26 8:31 ` Vlastimil Babka
2018-07-26 8:48 ` Vlastimil Babka
2018-07-26 9:02 ` Georgi Nikolov
2018-07-30 13:37 ` Georgi Nikolov
2018-07-30 13:57 ` Michal Hocko
2018-07-30 15:54 ` Georgi Nikolov
2018-07-30 18:38 ` Michal Hocko
2018-07-30 18:51 ` Georgi Nikolov
2018-07-31 6:38 ` Vlastimil Babka
2018-07-31 13:55 ` Georgi Nikolov
2018-07-31 14:05 ` Florian Westphal
2018-07-31 14:25 ` Georgi Nikolov
2018-08-01 7:17 ` Vlastimil Babka
2018-08-01 7:34 ` Vlastimil Babka
2018-08-01 8:33 ` Michal Hocko
2018-08-01 16:03 ` Georgi Nikolov
2018-08-02 8:50 ` Michal Hocko
2018-08-02 9:25 ` Pablo Neira Ayuso
2018-08-02 10:44 ` Michal Hocko
2018-08-06 8:42 ` Georgi Nikolov
2018-08-07 11:02 ` Georgi Nikolov [this message]
2018-08-07 11:09 ` Michal Hocko
2018-08-07 11:19 ` Florian Westphal
2018-08-07 11:26 ` Michal Hocko
2018-08-07 11:30 ` Florian Westphal
2018-08-07 11:38 ` Michal Hocko
2018-08-07 11:31 ` Vlastimil Babka
2018-08-07 13:35 ` Mike Rapoport
2018-08-07 11:29 ` Vlastimil Babka
2018-08-07 11:37 ` Michal Hocko
2018-08-07 18:23 ` Florian Westphal
2018-08-07 19:30 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b5e872e-5785-2cfd-7d53-e19e017e5636@icdsoft.com \
--to=gnikolov@icdsoft.com \
--cc=akpm@linux-foundation.org \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=fw@strlen.de \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox