Improve WFP filter-delete mock fidelity and add delete fault injection - #317
Open
mikeagun wants to merge 1 commit into
Open
Improve WFP filter-delete mock fidelity and add delete fault injection#317mikeagun wants to merge 1 commit into
mikeagun wants to merge 1 commit into
Conversation
The FWP user-mode mock diverged from real WFP filter-delete behavior: - The delete notification (FWPS_CALLOUT_NOTIFY_DELETE_FILTER) was raised with filterId = 0, so a callout that identifies the deleted filter by id could not match it. - remove_fwpm_filter asserted the callout was still registered and always raised the delete notification, whereas real WFP raises no delete notification once the callout function has been unregistered. Changes: - Set fwps_filter.filterId on the add and delete notifications. - Raise the delete notification only when the callout is still registered. - Add test-only fault injection (usersim_fwp_set_filter_delete_failure_count) plus usersim_fwp_get_fwpm_filter_count and usersim_fwp_clear_fwpm_filters to simulate and inspect a filter whose delete fails without removing the filter or notifying. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c5be9327-3fe0-4580-b5c1-17b6c052bbb2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The FWP user-mode mock diverged from real WFP filter-delete behavior in two ways that matter to callouts which track per-filter state:
FWPS_CALLOUT_NOTIFY_DELETE_FILTER) was raised withfilterId = 0, so a callout that identifies the deleted filter by id could not match it.remove_fwpm_filterasserted the callout was still registered and always raised the delete notification, whereas real WFP raises no delete notification once the callout function has been unregistered (e.g., during driver unload).This change makes the mock faithful and adds a small test-only fault-injection surface so extensions can exercise their filter-delete-failure recovery paths.
Changes
fwps_filter.filterIdon the add and delete notifications.usersim_fwp_set_filter_delete_failure_count(fail the next NFwpmFilterDeleteByIdcalls without removing the filter or notifying),usersim_fwp_get_fwpm_filter_count, andusersim_fwp_clear_fwpm_filters.Testing
Consumed by the ebpf-for-windows netebpfext WFP filter-teardown regression tests. Existing usersim tests unaffected.