[Bug 260266] NFS callback RPC with negative taglen can crash client

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 07 Dec 2021 18:52:37 UTC

            Bug ID: 260266
           Summary: NFS callback RPC with negative taglen can crash client
           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 #229961 text/plain
         mime type:

Created attachment 229961
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=229961&action=edit
Crash an NFS client with a callback with a bad taglen.

nfscl_docb() has a few "goto nfsmout" before it initializes retopsp,
but the code after nfsmout dereferences retopsp if taglen != -1.

I've attached a demo:

# uname -a
FreeBSD  14.0-CURRENT FreeBSD 14.0-CURRENT #130
main-n250909-08e6880c1a5c-dirty: Tue Dec  7 13:30:08 EST 2021    
rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM  riscv
# cc fnfs_6.c
# ./a.out
panic: Fatal page fault at 0xffffffc00021c200: 0000000000000000
--- exception 15, tval = 0
nfscl_docb() at nfscl_docb+0x1ac
nfscb_program() at nfscb_program+0xee
svc_run_internal() at svc_run_internal+0x810
svc_run() at svc_run+0x1a2
nfscbd_nfsd() at nfscbd_nfsd+0xce
nfssvc_nfscl() at nfssvc_nfscl+0x204
sys_nfssvc() at sys_nfssvc+0xd0
do_trap_user() at do_trap_user+0x220
cpu_exception_handler_user() at cpu_exception_handler_user+0x72

You are receiving this mail because:
You are the assignee for the bug.