[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1201121309340.17287@chino.kir.corp.google.com>
Date: Thu, 12 Jan 2012 13:19:54 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Pekka Enberg <penberg@...nel.org>
cc: Sasha Levin <levinsasha928@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, lizf@...fujitsu.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Tyler Hicks <tyhicks@...onical.com>,
Dustin Kirkland <kirkland@...onical.com>,
ecryptfs@...r.kernel.org
Subject: Re: [PATCH] mm: Don't warn if memdup_user fails
On Thu, 12 Jan 2012, Pekka Enberg wrote:
> I think you missed Andrew's point. We absolutely want to issue a
> kernel warning here because ecryptfs is misusing the memdup_user()
> API. We must not let userspace processes allocate large amounts of
> memory arbitrarily.
>
I think it's good to fix ecryptfs like Tyler is doing and, at the same
time, ensure that the len passed to memdup_user() makes sense prior to
kmallocing memory with GFP_KERNEL. Perhaps something like
if (WARN_ON(len > PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER))
return ERR_PTR(-ENOMEM);
in which case __GFP_NOWARN is irrelevant. I think memdup_user() should
definitely be taking gfp flags, though, so the caller can specify things
like __GFP_NORETRY on its own to avoid infinitely looping in the page
allocator trying reclaim and possibly calling the oom killer.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists