From nobody Thu Jan 09 20:15:09 2025 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 4YTbcZ17rsz5jxHQ for ; Thu, 09 Jan 2025 20:15: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YTbcY6RmVz4prp for ; Thu, 9 Jan 2025 20:15:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736453709; 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=lro701XD5HW+rmpgBYtE364YyAQXlD5AjT9qI7Bokaw=; b=ol0NRZu99eFrCj864TX5lb2iBs/FEx9AL3auo5RnxzSrzu/VWDHgEkH1p8ZJchBaf6S7C9 CCIv9tW+eDhBRz3RniCm5x30r6y8qGUJxSiYxhq1CkT10zrkwXWzkmjopxF4ZjnFjhQEmJ WBl3L4LtIe25sndKBiBYbk59HGXVwSNiwYRqBhUQkyylUenDzQPu/4RZn7e/73scyCLxON K9F7FxZqfC7dkgUBiBqZustqY/m6UiJMOUIRD/L+bf2EJuZI8J9y0kNxC120o190YE8Vab Nuu8CxN9nZcZ2VKrm5fdOVDm8D7C1Z3C2QvcYY8RCn7HwLWYRel+amDeyOWrXQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736453709; a=rsa-sha256; cv=none; b=gndaGTqfZWgYkRhOhfpXIq98U2A1LU+iT08A6VcISjr4VLa8GhD8mm3U22ENQmACGCCsJP lZK/R9Xxd+RGN3SuFE9o0o9rzuTtL/vAcnl9M2SaT25/w0H3B6Fe7PITCoawekyli69H+X mTMoE06WIRqugMkGCyzEdWU8ocdAG67+cfMMWLPGPXy9FULYFmGI/5W16AF1N6p/GfUwL1 AK4cmJqa1+C4OChwRJbcEIGyhi2cHuPszUlY+AexjZ6QICMBXD8GdZ67grNtmIP849gWJa frXkLh1u0kPg2VJRVtzbJhMhjvw+7jMGzl5aEblmEwKTJiKuVV2qNA+/P9AjFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YTbcY5F2JzhYM for ; Thu, 09 Jan 2025 20:15:09 +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 509KF92m077773 for ; Thu, 9 Jan 2025 20:15:09 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 509KF9OM077772 for bugs@FreeBSD.org; Thu, 9 Jan 2025 20:15:09 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 283965] nfs: page fault during nfsrpc_readdir Date: Thu, 09 Jan 2025 20:15:09 +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: 15.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: asomers@FreeBSD.org 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 Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D283965 Bug ID: 283965 Summary: nfs: page fault during nfsrpc_readdir Product: Base System Version: 15.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: asomers@FreeBSD.org PROBLEM =3D=3D=3D=3D=3D=3D=3D nfs page faults in response to a bad readdir response by the underlying file system. First it prints to dmesg: Readdir reply file name had imbedded / or nul by Then it page panics: panic: page fault cpuid =3D 5 time =3D 1736452691 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00dc52c= 200 vpanic() at vpanic+0x136/frame 0xfffffe00dc52c330 panic() at panic+0x43/frame 0xfffffe00dc52c390 trap_pfault() at trap_pfault+0x466/frame 0xfffffe00dc52c400 calltrap() at calltrap+0x8/frame 0xfffffe00dc52c400 --- trap 0xc, rip =3D 0xffffffff80a19014, rsp =3D 0xfffffe00dc52c4d0, rbp = =3D 0xfffffe00dc52c7f0 --- nfsrpc_readdir() at nfsrpc_readdir+0xbd4/frame 0xfffffe00dc52c7f0 ncl_readdirrpc() at ncl_readdirrpc+0xf0/frame 0xfffffe00dc52c940 ncl_doio() at ncl_doio+0x4bb/frame 0xfffffe00dc52c9e0 ncl_bioread() at ncl_bioread+0x5f4/frame 0xfffffe00dc52cb70 nfs_readdir() at nfs_readdir+0x1d8/frame 0xfffffe00dc52cc80 vop_sigdefer() at vop_sigdefer+0x30/frame 0xfffffe00dc52ccb0 VOP_READDIR_APV() at VOP_READDIR_APV+0x32/frame 0xfffffe00dc52ccd0 kern_getdirentries() at kern_getdirentries+0x1d7/frame 0xfffffe00dc52cdd0 sys_getdirentries() at sys_getdirentries+0x29/frame 0xfffffe00dc52ce00 amd64_syscall() at amd64_syscall+0x158/frame 0xfffffe00dc52cf30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00dc52cf30 Examining the core file shows that the value of tl2 is 0x4 in nfs_clrpcops.c:3768, at this line: *tl2++ =3D cookiep->nfsuquad[0] =3D cookie.lval= [0] =3D ncookie.lval[0]; STEPS TO REPRODUCE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I have a fusefs test case in development that can reliably trigger this pan= ic in nfsd. The test creates a fuse file system and exports it over NFS, then performs a readdir on the NFS mount. ENVIRONMENT =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D FreeBSD 15.0-CURRENT amd64 based on f415b2ef30f7bf0db753f09fbba7b0910475b0d2 (Jan 6 2025), with one small change to fusefs and with rmacklem's WIP patch that adds vfs.nfsd.nfsd_disable_grace. ANALYSIS =3D=3D=3D=3D=3D=3D=3D=3D This looks like a straightforward uninitialized data access. tl2 is initialized to NULL. Then it's set to cp, but only if nfscl_invalidfname reports that the fname is valid. Then it gets dereferenced at line 3768 regardless of whether it was ever initialized. --=20 You are receiving this mail because: You are the assignee for the bug.=