Bug 228458 - [jail] panic: _mtx_lock_sleep: recursed on non-recursive mutex unp @ /usr/src/sys/kern/uipc_usrreq.c:354
Summary: [jail] panic: _mtx_lock_sleep: recursed on non-recursive mutex unp @ /usr/src...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Matt Macy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-24 13:06 UTC by Marie Helene Kvello-Aune
Modified: 2019-09-14 18:10 UTC (History)
3 users (show)

See Also:


Attachments
Screenshot of kernel panic (226.27 KB, image/jpeg)
2018-05-24 13:06 UTC, Marie Helene Kvello-Aune
no flags Details
jail_smb4.conf (1.56 KB, text/plain)
2018-05-24 13:38 UTC, Marie Helene Kvello-Aune
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marie Helene Kvello-Aune 2018-05-24 13:06:00 UTC
Created attachment 193649 [details]
Screenshot of kernel panic

This panic always occurs when starting jails, regardless of whether it's during boot or some time after (i.e. jail_enabled=NO, service jail onestart)

There is also a lock order reversal between "allprison" and "vnet_sysinit_sxlock" (see screenshot)

=== Infodump ===

# uname -a
FreeBSD venus 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r334115: Thu May 24 00:08:59 CEST 2018     root@venus:/usr/obj/usr/src/amd64.amd64/sys/Venus  amd64

# cat /usr/src/sys/amd64/conf/Venus
include GENERIC
ident Venus

options VIMAGE

device epair

# cat /etc/jail.conf
exec.start              = "/bin/sh /etc/rc";
exec.stop               = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
mount.fstab             = "/etc/fstab.$name";
path                    = "/usr/jails/$name";
host.hostname           = "$name.mhka.no";

devsamba {
  vnet;
  vnet.interface            = "epair0b";
}
Comment 1 Marie Helene Kvello-Aune 2018-05-24 13:37:45 UTC
Additional info:
When disabling samba in the jails /etc/rc.conf, there is no kernel panic. Enable it again, and there is.

The jail runs samba44-4.4.15

Excrept from /etc/rc.conf:
# Samba
samba_server_enable="YES"
samba_enable="YES"
nmbd_enable="NO"

Attaching the configuration file /usr/local/etc/smb4.conf (inside the jail).
Comment 2 Marie Helene Kvello-Aune 2018-05-24 13:38:34 UTC
Created attachment 193650 [details]
jail_smb4.conf
Comment 3 Bjoern A. Zeeb freebsd_committer freebsd_triage 2018-05-24 17:22:16 UTC
Most likely due to latest changes from mmacy.  Please have a look.
Comment 4 Matthew Macy 2018-05-24 19:06:14 UTC
I've been working with her. I've made some progress in resolving the issue.
Comment 5 Marie Helene Kvello-Aune 2018-05-24 20:26:07 UTC
Fixed in base r312307.
Please mark as resolved.
Comment 6 Marie Helene Kvello-Aune 2018-05-24 20:27:38 UTC
Please disregard previous comment; Was intended for another PR.
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-05-24 21:14:29 UTC
A commit references this bug:

Author: mmacy
Date: Thu May 24 21:13:46 UTC 2018
New revision: 334185
URL: https://svnweb.freebsd.org/changeset/base/334185

Log:
  AF_UNIX: It is possible for UNIX datagram sockets to be connected
  to themselves. The updated code assumed that that could not happen
  and would try to lock the unp mutex twice.

  There may be a lingering issue here but this fixes it for the
  reporter.

  PR:	228458
  Reported by:	marieheleneka at gmail.com

Changes:
  head/sys/kern/uipc_usrreq.c