Draft
Conversation
0318093 to
7d66849
Compare
Since paths can be in non UTF-8 formats, we should strive to use types that are able to handle this situation when possible. In the case of the exe_path and filename fields that come from the kernel, handling has been changed to treat them as binary blobs (same way the kernel d_path function does) and the length is now being sent to userspace. With this change, userspace is able to reconstruct a path in a fully safe way from the path buffer, treating it as a slice and using the first len - 1 (exclude the null terminator) bytes. This way we are able to preserve the path all the way to the gRPC event, which requires UTF-8 compliant strings. In a future change we might want to change path handling in our protobuffs to use byte blobs instead, but this will probably also require an effort from front end to properly display the data.
7d66849 to
535fd8c
Compare
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
Since paths can be in non UTF-8 formats, we should strive to use types that are able to handle this situation when possible. In the case of the exe_path and filename fields that come from the kernel, handling has been changed to treat them as binary blobs (same way the kernel d_path function does) and the length is now being sent to userspace.
With this change, userspace is able to reconstruct a path in a fully safe way from the path buffer, treating it as a slice and using the first len - 1 (exclude the null terminator) bytes. This way we are able to preserve the path all the way to the gRPC event, which requires UTF-8 compliant strings. In a future change we might want to change path handling in our protobuffs to use byte blobs instead, but this will probably also require an effort from front end to properly display the data.
Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
CI should be enough.