Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1531387

Re: net/sctp: vmalloc allocation failure in sctp_setsockopt/xt_alloc_table_info

From Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Newsgroups linux.kernel
Subject Re: net/sctp: vmalloc allocation failure in sctp_setsockopt/xt_alloc_table_info
Date 2016-11-28 16:20 +0100
Message-ID <sIvSO-3L8-29@gated-at.bofh.it> (permalink)
References <sItR0-2uX-31@gated-at.bofh.it> <sIuWJ-3cd-25@gated-at.bofh.it> <sIvg6-3iM-29@gated-at.bofh.it> <sIvpL-3m3-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Nov 28, 2016 at 09:39:31AM -0500, Neil Horman wrote:
> On Mon, Nov 28, 2016 at 03:33:40PM +0100, Andrey Konovalov wrote:
> > On Mon, Nov 28, 2016 at 3:13 PM, Neil Horman <nhorman@tuxdriver.com> wrote:
> > > On Mon, Nov 28, 2016 at 02:00:19PM +0100, Andrey Konovalov wrote:
> > >> Hi!
> > >>
> > >> I've got the following error report while running the syzkaller fuzzer.
> > >>
> > >> On commit d8e435f3ab6fea2ea324dce72b51dd7761747523 (Nov 26).
> > >>
> > >> A reproducer is attached.
> > >>
> > >> a.out: vmalloc: allocation failure, allocated 823562240 of 1427091456
> > >> bytes, mode:0x24000c2(GFP_KERNEL|__GFP_HIGHMEM)
> > >>
> > > How much total ram do you have in this system?  The call appears to be
> > > attempting to allocate 1.3 Gb of data.  Even using vmalloc to allow
> > > discontiguous allocation, thats alot of memory, and if enough is in use already,
> > > I could make the argument that this might be expected behavior.
> > 
> > Hi Neail,
> > 
> > I have 2 Gb.
> > 
> That would be why.  Allocating 65% of the available system memory will almost
> certainly lead to OOM failures quickly.
> 
> > Just tested with 4 Gb, everything seems to be working fine.
> > So I guess this is not actually a bug and allocating 1.3 Gb is OK.

Still we probably should avoid the warn triggered by an userspace
application: (untested)

--8<--

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index fc4977456c30..b56a0e128fc3 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -958,7 +958,8 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
 	if (sz <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER))
 		info = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
 	if (!info) {
-		info = vmalloc(sz);
+		info = __vmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_HIGHMEM,
+				 PAGE_KERNEL);
 		if (!info)
 			return NULL;
 	}

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

net/sctp: vmalloc allocation failure in sctp_setsockopt/xt_alloc_table_info Andrey Konovalov <andreyknvl@google.com> - 2016-11-28 14:10 +0100
  Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Neil Horman <nhorman@tuxdriver.com> - 2016-11-28 15:20 +0100
    Re: net/sctp: vmalloc allocation failure in sctp_setsockopt/xt_alloc_table_info Andrey Konovalov <andreyknvl@google.com> - 2016-11-28 15:40 +0100
      Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Neil Horman <nhorman@tuxdriver.com> - 2016-11-28 15:50 +0100
        Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2016-11-28 16:20 +0100
          Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Neil Horman <nhorman@tuxdriver.com> - 2016-11-28 18:50 +0100
            Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Florian Westphal <fw@strlen.de> - 2016-11-28 19:00 +0100
              Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Neil Horman <nhorman@tuxdriver.com> - 2016-11-28 19:00 +0100
                Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2016-11-28 19:20 +0100
                Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2016-11-30 20:30 +0100
                [PATCH] netfilter: avoid warn and OOM on vmalloc call Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2016-11-30 20:50 +0100
                Re: [PATCH] netfilter: avoid warn and OOM on vmalloc call Andrey Konovalov <andreyknvl@google.com> - 2016-12-01 10:50 +0100
                Re: [PATCH] netfilter: avoid warn and OOM on vmalloc call Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2016-12-01 20:10 +0100
                Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Florian Westphal <fw@strlen.de> - 2016-11-28 19:20 +0100
                Re: net/sctp: vmalloc allocation failure in  sctp_setsockopt/xt_alloc_table_info Eric Dumazet <eric.dumazet@gmail.com> - 2016-11-28 19:40 +0100

csiph-web