Summary: | [Panic] [VIMAGE] [pf] panic when creating/destroying multiple vnet jails | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Reshad Patuck <reshadpatuck1> | ||||||
Component: | kern | Assignee: | freebsd-net (Nobody) <net> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | andrei, bz, kp, zeon | ||||||
Priority: | --- | ||||||||
Version: | CURRENT | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
See Also: | https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223959 | ||||||||
Attachments: |
|
Description
Reshad Patuck
2017-05-13 07:50:13 UTC
Created attachment 182621 [details]
Test script to cause panic
This seems to be an issue with running pf both on the host and guest and reloading pf on the host multiple times.
I have attached a script which recreates this crash.
The script starts 10 vnet jails with pf in them and then stops the jails.
It reloads pf in the host system after starting or stoping each jail.
The crash does not occur at a fixed number of iterations, but does generally happen within 10 iterations.
You may have to run the test script more than once or increase the iterations if it does not crash.
When you do not reload pf on the host by comment out the pfctl -f line in reload_host_pf the test runs successfully.
This is tested up to 99 iterations, and the test ran successfully multiple times.
zfs snapshot zroot/jails/12jail@base is a freebsd 12 current jail created using bsdinstall.
A commit references this bug: Author: kp Date: Sun Jul 9 17:56:39 UTC 2017 New revision: 320848 URL: https://svnweb.freebsd.org/changeset/base/320848 Log: pf: Fix vnet purging pf_purge_thread() breaks up the work of iterating all states (in pf_purge_expired_states()) and tracks progress in the idx variable. If multiple vnets exist this results in pf_purge_thread() only calling pf_purge_expired_states() for part of the states (the first part of the first vnet, second part of the second vnet and so on). Combined with the mark-and-sweep approach to cleaning up old rules (in V_pf_unlinked_rules) that resulted in pf freeing rules that were still referenced by states. This in turn caused panics when pf_state_expires() encounters that state and attempts to access the rule. We need to track the progress per vnet, not globally, so idx is moved into a per-vnet V_pf_purge_idx. PR: 219251 Sponsored by: Hackathon Essen 2017 Changes: head/sys/netpfil/pf/pf.c (In reply to commit-hook from comment #2) Thanks, Will test this patch in a few days and will let you know if it is fixed. (In reply to commit-hook from comment #2) Hey have been running this patch and it looks like everything is working. Test methodology - Run test on unpatched system build r319808 panics system. - Update to r320850 and rerun test no panics. At this point the updated system has been up for a few hours since I ran the test. I will continue reloading pf and watch for panics. Thanks, Reshad *** Bug 225528 has been marked as a duplicate of this bug. *** *** Bug 223959 has been marked as a duplicate of this bug. *** |