From nobody Thu Nov 25 12:10:04 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 94306189BBBD for ; Thu, 25 Nov 2021 12:10:04 +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 4J0GsS26wkz3rGq for ; Thu, 25 Nov 2021 12:10:04 +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 297A71D1A8 for ; Thu, 25 Nov 2021 12:10:04 +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 1APCA4L8012714 for ; Thu, 25 Nov 2021 12:10:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1APCA452012713 for bugs@FreeBSD.org; Thu, 25 Nov 2021 12:10:04 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 260046] An NFS v4 client can crash the server with a LISTXATTRS RPC Date: Thu, 25 Nov 2021 12:10:04 +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=1637842204; 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=SS8Fzgbj8LYJ8YSytW+AxLGFVV8E/TtgJ69TD+SaV2Y=; b=WTDzt8uc60OCnLdXZS/53ect59M4d6zlkThwMfz16/9eydRtU5etZAVQYg1v8uNzj3x3SQ veNOY5rnTR2AUaq1/YwyCb2XakKhfOuDGxNID6aNjIX2Cv+4PK07McJAzcFsVG7o7/QoKf xU7OMnJeYH8YoCQeZPyfmQCvbHbwgFfcIOWQFJGysYS68j06Z61lBC2PKVOoj/p6lcUwBq rm4e+rniGkwDEERJPevC0m3nrfhYlaxVhXVG4XSwWgdOLz+N16SuLL5mhILL7KsnAE4tvj Gcxjvt4heq+87CiZFXZvpU/wGMBK8gKgCwqrmXnKPQWVIgHfLJBNKI7eGSrEEQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637842204; a=rsa-sha256; cv=none; b=L2X81Gkgay9lY7aZc6Ct41llx4uNVKncAHTWAXLRaUN+BtST6ZJyZ8rSW2JccSEHVwWT+U r95Fu4eJrDvVzHEp7ulciawGT7uvGyome76rKJVcaD2o5oZNaQkR7vD+P3BjNhCYw+vWR7 8EEOds73OHwiaS41tgQ5yBDt0QT6HjrZ+Pc/73f7g/nKeaVtDA7T/uEEBKNY2W45mSe5sI e815c//rjkQbk/D1YblQlHwM1tDYF2hJK4Ahj/rYGAhq92vvCu4MFWURCmRw+Py+blmOec PqgJXzF/5Cogh1m9W+UvhMZYIbbXcpZZjQ8McmyBg8RbVV4HCK5XZnA5UAB2Ww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260046 Bug ID: 260046 Summary: An NFS v4 client can crash the server with a LISTXATTRS RPC 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 #229724 text/plain mime type: Created attachment 229724 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D229724&action= =3Dedit Demo of an NFS client crashing a server with LISTXATTRS. nfsrvd_listxattr() calls nfsvno_listxattr(). The latter can return zero at the same time as leaving buf =3D=3D NULL. But if the return value is zero, nfsrvd_listxattr() dereferences the NULL buf, causing a crash. I've attached a demo: # uname -a FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #99 main-n250901-77e3db078984-di= rty: Wed Nov 24 05:42:01 EST 2021=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv # cc fnfsd_3.c # ./a.out ... panic: Fatal page fault at 0xffffffc00026f256: 0000000000000000 cpuid =3D 0 time =3D 1637841164 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 0 nfsrvd_listxattr() at nfsrvd_listxattr+0x306 nfsrvd_dorpc() at nfsrvd_dorpc+0x154c nfssvc_program() at nfssvc_program+0x5a4 svc_run_internal() at svc_run_internal+0x808 svc_run() at svc_run+0x1a8 nfsrvd_nfsd() at nfsrvd_nfsd+0x30e nfssvc_nfsd() at nfssvc_nfsd+0x386 sys_nfssvc() at sys_nfssvc+0xd0 do_trap_user() at do_trap_user+0x206 cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --- exception 8, tval =3D 0 --=20 You are receiving this mail because: You are the assignee for the bug.=