From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: <linux-cxl@vger.kernel.org>, <mst@redhat.com>,
<qemu-devel@nongnu.org>, Esifiel <esifiel@gmail.com>
Cc: Fan Ni <fan.ni@samsung.com>, <linuxarm@huawei.com>
Subject: Re: [PATCH qemu 00/10] hw/cxl: Mailbox input parser hardening against invalid input.
Date: Fri, 1 Nov 2024 13:45:30 +0000 [thread overview]
Message-ID: <20241101134530.00003470@huawei.com> (raw)
In-Reply-To: <20241101133917.27634-1-Jonathan.Cameron@huawei.com>
On Fri, 1 Nov 2024 13:39:07 +0000
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
> The CXL device mailbox has some variable sized input commands. The payload
> length for each must be established using command especific structures.
>
> If user space is either buggy or malicious, it may use size fields to
> indicate fields beyond the end of the payload sent. Some checks on this
> were missing and Esifiel picked up on this. I've tagged all these fixes
> with Esifiel's Reported-by as either they were in the report or are similar
> issues in other commands.
>
> These can mostly be easily tested by using the raw mailbox commands option
> in Linux and injecting broken commands from user space.
>
> A typical command needs to first check that there is enough data to get to
> the command specific sizing fields, then check the reported size is less
> than or equal to the available payload.
>
> Note that I think it very unlikely anyone is currently using CXL emulation
> with a VM that they do not trust, but that may happen in future so good to
> fix these paths now.
Sorry, forgot to list dependencies.
Based-on: [PATCH 0/7] hw/cxl: Round up of fixes.
Based-on: [PATCH qemu 0/2] hw/cxl: Misc fixes
Based-on: Message-id: 20241014121902.2146424-1-Jonathan.Cameron@huawei.com
Based-on; message-id: 20241101132005.26633-1-Jonathan.Cameron@huawei.com
>
> Jonathan Cameron (10):
> hw/cxl: Check size of input data to dynamic capacity mailbox commands
> hw/cxl: Check input includes at least the header in
> cmd_features_set_feature()
> hw/cxl: Check input length is large enough in
> cmd_events_clear_records()
> hw/cxl: Check enough data in cmd_firmware_update_transfer()
> hw/cxl: Check the length of data requested fits in get_log()
> hw/cxl: Avoid accesses beyond the end of cel_log.
> hw/cxl: Ensuring enough data to read parameters in
> cmd_tunnel_management_cmd()
> hw/cxl: Check that writes do not go beyond end of target attributes
> hw/cxl: Ensure there is enough data for the header in
> cmd_ccls_set_lsa()
> hw/cxl: Ensure there is enough data to read the input header in
> cmd_get_physical_port_state()
>
> hw/cxl/cxl-mailbox-utils.c | 73 ++++++++++++++++++++++++++++++++------
> 1 file changed, 62 insertions(+), 11 deletions(-)
>
prev parent reply other threads:[~2024-11-01 13:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 13:39 [PATCH qemu 00/10] hw/cxl: Mailbox input parser hardening against invalid input Jonathan Cameron
2024-11-01 13:39 ` [PATCH qemu 01/10] hw/cxl: Check size of input data to dynamic capacity mailbox commands Jonathan Cameron
2024-11-05 18:01 ` Fan Ni
2024-11-01 13:39 ` [PATCH qemu 02/10] hw/cxl: Check input includes at least the header in cmd_features_set_feature() Jonathan Cameron
2024-11-05 20:59 ` Fan Ni
2024-11-01 13:39 ` [PATCH qemu 03/10] hw/cxl: Check input length is large enough in cmd_events_clear_records() Jonathan Cameron
2024-11-05 21:01 ` Fan Ni
2024-11-01 13:39 ` [PATCH qemu 04/10] hw/cxl: Check enough data in cmd_firmware_update_transfer() Jonathan Cameron
2024-11-05 21:04 ` Fan Ni
2024-11-01 13:39 ` [PATCH qemu 05/10] hw/cxl: Check the length of data requested fits in get_log() Jonathan Cameron
2024-11-05 21:12 ` Fan Ni
2024-11-01 13:39 ` [PATCH qemu 06/10] hw/cxl: Avoid accesses beyond the end of cel_log Jonathan Cameron
2024-11-05 21:18 ` Fan Ni
2024-11-01 13:39 ` [PATCH qemu 07/10] hw/cxl: Ensuring enough data to read parameters in cmd_tunnel_management_cmd() Jonathan Cameron
2024-11-05 21:20 ` Fan Ni
2024-11-01 13:39 ` [PATCH qemu 08/10] hw/cxl: Check that writes do not go beyond end of target attributes Jonathan Cameron
2024-11-05 21:32 ` Fan Ni
2024-11-07 15:39 ` Peter Maydell
2024-11-08 14:47 ` Jonathan Cameron
2024-11-01 13:39 ` [PATCH qemu 09/10] hw/cxl: Ensure there is enough data for the header in cmd_ccls_set_lsa() Jonathan Cameron
2024-11-05 21:36 ` Fan Ni
2024-11-01 13:39 ` [PATCH qemu 10/10] hw/cxl: Ensure there is enough data to read the input header in cmd_get_physical_port_state() Jonathan Cameron
2024-11-05 21:37 ` Fan Ni
2024-11-01 13:45 ` Jonathan Cameron [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=20241101134530.00003470@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=esifiel@gmail.com \
--cc=fan.ni@samsung.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/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