Bug 203822 - [panic] _mtx_lock_sleep: recursed on non-recursive mutex rtentry
Summary: [panic] _mtx_lock_sleep: recursed on non-recursive mutex rtentry
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Alexander V. Chernikov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-16 14:58 UTC by Allan Jude
Modified: 2018-03-17 22:09 UTC (History)
0 users

See Also:


Attachments
Image of panic/backtrace (52.89 KB, image/png)
2015-10-16 14:58 UTC, Allan Jude
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.