Bug 203822

Summary: [panic] _mtx_lock_sleep: recursed on non-recursive mutex rtentry
Product: Base System Reporter: Allan Jude <allanjude>
Component: kernAssignee: Alexander V. Chernikov <melifaro>
Status: Closed FIXED    
Severity: Affects Some People    
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Image of panic/backtrace none

Description Allan Jude freebsd_committer freebsd_triage 2015-10-16 14:58:07 UTC
Created attachment 162121 [details]
Image of panic/backtrace

panic: _mtx_lock_sleep: recursed on non-recursive mutex rtentry @ /usr/src/sys/net/route.c:423
Comment 1 Allan Jude freebsd_committer freebsd_triage 2015-10-16 15:48:28 UTC
This appears to have been a mistake on my part

I assigned the IP address x.x.x.38/27

then tried to change the default gateway to x.x.x.1 which is outside the directly connected subnet. My subnet mask should have been /26

However, a panic is not the expected result
Comment 2 Allan Jude freebsd_committer freebsd_triage 2015-10-16 16:22:28 UTC
reproduction case:

ifconfig igb0 172.21.0.100/24
route add default 172.21.0.1

route change default 172.21.1.1

panic.
Comment 3 Alexander V. Chernikov freebsd_committer freebsd_triage 2015-10-18 14:04:20 UTC
So, what is happening here:

We lock existing rte (while handling RTM_CHANGE) and try to set new gateway.
If gateway is not directly reachable (e.g. likely if there was an error in user input), than rt_getifa_fib() logic which is responsible for setting valid rti_ifp / rti_ifa fails to find and local address/prefix matching the gateway. As a result, ifa_ifwithroute() is called and very likely it will find rte for the default route, tries to lock it and ..

The bug was introduced in r264986 - we unlocked rte / radix before attempting to guess gw.

Working on a fix..
Comment 4 Allan Jude freebsd_committer freebsd_triage 2016-07-16 17:59:20 UTC
Was a fix for this even developed and committed?
Comment 5 Alexander V. Chernikov freebsd_committer freebsd_triage 2018-03-17 22:08:40 UTC
Was fixed in r319895.