From: Andrew Morton <akpm@linux-foundation.org>
To: Michal Hocko <mhocko@kernel.org>
Cc: Dmitry Vyukov <dvyukov@google.com>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
Florian Westphal <fw@strlen.de>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
David Miller <davem@davemloft.net>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev <netdev@vger.kernel.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Yang Shi <yang.s@alibaba-inc.com>,
syzkaller-bugs@googlegroups.com,
LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>, Linux-MM <linux-mm@kvack.org>,
David Rientjes <rientjes@google.com>,
guro@fb.com,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [netfilter-core] kernel panic: Out of memory and no killable processes... (2)
Date: Tue, 30 Jan 2018 11:27:45 -0800 [thread overview]
Message-ID: <20180130112745.934883e37e696ab7f875a385@linux-foundation.org> (raw)
In-Reply-To: <20180130140104.GE21609@dhcp22.suse.cz>
On Tue, 30 Jan 2018 15:01:04 +0100 Michal Hocko <mhocko@kernel.org> wrote:
> > Well, this is not about syzkaller, it merely pointed out a potential
> > DoS... And that has to be addressed somehow.
>
> So how about this?
> ---
argh ;)
> >From d48e950f1b04f234b57b9e34c363bdcfec10aeee Mon Sep 17 00:00:00 2001
> From: Michal Hocko <mhocko@suse.com>
> Date: Tue, 30 Jan 2018 14:51:07 +0100
> Subject: [PATCH] net/netfilter/x_tables.c: make allocation less aggressive
>
> syzbot has noticed that xt_alloc_table_info can allocate a lot of
> memory. This is an admin only interface but an admin in a namespace
> is sufficient as well. eacd86ca3b03 ("net/netfilter/x_tables.c: use
> kvmalloc() in xt_alloc_table_info()") has changed the opencoded
> kmalloc->vmalloc fallback into kvmalloc. It has dropped __GFP_NORETRY on
> the way because vmalloc has simply never fully supported __GFP_NORETRY
> semantic. This is still the case because e.g. page tables backing the
> vmalloc area are hardcoded GFP_KERNEL.
>
> Revert back to __GFP_NORETRY as a poors man defence against excessively
> large allocation request here. We will not rule out the OOM killer
> completely but __GFP_NORETRY should at least stop the large request
> in most cases.
>
> Fixes: eacd86ca3b03 ("net/netfilter/x_tables.c: use kvmalloc() in xt_alloc_table_info()")
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> net/netfilter/x_tables.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
> index d8571f414208..a5f5c29bcbdc 100644
> --- a/net/netfilter/x_tables.c
> +++ b/net/netfilter/x_tables.c
> @@ -1003,7 +1003,13 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
> if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages)
> return NULL;
offtopic: preceding comment here is "prevent them from hitting BUG() in
vmalloc.c". I suspect this is ancient code and vmalloc sure as heck
shouldn't go BUG with this input. And it should be using `sz' ;)
So I suspect and hope that this code can be removed. If not, let's fix
vmalloc!
> - info = kvmalloc(sz, GFP_KERNEL);
> + /*
> + * __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);
> if (!info)
> return NULL;
checkpatch sayeth
networking block comments don't use an empty /* line, use /* Comment...
So I'll do that and shall scoot the patch Davewards.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2018-01-30 19:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-28 17:58 syzbot
2018-01-29 0:20 ` Tetsuo Handa
2018-01-29 7:23 ` [netfilter-core] " Florian Westphal
2018-01-29 8:26 ` Kirill A. Shutemov
2018-01-29 16:57 ` Florian Westphal
2018-01-29 18:24 ` Jan Engelhardt
2018-01-29 18:25 ` Michal Hocko
2018-01-29 18:28 ` Kirill A. Shutemov
2018-01-29 22:35 ` Florian Westphal
2018-01-30 7:52 ` Michal Hocko
2018-01-30 8:11 ` Florian Westphal
2018-01-30 8:28 ` Kirill A. Shutemov
2018-01-30 9:02 ` Dmitry Vyukov
2018-01-30 9:57 ` Michal Hocko
2018-01-30 14:01 ` Michal Hocko
2018-01-30 14:01 ` Florian Westphal
2018-01-30 14:39 ` Michal Hocko
2018-02-02 11:41 ` Pablo Neira Ayuso
2018-01-30 19:27 ` Andrew Morton [this message]
2018-01-31 8:19 ` Michal Hocko
2018-02-07 17:44 ` Pablo Neira Ayuso
2018-02-07 19:06 ` Andrew Morton
2018-02-07 19:15 ` Pablo Neira Ayuso
2018-01-30 9:51 ` Michal Hocko
2018-03-23 10:40 ` Tetsuo Handa
2018-03-23 11:23 ` 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=20180130112745.934883e37e696ab7f875a385@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aarcange@redhat.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=dvyukov@google.com \
--cc=fw@strlen.de \
--cc=guro@fb.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=rientjes@google.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=yang.s@alibaba-inc.com \
/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