Deadlocks when using pf tags or socket owner matching

Kajetan Staszkiewicz vegeta at tuxpowered.net
Wed Jul 8 10:52:49 UTC 2020


I have forgot to mention my system: it's FreeBSD 11.3-RELEASE-p9

I have also managed to replicate this (or a similar) issue on a test
system built with lock debugging and I got this:

Jul  8 10:32:07 hwlb-aw-01 kernel: lock order reversal:
Jul  8 10:32:07 hwlb-aw-01 kernel: 1st 0xffffffff81850760 pf rulesets
(pf rulesets) @
/usr/home/kajetan.staszkiewicz/freebsd.git/sys/netpfil/pf/pf.c:6006
Jul  8 10:32:07 hwlb-aw-01 kernel: 2nd 0xfffff8011f7028a8 tcpinp
(tcpinp) @
/usr/home/kajetan.staszkiewicz/freebsd.git/sys/netinet/in_pcb.c:1994
Jul  8 10:32:07 hwlb-aw-01 kernel: stack backtrace:
Jul  8 10:32:07 hwlb-aw-01 kernel: #0 0xffffffff806c2390 at
witness_debugger+0x70
Jul  8 10:32:07 hwlb-aw-01 kernel: #1 0xffffffff806c222a at
witness_checkorder+0xe3a
Jul  8 10:32:07 hwlb-aw-01 kernel: #2 0xffffffff8065a01b at
__rw_rlock_int+0x8b
Jul  8 10:32:07 hwlb-aw-01 kernel: #3 0xffffffff80790af2 at
in_pcblookup_hash+0x182
Jul  8 10:32:07 hwlb-aw-01 kernel: #4 0xffffffff81825546 at
pf_socket_lookup+0xd6
Jul  8 10:32:07 hwlb-aw-01 kernel: #5 0xffffffff8182af00 at
pf_test_rule+0x18c0
Jul  8 10:32:07 hwlb-aw-01 kernel: #6 0xffffffff81826e68 at pf_test+0x15e8
Jul  8 10:32:07 hwlb-aw-01 kernel: #7 0xffffffff81826b82 at pf_test+0x1302
Jul  8 10:32:07 hwlb-aw-01 kernel: #8 0xffffffff81837b7d at pf_check_in+0x1d
Jul  8 10:32:07 hwlb-aw-01 kernel: #9 0xffffffff80775107 at
pfil_run_hooks+0x97
Jul  8 10:32:07 hwlb-aw-01 kernel: #10 0xffffffff8079548e at ip_input+0x3fe
Jul  8 10:32:07 hwlb-aw-01 kernel: #11 0xffffffff80774020 at
netisr_dispatch_src+0x80
Jul  8 10:32:07 hwlb-aw-01 kernel: #12 0xffffffff807599af at
ether_demux+0x14f
Jul  8 10:32:07 hwlb-aw-01 kernel: #13 0xffffffff8075acfa at
ether_nh_input+0x34a
Jul  8 10:32:07 hwlb-aw-01 kernel: #14 0xffffffff80774020 at
netisr_dispatch_src+0x80
Jul  8 10:32:07 hwlb-aw-01 kernel: #15 0xffffffff80759e12 at
ether_input+0x62
Jul  8 10:32:07 hwlb-aw-01 kernel: #16 0xffffffff80762da3 at
vlan_input+0x2a3
Jul  8 10:32:07 hwlb-aw-01 kernel: #17 0xffffffff80759995 at
ether_demux+0x135

pf.c:6006 pf_test():
	pd.pf_mtag = pf_find_mtag(m);

	PF_RULES_RLOCK();

	if (ip_divert_ptr != NULL &&


in_pcb.c:1994 in_pcblookup_hash():

			} else {
				INP_RLOCK(inp);
				if (in_pcbrele_rlocked(inp))



-- 
| pozdrawiam / greetings | Powered by macOS, Debian and FreeBSD |
|  Kajetan Staszkiewicz  |  www: http://vegeta.tuxpowered.net   |
`------------------------^--------------------------------------'

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20200708/72512c85/attachment.sig>


More information about the freebsd-net mailing list