From nobody Wed Dec 08 11:02:10 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A213118D940C for ; Wed, 8 Dec 2021 11:02:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J8Dl62n3kz3FNV for ; Wed, 8 Dec 2021 11:02:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) 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 3FCFE12515 for ; Wed, 8 Dec 2021 11:02:10 +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 1B8B2ABq038007 for ; Wed, 8 Dec 2021 11:02:10 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1B8B2AQU038006 for bugs@FreeBSD.org; Wed, 8 Dec 2021 11:02:10 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 260272] short OPEN reply can crash NFS v4 client Date: Wed, 08 Dec 2021 11:02:10 +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-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638961330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JTI5y7v4FN0B/kBCOt7TfSxVsk62Yr6kdtoilfXvrL0=; b=PxlWHVkkmJ2H7sWTXW/qhYOky0Z5+Rz1OL0D/rfe6RIEt1kU0EtNbngKI/AwIij2pazZhW bvU3NCCh1bP4yx2LGHyZ+tgTxmFau0hIfyqDC50pk7pK5Y6usqQ6P5SAXUC14q5Cq1vRKz Rlo/GFnfPfF7TZhMlTpAj/g9EKrnAflplT+pSgElDMjc0e1VxyHiCGfLyvhZxO1ip06ckk XICPN8xVZNpzYDHoAqPYk5zo7KiOUdeIkaGTgdcatZsZxxT/6hMuj1xkJo172xE2ggM1m6 643hjGsN7IjWTv+IL6XWR4XN+PSJayNTfzLBARzfxmMER1wttuB9HbMBlyPFHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638961330; a=rsa-sha256; cv=none; b=jRYLsGGJm9Vmn43duzfoRtpipEydjPcBCf1Qcd1Yh98qSrr0UvH97vBz5x9kEInXUlV7IL h6E93a8vTdIOYz0oFhaGt5v0Kq5c5fXLL1f8gBIa/e2y7V+Zgx5bvypaRQFqegfULNZacW f221kzj2K/vHsWTKjQeDE/iRKyWqEv+fAg8ur00Eo6+dCawfhIk9CrqC90+beBSilwuNFk hDEjGlCcpEIS7+2GIHYdfiP6YpEfX36tJOfJlrvIexHIFs2CpKaVB9NTwr8smVExfo8gq3 fM07ZRt7VYNk868WLaL7nWm4bFvvqWcTHRUJyW5ATcNNY1O4o3ZlBKvWm652CQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260272 Bug ID: 260272 Summary: short OPEN reply can crash NFS v4 client 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 #229975 text/plain mime type: Created attachment 229975 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D229975&action= =3Dedit Cause an NFS v4 client to crash due to a short OPEN reply. In these lines in nfsrpc_createv4(): (void) nfsrv_getattrbits(nd, &attrbits, NULL, NULL); NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); If the RPC response being parsed is short, then nfsrv_getattrbits()'s calls to NFSM_DISSECT can leave nd->nd_md =3D=3D NULL, causing the NFSM_DISSECT to crash. I've attached a demo: # uname -a FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #133 main-n250909-08e6880c1a5c-dirty: Wed Dec 8 05:41:49 EST 2021=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv # cc fnfs_7.c # ./a.out ... panic: Fatal page fault at 0xffffffc0001818e2: 0x00000000000010 --- exception 13, tval =3D 0x10 nfsm_dissect() at nfsm_dissect+0xa nfsrpc_createv4() at nfsrpc_createv4+0x372 nfsrpc_create() at nfsrpc_create+0x1ae nfs_create() at nfs_create+0x196 vop_sigdefer() at vop_sigdefer+0x26 nfs_vnodeops_bypass() at nfs_vnodeops_bypass+0x16 VOP_CREATE_APV() at VOP_CREATE_APV+0x3a VOP_CREATE() at VOP_CREATE+0x2e vn_open_cred() at vn_open_cred+0x20a vn_open() at vn_open+0x32 kern_openat() at kern_openat+0x164 sys_openat() at sys_openat+0x32 syscallenter() at syscallenter+0xf4 ecall_handler() at ecall_handler+0x18 do_trap_user() at do_trap_user+0xea cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --=20 You are receiving this mail because: You are the assignee for the bug.=