From: David Rientjes <rientjes@google.com>
To: John Allen <john.allen@amd.com>
Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org,
seanjc@google.com, Thomas.Lendacky@amd.com, Ashish.Kalra@amd.com,
linux-kernel@vger.kernel.org, theflow@google.com,
pgonda@google.com, stable@vger.kernel.org
Subject: Re: [PATCH v4] crypto: ccp - Use kzalloc for sev ioctl interfaces to prevent kernel memory leak
Date: Sun, 22 May 2022 18:24:47 -0700 (PDT) [thread overview]
Message-ID: <81d016a4-891c-47e6-8a85-7cd9e5661729@google.com> (raw)
In-Reply-To: <20220518153126.265074-1-john.allen@amd.com>
On Wed, 18 May 2022, John Allen wrote:
> For some sev ioctl interfaces, input may be passed that is less than or
> equal to SEV_FW_BLOB_MAX_SIZE, but larger than the data that PSP
> firmware returns. In this case, kmalloc will allocate memory that is the
> size of the input rather than the size of the data. Since PSP firmware
> doesn't fully overwrite the buffer, the sev ioctl interfaces with the
> issue may return uninitialized slab memory.
>
> Currently, all of the ioctl interfaces in the ccp driver are safe, but
> to prevent future problems, change all ioctl interfaces that allocate
> memory with kmalloc to use kzalloc and memset the data buffer to zero
> in sev_ioctl_do_platform_status.
>
> Fixes: 38103671aad3 ("crypto: ccp: Use the stack and common buffer for status commands")
> Fixes: e799035609e15 ("crypto: ccp: Implement SEV_PEK_CSR ioctl command")
> Fixes: 76a2b524a4b1d ("crypto: ccp: Implement SEV_PDH_CERT_EXPORT ioctl command")
> Fixes: d6112ea0cb344 ("crypto: ccp - introduce SEV_GET_ID2 command")
> Cc: stable@vger.kernel.org
> Reported-by: Andy Nguyen <theflow@google.com>
> Suggested-by: David Rientjes <rientjes@google.com>
> Suggested-by: Peter Gonda <pgonda@google.com>
> Signed-off-by: John Allen <john.allen@amd.com>
Acked-by: David Rientjes <rientjes@google.com>
Thanks John!
next prev parent reply other threads:[~2022-05-23 1:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 15:31 John Allen
2022-05-19 17:07 ` Peter Gonda
2022-05-23 1:24 ` David Rientjes [this message]
2022-06-10 9:13 ` Herbert Xu
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=81d016a4-891c-47e6-8a85-7cd9e5661729@google.com \
--to=rientjes@google.com \
--cc=Ashish.Kalra@amd.com \
--cc=Thomas.Lendacky@amd.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=seanjc@google.com \
--cc=stable@vger.kernel.org \
--cc=theflow@google.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
all inboxes | Powered by JetHome®