public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: YunJe Shin <yjshin0438@gmail.com>
Cc: hare@suse.de, hch@lst.de, ioerts@kookmin.ac.kr,
	kbusch@kernel.org,  kch@nvidia.com, linux-kernel@vger.kernel.org,
	linux-nvme@lists.infradead.org,  sagi@grimberg.me,
	stable@kernel.org
Subject: Re: [PATCH v2] nvmet: auth: validate dhchap id list lengths
Date: Fri, 13 Mar 2026 08:30:14 -0700	[thread overview]
Message-ID: <20260313-much-handbrake-cb4c6e4f1318@redhat.com> (raw)
In-Reply-To: <20260313052444.3865842-1-ioerts@kookmin.ac.kr>

On Fri, Mar 13, 2026 at 02:24:09PM +0900, YunJe Shin wrote:
> From: Yunje Shin <ioerts@kookmin.ac.kr>
> 
> The function nvmet_auth_negotiate() parses the idlist array in the
> struct nvmf_auth_dhchap_protocol_descriptor payload. This array is 60
> bytes and is logically divided into two 30-byte halves: the first half
> for HMAC IDs and the second half for DH group IDs. The current code
> uses a hardcoded +30 offset for the DH list, but does not validate
> halen and dhlen against the per-half bounds. As a result, if a
> malicious host sends halen or dhlen larger than 30, the loop can
> read past the 60-byte array into adjacent slab memory, triggering a
> KASAN slab-out-of-bounds read.
> 
> KASAN splat:
> [    4.241646] BUG: KASAN: slab-out-of-bounds in nvmet_execute_auth_send+0x19b8/0x2090
> [    4.242874] Read of size 1 at addr ffff8881045754e8 by task kworker/1:1H/41
> [    4.265342] The buggy address belongs to the cache kmalloc-96 of size 96
> [    4.266291]  allocated 72-byte region [ffff8881045754a0, ffff8881045754e8)
> [    4.270337] page dumped because: kasan: bad access detected
> 
> This patch fixes the issue by introducing NVME_AUTH_DHCHAP_MAX_HASH_IDS
> and NVME_AUTH_DHCHAP_MAX_DH_IDS defined as 30, which explicitly indicates
> the maximum boundaries allowed per NVMe specification. The lengths halen
> and dhlen are validated against these boundaries before processing,
> preventing the out-of-bounds reads.
> 
> Fixes: db1312dd95488 ("nvmet: implement basic In-Band Authentication")
> Cc: stable@kernel.org
> Signed-off-by: Yunje Shin <ioerts@kookmin.ac.kr>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
> v2:
>     - Replaced the runtime 'sizeof' calculation (idlist_half) with explicit 
>       NVME_AUTH_DHCHAP_MAX_HASH_IDS and NVME_AUTH_DHCHAP_MAX_DH_IDS macros
>       to clearly reflect the 30:30 split limit per Chris Leech's feedback.

Reviewed-by: Chris Leech <cleech@redhat.com>



  reply	other threads:[~2026-03-13 15:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11  6:58 [PATCH] nvmet: auth: validate dhchap id list lengths(KASAN: slab-out-of-bounds) YunJe Shin
2026-02-12  1:49 ` yunje shin
2026-02-18  4:04   ` yunje shin
2026-03-08 15:09     ` yunje shin
2026-03-09 18:04       ` Chris Leech
2026-03-10 17:48         ` yunje shin
2026-03-10 17:52           ` yunje shin
2026-03-10 18:07             ` Chris Leech
2026-03-10 19:06               ` yunje shin
2026-03-10 20:34                 ` Chris Leech
2026-03-12  7:01                 ` Hannes Reinecke
2026-03-13  5:24                   ` [PATCH v2] nvmet: auth: validate dhchap id list lengths YunJe Shin
2026-03-13 15:30                     ` Chris Leech [this message]
2026-03-17 14:51                     ` Christoph Hellwig
2026-03-17 16:55                       ` yunje shin
2026-03-20  7:49                         ` Christoph Hellwig
2026-03-20  8:13                           ` yunje shin

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=20260313-much-handbrake-cb4c6e4f1318@redhat.com \
    --to=cleech@redhat.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=ioerts@kookmin.ac.kr \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=stable@kernel.org \
    --cc=yjshin0438@gmail.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