From nobody Tue Nov 23 16:48:26 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 3AEBB18968A8 for ; Tue, 23 Nov 2021 16:48:27 +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 4Hz97Z67HSz3rYG for ; Tue, 23 Nov 2021 16:48:26 +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 AEC5719DD2 for ; Tue, 23 Nov 2021 16:48:26 +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 1ANGmQwm097042 for ; Tue, 23 Nov 2021 16:48:26 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1ANGmQlZ097041 for bugs@FreeBSD.org; Tue, 23 Nov 2021 16:48:26 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 259996] bad CREATE_SESSION NFS v4.1 reply can cause client kernel page fault Date: Tue, 23 Nov 2021 16:48:26 +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=1637686106; 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=jct0yGewCXYN/wQC2wpzpm7vEL6hBQIDtnoxV6L+PD0=; b=hUpyLYY62bQ4ouByodOditZU6CM/1WfgR0T+cGT4Q173t42c/2sVIQ5BabqCvE7efB6NCB 4S1cw/JCWNo9X0m/x4ECnBhZB6+Qdfufe1g7SDVl8JJn9h8JIbZkkrEpIACSQwymfrCux1 uD+3lpfl44w7FQX6nW6viD/uhytmsUOlZ/L4qeWPAK5b4pUN/hpTinqF7m7t+51iVoln55 ktKlZA9OqeBvslxCPlQkwFcNMx4QnWyQN5efPgNa+c3kjH7zz3Dxw/x4kl7jTJGGYlxBp0 T1VcdVwYX3uPRpin092tLG453UQ7e4TQ8kPz6BlHKR2xMOHNxcQi0OUKxk2GsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637686106; a=rsa-sha256; cv=none; b=C/UWQSvYLbYVU+E/3A3Lz2hlVOWEtqHc9J12mazEZ7iCJ4Km5g4OIn/cADDkHBzT9Wy4pe XHkq7/CdAE1CDtKKkgGM2LB6Nazmj8y+cSZZWUaQ1wHubC/c6qYdKGHx9jFLxmfHvs2zEU MNy4C1uzUBPp+zgKasxcT4BykzXYQopI+aXvHkM9JBes9C3qceVWWxsHYO/OKhiMHE4IoJ ttLDR3+kDGLwiUWZO8gmXp92Ywt8D73RHLhdAg+cNZZnww2n1pqtQgi8CAKyvWhfdTxlT+ lmHPUZvMn2dC3gURPU4JjR6PLJjMGeNeNXQQdMopkMWbG/OqOdnV1VUVqMyIHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259996 Bug ID: 259996 Summary: bad CREATE_SESSION NFS v4.1 reply can cause client kernel 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 #229673 text/plain mime type: Created attachment 229673 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D229673&action= =3Dedit Demo that crashes an NFS client. These lines in nfsrpc_createsession() irdcnt =3D fxdr_unsigned(int, *tl); if (irdcnt > 0) NFSM_DISSECT(tl, uint32_t *, irdcnt * NFSX_UNSIGNED= ); will accept the server's irdcount if it's huge and positive, but can then pass a negative size due to overflow in the multiply. This can cause nfsm_dissect() to subtract a big number from nd->nd_dpos, which causes a wild pointer reference next time nd->nd_dpos is used. I've attached a demo: # uname -a FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #91 main-n250901-77e3db078984-di= rty: Tue Nov 23 10:48:40 EST 2021=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv # cc fnfs_1.c # ./a.out ... panic: Fatal page fault at 0xffffffc000227d16: 0xffffffcf82b289c8 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x38 kdb_backtrace() at kdb_backtrace+0x2c vpanic() at vpanic+0x154 panic() at panic+0x2a page_fault_handler() at page_fault_handler+0x1ee do_trap_supervisor() at do_trap_supervisor+0x76 cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x70 --- exception 13, tval =3D 0xffffffcf82b289c8 nfsrpc_createsession() at nfsrpc_createsession+0x730 nfsrpc_setclient() at nfsrpc_setclient+0x240 nfscl_getcl() at nfscl_getcl+0x53e mountnfs() at mountnfs+0x722 nfs_mount() at nfs_mount+0x161e vfs_mount_sigdefer() at vfs_mount_sigdefer+0x20 vfs_domount_first() at vfs_domount_first+0x1d4 vfs_domount() at vfs_domount+0x21c vfs_donmount() at vfs_donmount+0x79c sys_nmount() at sys_nmount+0x66 do_trap_user() at do_trap_user+0x206 cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --=20 You are receiving this mail because: You are the assignee for the bug.=