[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211202170341.GO5112@ziepe.ca>
Date: Thu, 2 Dec 2021 13:03:41 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: Kees Cook <keescook@...omium.org>
Cc: Bixuan Cui <cuibixuan@...ux.alibaba.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
leon@...nel.org, akpm@...ux-foundation.org, w@....eu
Subject: Re: [PATCH -next] mm: delete oversized WARN_ON() in kvmalloc() calls
On Wed, Dec 01, 2021 at 07:46:01PM -0800, Kees Cook wrote:
> If we're rejecting the value, then it's still a pathological size, so
> shouldn't the check be happening in the caller? I think the WARN is
> doing exactly what it was supposed to do: find the places where bad
> sizes can reach vmalloc.
I think it meshes very poorly with the overflow work:
p = kzalloc(struct_size(p, regions, num_regions), GFP_KERNEL);
If num_regions is user controlled data why should the calling driver
hvae to somehow sanitize num_regions (without bugs!) instead of
relying on struct_size() and kzalloc() to contain all the sanitation?
What you are suggesting just pushes security sensitive coding into
drivers, which I think is the opposite of what we all want?
Jason
Powered by blists - more mailing lists