qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH qemu 00/10] hw/cxl: Mailbox input parser hardening against invalid input.
@ 2024-11-01 13:39 Jonathan Cameron via
  2024-11-01 13:39 ` [PATCH qemu 01/10] hw/cxl: Check size of input data to dynamic capacity mailbox commands Jonathan Cameron via
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: Jonathan Cameron via @ 2024-11-01 13:39 UTC (permalink / raw)
  To: linux-cxl, mst, qemu-devel, Esifiel; +Cc: Fan Ni, linuxarm

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.

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(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2024-11-08 14:50 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 13:39 [PATCH qemu 00/10] hw/cxl: Mailbox input parser hardening against invalid input Jonathan Cameron via
2024-11-01 13:39 ` [PATCH qemu 01/10] hw/cxl: Check size of input data to dynamic capacity mailbox commands Jonathan Cameron via
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 via
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 via
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 via
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 via
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 via
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 via
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 via
2024-11-05 21:32   ` Fan Ni
2024-11-07 15:39   ` Peter Maydell
2024-11-08 14:47     ` Jonathan Cameron via
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 via
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 via
2024-11-05 21:37   ` Fan Ni
2024-11-01 13:45 ` [PATCH qemu 00/10] hw/cxl: Mailbox input parser hardening against invalid input Jonathan Cameron via

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).