Skip to content

Conversation

@sondavidb
Copy link
Contributor

@sondavidb sondavidb commented Feb 25, 2025

Issue #, if available:
Closes #627

Description of changes:
As LoadSnapshot requires only a subset of the default handlers, it was implemented by assigning the FcInit handlers to a smaller list of handlers. However, this meant that it would overwrite the FcInit handlers given by the jailer. This PR fixes this behavior by just removing the unnecessary handlers, instead of overwriting them entirely.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


func modifyHandlersForLoadSnapshot(l HandlerList) HandlerList {
for _, h := range loadSnapshotRemoveHandlerList {
l = l.Remove(h.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does Remove handle the case when h.Name is not present in the Handler list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LoadSnapshotHandler,
AddVsocksHandler,
)
var loadSnapshotRemoveHandlerList = []Handler{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add a comment here for future reference on why we need to have a filter list?

@sondavidb sondavidb force-pushed the fix-snapshot-handler-override branch from 0a2e6de to d0d94d9 Compare February 25, 2025 23:15
As LoadSnapshot requires only a subset of the default handlers, it was
implemented by assigning the FcInit handlers to a smaller list of
handlers. However, this meant that it would overwrite the FcInit
handlers given by the jailer. This PR fixes this behavior by just
removing the unnecessary handlers, instead of overwriting them entirely.

Signed-off-by: David Son <[email protected]>
@sondavidb sondavidb force-pushed the fix-snapshot-handler-override branch from d0d94d9 to f599c51 Compare February 25, 2025 23:15
@sondavidb sondavidb merged commit 3a6ac02 into firecracker-microvm:main Feb 26, 2025
4 checks passed
@sondavidb sondavidb deleted the fix-snapshot-handler-override branch February 26, 2025 17:34
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.

FcInit modified by Jailer overwriten when SnapshotLoad

3 participants