-
Notifications
You must be signed in to change notification settings - Fork 206
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
Harden link state machine #2396
Conversation
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* ATTACHED. When a program is detached from a provider, the state transitions | ||
* to DETACHING. Once the provider is notified, the state transitions to IDLE. | ||
* Legal state transitions are: | ||
* 1. EBPF_LINK_STATE_INITIAL -> EBPF_LINK_STATE_ATTACHING - In ebpf_link_attach_program when the program is being |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to mention the specific (current) functions where this transition is made? Future code changes could make such comments incorrect and thus confusing. IMO, just the part of the comment describing the transition ought to be enough. Thoughts?
@@ -154,10 +164,23 @@ _ebpf_link_extension_changed_callback( | |||
|
|||
// Complete detach. | |||
if (provider_data == NULL) { | |||
// Check if the link is in the process of attaching. | |||
if (link->state == EBPF_LINK_STATE_DETACHING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above this line mentions 'attaching' but we're checking for detaching? (EBPF_LINK_STATE_DETACHING
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Comment is wrong.
Resolves: #2328
Description
Fix invalid state transitions in link state machine.
Testing
CI/CD + km stress.
Documentation
No.