From nobody Mon Apr 11 13:55:25 2022 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 496171A9314C for ; Mon, 11 Apr 2022 13:55:26 +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 4KcVjn71ggz3F7q for ; Mon, 11 Apr 2022 13:55:25 +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 C3BF923CCD for ; Mon, 11 Apr 2022 13:55:25 +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 23BDtPjR060343 for ; Mon, 11 Apr 2022 13:55:25 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 23BDtPu3060342 for bugs@FreeBSD.org; Mon, 11 Apr 2022 13:55:25 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 263220] invalid fusefs error numbers can cause kernel crash Date: Mon, 11 Apr 2022 13:55:25 +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: Unspecified 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=1649685326; 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=5W7X+e5fQhZ9QqJiIrcGXwCmojoG/shqiPT2N10Zv5Q=; b=bhVG5SFF46wvJLVj/1KQzhIvvv7wSImohXbODqz5dvbE4TkgzJI8qCpuBJo6K9w4AStlsr TqY7NczEb6XBCvETEJ14fL/k+gEA001fN/LCgf61SirpYqg9k6ptwlk4ID7T0wIaT7wjoa QmNrEBjvV4y8amMNjeJP0/dzoNofBaVG4o/vcFiItytHiyntBD3+vRA3mimebMwkjnBU2K u7MMP2Hi8cuIQUVhnijJORwKdj8Jm+FlHV7R7q2GLR9iAPoVt4he0kOcmvr76j32KLo8Cs pWwjtqnRIJQM+ul1hzzqhVndzD92KE9Dp5dptHUka4fhkmEznda2aA4aTC2K0g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649685326; a=rsa-sha256; cv=none; b=kL3jZajT6eKZN7lSITTroGLgmD7K0ofp/PcjKHStxZywG+h3FtoloDi+WW+5s+XTlS21KN 7O16qmmRyzdh0OaAQ1KhI2pKax0Te+xxxvLLbqG8MzMzORlIwpOQop9JRfa7/epR37r6Ex zRzHr1o9/NbEI6jh6Z4EDyP3S8/qPqUqE/FJNi8IJLT7L0V0E8HDqkq3K8XOpNJvVnSTWq vuwtSLsYrA9vEzOLM1wxYx3vEEoHLsXKeoPAW4KU7ChlCKm+3UQ43gR4FgNNCdh2dAx+o2 82wew9AXlt8IWeFqPolVKz+W3P+Zh4B74C3lCH3orx1WSsyV3WDCcURETQ+UGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263220 Bug ID: 263220 Summary: invalid fusefs error numbers can cause kernel crash Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Attachment #233146 text/plain mime type: Created attachment 233146 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D233146&action= =3Dedit a fuse daemon that crashes the kernel by setting error=3D2 If a fuse daemon responds to a FUSE_LOOKUP with error set to 2, fuse_device_write() negates this to -2, which is EJUSTRETURN. As a result, vfs_lookup() will return 0 for success, but leave ni_vp NULL. kern_statat() assumes that a zero return from namei() implies that nd.ni_vp is valid, so it crashes in VOP_STAT(nd.ni_vp, ...). I've included a demo: # uname -a FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #187 main-n250915-a8123f770b1e-dirty: Mon Apr 11 07:07:40 EDT 2022=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv # pkg install fusefs-libs # cc -I/usr/local/include/fuse -o futo0 futo0.c -L/usr/local/lib -lfuse # ./futo0 ... running touch /mnt/z ... panic: Fatal page fault at 0xffffffc00039f47a: 0x00000000000010 cpuid =3D 1 time =3D 1649684546 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+0x16e panic() at panic+0x2a page_fault_handler() at page_fault_handler+0x1aa do_trap_supervisor() at do_trap_supervisor+0x76 cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x70 --- exception 13, tval =3D 0x10 VOP_STAT() at VOP_STAT+0x24 kern_statat() at kern_statat+0x10a sys_fstatat() at sys_fstatat+0x1e 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 --- exception 8, tval =3D 0 KDB: enter: panic [ thread pid 100 tid 100051 ] Stopped at breakpoint+0xa: c.ldsp s0,0(sp) db> --=20 You are receiving this mail because: You are the assignee for the bug.=