From nobody Thu Dec 9 17:22:18 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 A656D18DCDB2 for ; Thu, 9 Dec 2021 17:22:18 +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 4J917G2dGRz3JHQ for ; Thu, 9 Dec 2021 17:22:18 +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 3B9D828B5 for ; Thu, 9 Dec 2021 17:22:18 +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 1B9HMI7u024437 for ; Thu, 9 Dec 2021 17:22:18 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1B9HMIsr024436 for bugs@FreeBSD.org; Thu, 9 Dec 2021 17:22:18 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 260293] big counts in LAYOUTRETURN can cause NFS v4 nfsrv_flexlayouterr() to page-fault Date: Thu, 09 Dec 2021 17:22:18 +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=1639070538; 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=vUdzkdDBXjSvs3pnLp5KJ1Aj6GLfOeVMGRBYbOdc9CU=; b=nZlQpF1lDJLXj/qMXUQ43LiMdXyOTdTwkB1wFbSmM/U34mcHJ+Mo3p3v0DYKDb32OFurG9 CQKjiMVCT4x+gjj8WyD1AoKLWs1Mwzg5H537AxXqM8cC6nMwewFHqoxRKDRZM+1kvIFeX4 bMr+ynw8ETmHK+XEE30dklislWbBGLecPXGKpMYRmCmYJoKM9e3pyozN2kpnJGnAKrNPlI LeJLTGt8PTC6weNRo5N0a1gEE4NfvMf2K7ZpAx0smtGJwFeqLN4V/V49eI6DTM1DnooER4 SfDFel3vvGwbKpHO5gyxLi1g58I4Qb3jpmYRm1vEXGwgQv0Q03rHR3F3EkKMmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639070538; a=rsa-sha256; cv=none; b=b4O6KAFM4OxRSvjAy2HZqqnXML1IZF5+Dv9NLZEiu+nFbo0NcgUiQU2n2fWMUB0sBV0vml bH958jcNxs/ERoMj4KEhFkhosVtVbV1EpYU2hpYlSwKkCIYAwbc8J4wZWk00ojNsohrsj3 MymaFQQ/OPu4gYFCJ+D5QkHQGivK8cRvWhLwznnzAY43CiwMKvJQyCL9qpzgWQxkQAQKKo nWkfaBxvfene5pwxWc4e6gia1jcNqyadN+vDZ+JoVBD1mCa/oNUo4HKR+g5Uw5fhbJfzx7 PiYFDMrUCTafWnXKCewT+W4XraFBW4WL5ZFSHG0n9CdEn8tQ/BcsRV3VL87Rhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260293 Bug ID: 260293 Summary: big counts in LAYOUTRETURN can cause NFS v4 nfsrv_flexlayouterr() to page-fault 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 #229996 text/plain mime type: Created attachment 229996 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D229996&action= =3Dedit Crash an NFS v4 server with a bad LAYOUTRETURN nfsrv_flexlayouterr() uses counts (cnt and errcnt) read from the client's RPC request without a sanity check, which can cause tl to run off the end of the allocated space and eventually cause a page fault. I've attached a demo: # uname -a FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #138 main-n250910-5ebdc4cea5b6-dirty: Thu Dec 9 12:07:05 EST 2021=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv # cc fnfsd_11.c # ./a.out ... panic: Fatal page fault at 0xffffffc0001b79d8: 0xffffffd080000005 --- exception 13, tval =3D 0xffffffd080000005 nfsrv_flexlayouterr() at nfsrv_flexlayouterr+0x132 nfsrv_layoutreturn() at nfsrv_layoutreturn+0x3a8 nfsrvd_layoutreturn() at nfsrvd_layoutreturn+0x328 nfsrvd_compound() at nfsrvd_compound+0xdc8 nfsrvd_dorpc() at nfsrvd_dorpc+0x294 nfs_proc() at nfs_proc+0x11a nfssvc_program() at nfssvc_program+0x426 svc_executereq() at svc_executereq+0xa2 svc_run_internal() at svc_run_internal+0x302 svc_run() at svc_run+0x146 nfsrvd_nfsd() at nfsrvd_nfsd+0x194 nfssvc_nfsd() at nfssvc_nfsd+0x300 sys_nfssvc() at sys_nfssvc+0xdc 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.=