From: David Rientjes <rientjes@google.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Peter Gonda <pgonda@google.com>, Andy Nguyen <theflow@google.com>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-crypto@vger.kernel.org, John Allen <john.allen@amd.com>,
"Thomas . Lendacky" <thomas.lendacky@amd.com>
Subject: Re: [PATCH] crypto: ccp - Limit memory allocation in SEV_GET_ID2 ioctl
Date: Fri, 30 Dec 2022 14:01:04 -0800 (PST) [thread overview]
Message-ID: <826b3dda-5b48-2d42-96b8-c49ccebfdfed@google.com> (raw)
In-Reply-To: <Y6wDJd3hfztLoCp1@gondor.apana.org.au>
On Wed, 28 Dec 2022, Herbert Xu wrote:
> On Tue, Dec 27, 2022 at 05:42:31PM -0800, David Rientjes wrote:
> >
> > The goal was to be more explicit about that, but setting __GFP_NOWARN
> > would result in the same functional behavior. If we're to go that route,
> > it would likely be best to add a comment about the limitation.
> >
> > That said, if AMD would prefer this to be an EINVAL instead of a ENOMEM by
> > introducing a more formal limitation on the length that can be used, that
> > would be preferred so that we don't need to rely on the page allocator's
> > max length to enforce this arbitrarily.
>
> Ideally the limit should be set according to the object that
> you're trying to allocate. But if that is truly unlimited,
> and you don't want to see a warning, then GFP_NOWARN seems to
> fit the bill.
>
AMD would be able to speak authoritatively on it, but I think the length
of the ID isn't to be assumed by software because it will likely change
later.
I don't think there's an active vulnerability with the currnet code so we
can likely drop stable@vger.kernel.org for this. The kzalloc() will fail
if you try to allocate over 2MB. If you try to allocate >32KB, the page
allocator will attempt to reclaim but won't oom kill. If you try to
allocate <=32KB, there's the potential for oom kill if nothing is
reclaimable, but if memory is that scarce I think we have bigger problems.
So __GFP_NOWARN will work, but I also think it's subtle enough that it
warrants being coupled with a comment.
prev parent reply other threads:[~2022-12-30 22:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 20:20 [PATCH] crypto: ccp - Limit memory allocation in SEV_GET_ID2 ioctl Peter Gonda
2022-12-15 10:05 ` Herbert Xu
2022-12-28 1:42 ` David Rientjes
2022-12-28 8:49 ` Herbert Xu
2022-12-30 22:01 ` David Rientjes [this message]
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=826b3dda-5b48-2d42-96b8-c49ccebfdfed@google.com \
--to=rientjes@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=john.allen@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pgonda@google.com \
--cc=stable@vger.kernel.org \
--cc=theflow@google.com \
--cc=thomas.lendacky@amd.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