kern/60568: panic locking against myself (p->p_lock) in NFS from sysctl_vmproc

"Greg A. Woods via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
>Number:         60568
>Category:       kern
>Synopsis:       panic locking against myself (p->p_lock) in NFS from sysctl_vmproc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 10 00:50:00 +0000 2026
>Originator:     Greg A. Woods
>Release:        NetBSD 11.99.7
>Organization:
Planix, Inc.; Kelowna, BC; Canada
>Environment:
System: NetBSD nbday.local 11.99.7 NetBSD 11.99.7 (XEN3_DOMU) #0: Wed Aug  5 09:51:05 UTC 2026  [email protected]:/usr/src/sys/arch/xen/compile/XEN3_DOMU amd64
Architecture: x86_64
Machine: amd64
>Description:
	
[ 6123.1695877] Mutex error: mutex_vector_enter,551: locking against myself

[ 6123.1695877] lock address : ffff8c800d63e280
[ 6123.1695877] current cpu  :                  0
[ 6123.1695877] current lwp  : 0xffff8c800c922000
[ 6123.1695877] owner field  : 0xffff8c800c922000 wait/spin:                0/0

[ 6123.1695877] panic: lock error: Mutex: mutex_vector_enter,551: locking against myself: lock 0xffff8c800d63e280 cpu 0 lwp 0xffff8c800c922000
[ 6123.1695877] cpu0: Begin traceback...
[ 6123.1695877] vpanic() at netbsd:vpanic+0x164
[ 6123.1695877] panic() at netbsd:panic+0x3c
[ 6123.1695877] lockdebug_abort() at netbsd:lockdebug_abort+0x10f
[ 6123.1695877] mutex_vector_enter() at netbsd:mutex_vector_enter+0x2f5
[ 6123.1695877] sigpending1() at netbsd:sigpending1+0x24
[ 6123.1695877] nfs_rcvlock() at netbsd:nfs_rcvlock+0xed
[ 6123.1695877] nfs_request() at netbsd:nfs_request+0x48e
[ 6123.1817135] nfs_access() at netbsd:nfs_access+0x30b
[ 6123.1817135] VOP_ACCESS() at netbsd:VOP_ACCESS+0x55
[ 6123.1817135] getcwd_common() at netbsd:getcwd_common+0x2bd
[ 6123.1817135] vnode_to_path() at netbsd:vnode_to_path+0xbb
[ 6123.1817135] sysctl_vmproc() at netbsd:sysctl_vmproc+0x71c
[ 6123.1817135] sysctl_dispatch() at netbsd:sysctl_dispatch+0xb3
[ 6123.1817135] sys___sysctl() at netbsd:sys___sysctl+0xca
[ 6123.1817135] syscall() at netbsd:syscall+0x98
[ 6123.1817135] --- syscall (number 202) ---
[ 6123.1817135] netbsd:syscall+0x98:
[ 6123.1817135] cpu0: End traceback...
	
Michael van Elst noted the following:

	sysctl_vmproc
	-> fill_vmentries (takes p->p_lock)
	   -> fill_vmentry
	      -> vnode_to_path
	         -> getwd_common
	            -> VOP_ACCESS
	               ...   sigpending1 (wants p->p_lock)
	
	Calling into VFS layer while holding a process lock is not
	the best idea.

Note at this point the system went into a panic loop, repeatedly
reporting:

[ 6133.4867723] cpu1[1847 getty]: kernel lock spinout
[ 6133.4867957] cpu0[16442 yajl_test]: hogging kernel lock
[ 6133.4867957] ipi_msg_cpu_handler() at netbsd:ipi_msg_cpu_handler+0x59
[ 6133.4867957] ipi_cpu_handler() at netbsd:ipi_cpu_handler+0x84
[ 6133.4867957] xen_ipi_handler() at netbsd:xen_ipi_handler+0x7c
[ 6133.4867957] evtchn_do_event() at netbsd:evtchn_do_event+0x117
[ 6133.4867957] do_hypervisor_callback() at netbsd:do_hypervisor_callback+0x16b
[ 6133.4867957] Xhandle_hypervisor_callback() at netbsd:Xhandle_hypervisor_callback+0x1a
[ 6133.4867957] --- interrupt ---
[ 6133.4867957] mutex_vector_enter() at netbsd:mutex_vector_enter+0x192
[ 6133.4867957] suspendsched() at netbsd:suspendsched+0xe2
[ 6133.4867957] cpu_reboot() at netbsd:cpu_reboot+0x154
[ 6133.4867957] kern_reboot() at netbsd:kern_reboot+0x5f
[ 6133.4867957] vpanic() at netbsd:vpanic+0x16e
[ 6133.4867957] panic() at netbsd:panic+0x3c
[ 6133.4867957] lockdebug_abort() at netbsd:lockdebug_abort+0x10f
[ 6133.4867957] mutex_vector_enter() at netbsd:mutex_vector_enter+0x2f5
[ 6133.4867957] sigpending1() at netbsd:sigpending1+0x24
[ 6133.4867957] nfs_rcvlock() at netbsd:nfs_rcvlock+0xed
[ 6133.4867957] nfs_request() at netbsd:nfs_request+0x48e
[ 6133.4867957] nfs_access() at netbsd:nfs_access+0x30b
[ 6133.4867957] VOP_ACCESS() at netbsd:VOP_ACCESS+0x55
[ 6133.4867957] getcwd_common() at netbsd:getcwd_common+0x2bd
[ 6133.4867957] vnode_to_path() at netbsd:vnode_to_path+0xbb
[ 6133.4867957] sysctl_vmproc() at netbsd:sysctl_vmproc+0x71c
[ 6133.4867957] sysctl_dispatch() at netbsd:sysctl_dispatch+0xb3
[ 6133.4867957] sys___sysctl() at netbsd:sys___sysctl+0xca
[ 6133.4867957] syscall() at netbsd:syscall+0x98
[ 6133.4867957] --- syscall (number 202) ---
[ 6133.4867957] netbsd:syscall+0x98:


>How-To-Repeat:

	run a small make on an NFS-mounted partition?
	(it has happened twice in a row for me)

>Fix:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.