Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Yifan Zhang <yfzhang23@stu.pku.edu.cn>, linux-nfs@vger.kernel.org
Cc: cel@kernel.org, neil@brown.name, okorniev@redhat.com,
	Dai.Ngo@oracle.com, 	tom@talpey.com
Subject: Re: [BUG] nfsd: OP_ILLEGAL indexes beyond spo_must_allow bitmap
Date: Wed, 28 Oct 2026 07:56:58 -0400	[thread overview]
Message-ID: <72c83650ea7139dfd38334fca840f2bc85b5b075.camel@kernel.org> (raw)
In-Reply-To: <179317461419.87500.1435945951937634987@stu.pku.edu.cn>

On Wed, 2026-10-28 at 16:03 +0800, Yifan Zhang wrote:
> Hello,
> 
> I found an out-of-bounds bitmap read in nfsd4_spo_must_allow() when an
> NFSv4.1 COMPOUND contains an invalid operation number. I reproduced it on two
> independent boots of an unmodified Linux v7.3 KASAN kernel. Both runs
> reported:
> 
>   BUG: KASAN: slab-out-of-bounds in nfsd4_spo_must_allow+0x2ec/0x4d0
>   Read of size 8 by task nfsd
>   nfsd4_spo_must_allow
>   check_security_flavor
>   check_nfsd_access
>   nfsd4_proc_compound
> 
> nfsd4_decode_compound() converts an out-of-range wire operation to
> OP_ILLEGAL (10044) and retains it in the decoded operation array.
> nfsd4_spo_must_allow() later scans that array and calls test_bit() with the
> operation number without a range check. On x86-64, the two-word
> spo_must_allow bitmap is indexed at word 156.
> 
> The attached C reproducer starts a loopback NFSv4.1 server, creates an
> ordinary fsid=0 export that allows AUTH_SYS, establishes a session with
> AUTH_NULL, and sends:
> 
>   COMPOUND [SEQUENCE, PUTROOTFH, GETFH, 0xffffffff]
> 
> It can be built with:
> 
>   cc -O2 repro.c -o repro
> 
> The trigger is deterministic and runs over loopback on the default syzkaller
> ext4 image.
> 
> CVE-2023-53680 fixed an OP_ILLEGAL index into OPDESC() in the decoder, and
> CVE-2025-38430 added the non-COMPOUND procedure check in
> nfsd4_spo_must_allow(). This report reaches a separate bitmap index from a
> valid NFSv4.1 COMPOUND.
> 
> A minimal fix is to skip operation numbers above LAST_NFS4_OP before calling
> test_bit(). A regression test can use a valid session followed by
> PUTROOTFH, GETFH, and an illegal final opcode.
> 
> Attached are the reproducer, KASAN report, and kernel config.
> 
> Regards,
> Yifan Zhang

I believe this is already fixed in Chuck's nfsd-testing branch in
commit 2ce8ab98091b.
-- 
Jeff Layton <jlayton@kernel.org>

      reply	other threads:[~2026-10-28 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28  8:03 [BUG] nfsd: OP_ILLEGAL indexes beyond spo_must_allow bitmap Yifan Zhang
2026-10-28 11:56 ` Jeff Layton [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=72c83650ea7139dfd38334fca840f2bc85b5b075.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=cel@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    --cc=yfzhang23@stu.pku.edu.cn \
    /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