public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: <dave.jiang@intel.com>, <jonathan.cameron@huawei.com>,
	<vishal.l.verma@intel.com>, <ira.weiny@intel.com>,
	<dan.j.williams@intel.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH 1/2] cxl/mbox: validate payload size before accessing contents in cxl_payload_from_user_allowed()
Date: Mon, 23 Feb 2026 11:23:24 -0800	[thread overview]
Message-ID: <aZypLDJLdhqfpTHn@aschofie-mobl2.lan> (raw)
In-Reply-To: <20260220001618.963490-2-dave@stgolabs.net>

On Thu, Feb 19, 2026 at 04:16:17PM -0800, Davidlohr Bueso wrote:
> cxl_payload_from_user_allowed() casts and dereferences the input
> payload without first verifying its size. When a raw mailbox command
> is sent with an undersized payload (ie: 1 byte for CXL_MBOX_OP_CLEAR_LOG,
> which expects a 16-byte UUID), uuid_equal() reads past the allocated buffer,
> triggering a KASAN splat:
> 
> BUG: KASAN: slab-out-of-bounds in memcmp+0x176/0x1d0 lib/string.c:683
> Read of size 8 at addr ffff88810130f5c0 by task syz.1.62/2258
> 
> CPU: 2 UID: 0 PID: 2258 Comm: syz.1.62 Not tainted 6.19.0-dirty #3 PREEMPT(voluntary)
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014
> Call Trace:
>  <TASK>
>  __dump_stack lib/dump_stack.c:94 [inline]
>  dump_stack_lvl+0xab/0xe0 lib/dump_stack.c:120
>  print_address_description mm/kasan/report.c:378 [inline]
>  print_report+0xce/0x650 mm/kasan/report.c:482
>  kasan_report+0xce/0x100 mm/kasan/report.c:595
>  memcmp+0x176/0x1d0 lib/string.c:683
>  uuid_equal include/linux/uuid.h:73 [inline]
>  cxl_payload_from_user_allowed drivers/cxl/core/mbox.c:345 [inline]
>  cxl_mbox_cmd_ctor drivers/cxl/core/mbox.c:368 [inline]
>  cxl_validate_cmd_from_user drivers/cxl/core/mbox.c:522 [inline]
>  cxl_send_cmd+0x9c0/0xb50 drivers/cxl/core/mbox.c:643
>  __cxl_memdev_ioctl drivers/cxl/core/memdev.c:698 [inline]
>  cxl_memdev_ioctl+0x14f/0x190 drivers/cxl/core/memdev.c:713
>  vfs_ioctl fs/ioctl.c:51 [inline]
>  __do_sys_ioctl fs/ioctl.c:597 [inline]
>  __se_sys_ioctl fs/ioctl.c:583 [inline]
>  __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583
>  do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>  do_syscall_64+0xa8/0x330 arch/x86/entry/syscall_64.c:94
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7fdaf331ba79
> Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007fdaf1d77038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 00007fdaf3585fa0 RCX: 00007fdaf331ba79
> RDX: 00002000000001c0 RSI: 00000000c030ce02 RDI: 0000000000000003
> RBP: 00007fdaf33749df R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
> R13: 00007fdaf3586038 R14: 00007fdaf3585fa0 R15: 00007ffced2af768
>  </TASK>
> 
> Add 'in_size' parameter to cxl_payload_from_user_allowed() and validate
> the payload is large enough.


Reviewed-by: Alison Schofield <alison.schofield@intel.com>


> 
> Fixes: 6179045ccc0c ("cxl/mbox: Block immediate mode in SET_PARTITION_INFO command")
> Fixes: 206f9fa9d555 ("cxl/mbox: Add Clear Log mailbox command")
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>


snip


  reply	other threads:[~2026-02-23 19:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20  0:16 [PATCH 0/2] cxl/mbox: fix undersized payload handling in cxl_payload_from_user_allowed() Davidlohr Bueso
2026-02-20  0:16 ` [PATCH 1/2] cxl/mbox: validate payload size before accessing contents " Davidlohr Bueso
2026-02-23 19:23   ` Alison Schofield [this message]
2026-02-23 22:39   ` Dave Jiang
2026-02-20  0:16 ` [PATCH 2/2] cxl/mbox: return appropriate error " Davidlohr Bueso
2026-02-20 22:14   ` Alison Schofield
2026-02-21 18:55     ` Davidlohr Bueso
2026-02-23 19:27   ` Alison Schofield
2026-02-23 22:40   ` Dave Jiang
2026-02-27 13:38   ` Jonathan Cameron
2026-02-20 17:23 ` [PATCH 0/2] cxl/mbox: fix undersized payload handling " Dave Jiang

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=aZypLDJLdhqfpTHn@aschofie-mobl2.lan \
    --to=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.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