From: Keith Busch <kbusch@kernel.org>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: Keith Busch <kbusch@meta.com>,
linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me
Subject: Re: New warning `nvme nvme0: using unchecked data buffer` (was: [PATCHv3 3/3] nvme-pci: use sgls for all user requests if possible)
Date: Mon, 2 Dec 2024 08:05:15 -0700 [thread overview]
Message-ID: <Z03Mq9xaMXbJtm0d@kbusch-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <ed59976f-d8ef-411a-b159-0bb1c6bdfa8c@molgen.mpg.de>
On Mon, Dec 02, 2024 at 08:56:03AM +0100, Paul Menzel wrote:
> Am 18.11.24 um 16:57 schrieb Keith Busch:
> > From: Keith Busch <kbusch@kernel.org>
> >
> > If the device supports SGLs, use these for all user requests. This
> > format encodes the expected transfer length so it can catch short buffer
> > errors in a user command, whether it occurred accidently or maliciously.
> >
> > For controllers that support SGL data mode, this is a viable mitigation
> > to CVE-2023-6238. For controllers that don't support SGL, log a warning
>
> For the layman, what is this security problem?
The passthrough interface can't validate buffer lengths against the
command's actual payload. NVMe traditionally did not have explicit
buffer sizes encoded in commands, so this only works correctly if the
device and host both agree on what the implicit transfer size actually
is. More recent NVMe features fixed that problem with explicit buffer
sizes in the commands.
Whether by accident or on purpose, user space can request a smaller
buffer than the device is going to transfer into it. That will corrupt
memory.
> > - if (has_metadata && !supports_metadata)
> > - return -EINVAL;
> > + if (!nvme_ctrl_sgl_supported(ctrl))
> > + dev_warn_once(ctrl->device, "using unchecked data buffer\n");
>
> Linux logs this on the Dell XPS 13 9360 with PC300 NVMe SK hynix 512GB
> (firmware revision 20004A00).
>
> [ 14.399238] nvme nvme0: using unchecked data buffer
>
> What should a user do about it?
Nothing for a user to do. This is an indication that the passthrough
interface has been used with a device that can only use implicit
transfer lengths. It's more of an indication that improper use of this
interface might be the cause of memory corruption observations.
next prev parent reply other threads:[~2024-12-02 15:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 15:57 [PATCHv3 0/3] meta sgl and userspace protection Keith Busch
2024-11-18 15:57 ` [PATCHv3 1/3] nvme-pci: add support for sgl metadata Keith Busch
2024-11-18 16:27 ` Christoph Hellwig
2024-11-18 15:57 ` [PATCHv3 2/3] nvme: define the remaining used sgls constants Keith Busch
2024-11-18 16:28 ` Christoph Hellwig
2024-11-18 15:57 ` [PATCHv3 3/3] nvme-pci: use sgls for all user requests if possible Keith Busch
2024-11-18 16:28 ` Christoph Hellwig
2024-12-02 7:56 ` New warning `nvme nvme0: using unchecked data buffer` (was: [PATCHv3 3/3] nvme-pci: use sgls for all user requests if possible) Paul Menzel
2024-12-02 15:05 ` Keith Busch [this message]
2024-12-02 15:15 ` New warning `nvme nvme0: using unchecked data buffer` Paul Menzel
2024-12-02 15:49 ` Keith Busch
2025-01-26 8:37 ` Paul Menzel
2025-01-29 19:00 ` Keith Busch
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=Z03Mq9xaMXbJtm0d@kbusch-mbp.dhcp.thefacebook.com \
--to=kbusch@kernel.org \
--cc=hch@lst.de \
--cc=kbusch@meta.com \
--cc=linux-nvme@lists.infradead.org \
--cc=pmenzel@molgen.mpg.de \
--cc=sagi@grimberg.me \
/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