linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Sasha Levin <sasha.levin@oracle.com>,
	Christoph Lameter <cl@gentwo.org>,
	Pekka Enberg <penberg@kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] slab: prevent warnings when allocating with __GFP_NOWARN
Date: Tue, 11 Jun 2013 12:43:36 -0400	[thread overview]
Message-ID: <20130611164336.GA17241@redhat.com> (raw)
In-Reply-To: <1370968655.3252.49.camel@edumazet-glaptop>

On Tue, Jun 11, 2013 at 09:37:35AM -0700, Eric Dumazet wrote:
 > On Tue, 2013-06-11 at 12:19 -0400, Sasha Levin wrote:
 > 
 > > It might be, but you need CAP_SYS_RESOURCE to go into the dangerous
 > > zone (>pipe_max_size).
 > > 
 > > So if root (or someone with that cap) wants to go there, as Rusty says:
 > > "Root asked, we do."
 > 
 > Yes and no : adding a test to select vmalloc()/vfree() instead of
 > kmalloc()/kfree() will slow down regular users asking 32 pages in their
 > pipe.
 > 
 > If there is no _sensible_ use for large pipes even for root, please do
 > not bloat the code just because we can.

It's not even that this is the only place that this happens.
I've reported similar traces from the ieee802.154 code for some time.

I wouldn't be surprised to find that there are other similar cases where
a user can ask the kernel to do some incredibly huge allocation.

For my fuzz testing runs, I ended up with the patch below to stop the page allocator warnings.

	Dave

--- /home/davej/src/kernel/git-trees/linux/net/ieee802154/af_ieee802154.c	2013-01-04 18:57:17.677270225 -0500
+++ linux-dj/net/ieee802154/af_ieee802154.c	2013-05-06 20:34:30.702926471 -0400
@@ -108,6 +108,12 @@ static int ieee802154_sock_sendmsg(struc
 {
 	struct sock *sk = sock->sk;
 
+	if (len > MAX_ORDER_NR_PAGES * PAGE_SIZE) {
+		printk_once("Massive alloc in %s!: %d > %d\n", __func__,
+			(unsigned int) len, (unsigned int) (MAX_ORDER_NR_PAGES * PAGE_SIZE));
+		return -EINVAL;
+	}
+
 	return sk->sk_prot->sendmsg(iocb, sk, msg, len);
 }
 

--
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>

  reply	other threads:[~2013-06-11 16:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 19:18 Sasha Levin
2013-06-10 19:31 ` Pekka Enberg
2013-06-10 19:56   ` Sasha Levin
2013-06-10 23:40     ` Christoph Lameter
2013-06-11  0:54       ` Sasha Levin
2013-06-11  6:28         ` Pekka Enberg
2013-06-11 13:16           ` Sasha Levin
2013-06-11 15:14             ` Christoph Lameter
2013-06-11 15:16               ` Pekka Enberg
2013-06-11 15:23                 ` Christoph Lameter
2013-06-11 15:44                   ` Sasha Levin
2013-06-11 16:13                     ` Eric Dumazet
2013-06-11 16:19                       ` Sasha Levin
2013-06-11 16:37                         ` Eric Dumazet
2013-06-11 16:43                           ` Dave Jones [this message]
2013-06-11 19:02                           ` Sasha Levin
2013-06-12 13:01                           ` Christoph Lameter
2013-06-11 16:28                       ` Christoph Lameter
2013-06-11 22:34                 ` Andrew Morton
2013-06-13  7:03                   ` Pekka Enberg
2013-06-11 22:10               ` David Rientjes
2013-06-11 15:08         ` Christoph Lameter

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=20130611164336.GA17241@redhat.com \
    --to=davej@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=sasha.levin@oracle.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