4MxRLZd6/wMiDR09pHV pzzXkf7PbC5Jcf92V5hOikLILNDmjY2ZwUCrdULeetB3lw8OVcY29OZCPrstn3ppUlyeuH ClFKdPZDRXNvzQyvtyUx9UEjaDkrLzCoXKle5+lqItI056lOorvoS2KsBzyA5YzSiVtSHN 2DHO+C+pryuItWrPLamg2xC2YZun5uf4xMXgZWtUITzWKhpWrABmvWu1I/0ym7i8s8DH55 K+d++bsGCtCS8PyEFafuc79FujIZ7T+y+UDaU0MqK9BWuLhTDdmSLMSns6dnZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763475785; a=rsa-sha256; cv=none; b=kZGijo5OFUOdI2ZC5+8aga35lViXYxj0JJJc1pADEZ7VDUytQDU8EYYjWMldWrXo4H1Rrf z+MJefiw4z2Io6KOob8R0sx+Gsm/vp0pm/AS+HAnHxNl91hDWhf3NlodfB27F48mbqa2GA 0bgNyv68OlzBoc+VFxNYZUFekBxxgioBT6BL1Rh4h7W6DGJ5KNNTfcvLD+g6IiHqE00hk1 6uiMkfnNpVJ9ufiTMISna6QvvY3DuEgmCczHfrue7iTvKxElnCOjBmvBCcXB/poIP5YiYm Yk7N7pKK3ekZKaKUd63PqroVh454jXF5LoOkM5AT7rh6A7n/ymKxUjjFImxmbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d9mzs3Hdmzy64 for ; Tue, 18 Nov 2025 14:23:05 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 5AIEN5n4085862 for ; Tue, 18 Nov 2025 14:23:05 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 5AIEN5Jp085861 for bugs@FreeBSD.org; Tue, 18 Nov 2025 14:23:05 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 291080] nfsrv_updatelock() can use uninitialized memory -> crash Date: Tue, 18 Nov 2025 14:23:05 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D291080 Bug ID: 291080 Summary: nfsrv_updatelock() can use uninitialized memory -> crash Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Attachment #265491 text/plain mime type: Created attachment 265491 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D265491&action= =3Dedit fake client that can cause a crash in nfsrv_updatelock() I've attached a demo fake nfs4 client that sends an OPEN rpc to the server asking for a write delegation, and then a LOCK rpc with the stateid from the write delegation (rather than for the open). As a result nfsrv_updatelock() tries to use lop =3D LIST_FIRST(&stp->ls_lock); ...; if (lop->lo_lfp =3D=3D lfp) { but the ls_lock list hasn't been initialized for nfsstate stp. # uname -a FreeBSD xxx 16.0-CURRENT FreeBSD 16.0-CURRENT #31 main-n275523-f77ac3afe3e3: Sun Oct 12 16:13:10 AST 2025 root@xxx:/usr/obj/usr/src/amd64.amd64/sys/ # cat /etc/exports V4: / 127.0.0.1 /mnt 127.0.0.1 # cc nfsd535a.c # chmod ogu+rwx /mnt # ./a.out ... Fatal trap 9: general protection fault while in kernel mode rdi: deadc0dedeadc0de rsi: fffffe00d708ad28 rdx: fffffe00d708ac10 panic() at panic+0x43/frame 0xfffffe00d708aa80 trap_fatal() at trap_fatal+0x68/frame 0xfffffe00d708aaa0 calltrap() at calltrap+0x8/frame 0xfffffe00d708aaa0 --- trap 0x9, rip =3D 0xffffffff80a78ad4, rsp =3D 0xfffffe00d708ab70, rbp = =3D 0xfffffe00d708abc0 --- nfsrv_updatelock() at nfsrv_updatelock+0x74/frame 0xfffffe00d708abc0 nfsrv_lockctrl() at nfsrv_lockctrl+0x125f/frame 0xfffffe00d708ace0 nfsrvd_lock() at nfsrvd_lock+0x656/frame 0xfffffe00d708b1c0 nfsrvd_dorpc() at nfsrvd_dorpc+0x1672/frame 0xfffffe00d708b3d0 nfssvc_program() at nfssvc_program+0x808/frame 0xfffffe00d708b5d0 svc_run_internal() at svc_run_internal+0xaa8/frame 0xfffffe00d708b700 svc_run() at svc_run+0x280/frame 0xfffffe00d708b760 nfsrvd_nfsd() at nfsrvd_nfsd+0x3d3/frame 0xfffffe00d708b8c0 nfssvc_nfsd() at nfssvc_nfsd+0x535/frame 0xfffffe00d708bde0 sys_nfssvc() at sys_nfssvc+0xcc/frame 0xfffffe00d708be00 amd64_syscall() at amd64_syscall+0x169/frame 0xfffffe00d708bf30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00d708bf30 #0 nfsrv_updatelock (stp=3D0xffffffd001071500, new_lopp=3D0xffffffc082ada9= 98,=20 other_lopp=3D0xffffffc082ada880, lfp=3D0xffffffd001b92e80) at /usr/rtm/symbsd/src/sys/fs/nfsserver/nfs_nfsdstate.c:3907 #1 0xffffffc00039c4ac in nfsrv_lockctrl (vp=3D,=20 new_stpp=3D0xffffffc082ada9a0, new_lopp=3D0xffffffc082ada998,=20 cfp=3D0xffffffc082ada9a8, clientid=3D..., stateidp=3D0xffffffc082ada988= ,=20 exp=3D, nd=3D, p=3D0xffffffc082874140) at /usr/rtm/symbsd/src/sys/fs/nfsserver/nfs_nfsdstate.c:2480 #2 0xffffffc0003af518 in nfsrvd_lock (nd=3D0xffffffc082adb0c0,=20 isdgram=3D, vp=3D0xffffffd012346370, exp=3D0xffffffc082a= daf78) at /usr/rtm/symbsd/src/sys/fs/nfsserver/nfs_nfsdserv.c:2630 (gdb) print lop $2 =3D (struct nfslock *) 0xdeadc0dedeadc0de (gdb) print/x stp->ls_flags=20 $3 =3D 0x100003 --=20 You are receiving this mail because: You are the assignee for the bug.=