Summary: | Deadlock on pf | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Tatiana <t.ermakova> | ||||
Component: | kern | Assignee: | Kristof Provost <kp> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | CC: | ae, dron.valyaev, kp | ||||
Priority: | --- | ||||||
Version: | CURRENT | ||||||
Hardware: | amd64 | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
Tatiana
2018-06-06 12:07:05 UTC
Thank you for an excellent bug report. I've managed to reproduce this, and at first glance your analysis seems to be correct. I'm working on this, and hope to have a fix soon. If you don't see updates from me in the next two weeks feel free to remind me. I have a patch on http://people.freebsd.org/~kp/patches/228782.patch which should fix your problem. I'm still writing the test cases for this so we include this case in our automated pf tests. (In reply to Kristof Provost from comment #2) Thanks! Also while applying the patch to our project I've noticed that you've probably missed changing a call to pf_test6 from pf_route6 Something like: - if (pf_test6(PF_FWD, ifp, &m0, NULL) != PF_PASS) + if (pf_test6(PF_FWD, ifp, &m0, inp) != PF_PASS) A commit references this bug: Author: kp Date: Sat Jun 9 14:17:07 UTC 2018 New revision: 334876 URL: https://svnweb.freebsd.org/changeset/base/334876 Log: pf: Fix deadlock with route-to If a locally generated packet is routed (with route-to/reply-to/dup-to) out of a different interface it's passed through the firewall again. This meant we lost the inp pointer and if we required the pointer (e.g. for user ID matching) we'd deadlock trying to acquire an inp lock we've already got. Pass the inp pointer along with pf_route()/pf_route6(). PR: 228782 MFC after: 1 week Changes: head/sys/netpfil/pf/pf.c (In reply to Tatiana from comment #3) Yes, you're right. That's okay in the committed patch. A commit references this bug: Author: kp Date: Sat Jun 16 09:32:05 UTC 2018 New revision: 335251 URL: https://svnweb.freebsd.org/changeset/base/335251 Log: MFC r334876: pf: Fix deadlock with route-to If a locally generated packet is routed (with route-to/reply-to/dup-to) out of a different interface it's passed through the firewall again. This meant we lost the inp pointer and if we required the pointer (e.g. for user ID matching) we'd deadlock trying to acquire an inp lock we've already got. Pass the inp pointer along with pf_route()/pf_route6(). PR: 228782 Changes: _U stable/11/ stable/11/sys/netpfil/pf/pf.c A commit references this bug: Author: kp Date: Sat Jun 16 11:42:27 UTC 2018 New revision: 335252 URL: https://svnweb.freebsd.org/changeset/base/335252 Log: MFC r334876: pf: Fix deadlock with route-to If a locally generated packet is routed (with route-to/reply-to/dup-to) out of a different interface it's passed through the firewall again. This meant we lost the inp pointer and if we required the pointer (e.g. for user ID matching) we'd deadlock trying to acquire an inp lock we've already got. Pass the inp pointer along with pf_route()/pf_route6(). PR: 228782 Changes: _U stable/10/ stable/10/sys/netpfil/pf/pf.c |