lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200203201833.GA15904@breakpoint.cc>
Date:   Mon, 3 Feb 2020 21:18:33 +0100
From:   Florian Westphal <fw@...len.de>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     Florian Westphal <fw@...len.de>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        NetFilter <netfilter-devel@...r.kernel.org>,
        syzbot <syzbot+adf6c6c2be1c3a718121@...kaller.appspotmail.com>,
        Pablo Neira Ayuso <pablo@...filter.org>,
        Jozsef Kadlecsik <kadlec@...filter.org>
Subject: Re: [Patch nf v2 1/3] xt_hashlimit: avoid OOM for user-controlled
 vmalloc

Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Mon, Feb 3, 2020 at 4:16 AM Florian Westphal <fw@...len.de> wrote:
> >
> > Cong Wang <xiyou.wangcong@...il.com> wrote:
> > > The hashtable size could be controlled by user, so use flags
> > > GFP_USER | __GFP_NOWARN to avoid OOM warning triggered by user-space.
> > >
> > > Also add __GFP_NORETRY to avoid retrying, as this is just a
> > > best effort and the failure is already handled gracefully.
> > >
> > > Reported-and-tested-by: syzbot+adf6c6c2be1c3a718121@...kaller.appspotmail.com
> > > Cc: Pablo Neira Ayuso <pablo@...filter.org>
> > > Cc: Jozsef Kadlecsik <kadlec@...filter.org>
> > > Cc: Florian Westphal <fw@...len.de>
> > > Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
> > > ---
> > >  net/netfilter/xt_hashlimit.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
> > > index bccd47cd7190..5d9943b37c42 100644
> > > --- a/net/netfilter/xt_hashlimit.c
> > > +++ b/net/netfilter/xt_hashlimit.c
> > > @@ -293,8 +293,8 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
> > >               if (size < 16)
> > >                       size = 16;
> > >       }
> > > -     /* FIXME: don't use vmalloc() here or anywhere else -HW */
> > > -     hinfo = vmalloc(struct_size(hinfo, hash, size));
> > > +     hinfo = __vmalloc(struct_size(hinfo, hash, size),
> > > +                       GFP_USER | __GFP_NOWARN | __GFP_NORETRY, PAGE_KERNEL);
> >
> > Sorry for not noticing this earlier: should that be GFP_KERNEL_ACCOUNT
> > instead of GFP_USER?
> 
> Why do you think it should be accounted in kmemcg?

We do that for xtables blob allocation, see xt_alloc_table_info().

> I think this one is controlled by user, so I pick GFP_USER,
> like many other cases, for example,
> proc_allowed_congestion_control().

Ok, I see, fair enough -- no objections from me.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ