Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[netebpfext] Add deleted filter contexts to zombie list for debugging purposes #4003

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

matthewige
Copy link
Collaborator

@matthewige matthewige commented Nov 12, 2024

Description

We are seeing failures in the cleanup logic, where netebpfext is unable to unload because of a reference to a WFP filter. To help debug this, a zombie list is added, where we should be able to see the list of filter objects that we have not received the WFP notify delete callback for when a dump is captured.

Testing

CICD

Documentation

n/a

Installation

n/a

@matthewige matthewige changed the title [draft] [netebpfext] Add deleted filter contexts to zombie list for debugging purposes Nov 12, 2024
@matthewige matthewige linked an issue Nov 12, 2024 that may be closed by this pull request
@matthewige matthewige marked this pull request as ready for review November 12, 2024 19:07
saxena-anurag
saxena-anurag previously approved these changes Nov 13, 2024
// Global objects used to store filter contexts that are being cleaned up. This is currently only used in debug
// contexts.
EX_SPIN_LOCK _net_ebpf_filter_zombie_list_lock = {0};
static bool _net_ebpf_filter_zombie_list_initialized = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we need this?

Copy link
Collaborator Author

@matthewige matthewige Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct me if I am wrong - my understanding is that each provider is serialized within calls to itself, but across providers, we have no serialization. Therefore, we could have two providers attaching/detaching at the same time, which could presumably cause issue here, right?

Regarding initialized - is it ever possible to hit the uninitialized codepath and then initialize again after? Now that I am thinking about it, I do not think this flag may be needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we would need the lock; my comment was only about the initialized flag.

shpalani
shpalani previously approved these changes Nov 13, 2024
netebpfext/net_ebpf_ext.c Outdated Show resolved Hide resolved
Comment on lines +158 to +159
net_ebpf_ext_remove_filter_context_from_zombie_list((filter_context)); \
ExFreePool((filter_context)); \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need the double parens in these lines.

Suggested change
net_ebpf_ext_remove_filter_context_from_zombie_list((filter_context)); \
ExFreePool((filter_context)); \
net_ebpf_ext_remove_filter_context_from_zombie_list(filter_context); \
ExFreePool(filter_context); \

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have generally followed the practice of using parentheses around the macro parameter to ensure that there are no accidental issues with any sort of operator precedence when the macro is expanded. I don't think it's strictly necessary in this case, but I prefer to keep it in.

This is also staying consistent with the original author's usage in this macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workflow failed - driver_native_only_ws2019
4 participants