Support displaying more-complex syscall arguments#2648
Merged
stevenengler merged 4 commits intoshadow:mainfrom Jan 10, 2023
Merged
Support displaying more-complex syscall arguments#2648stevenengler merged 4 commits intoshadow:mainfrom
stevenengler merged 4 commits intoshadow:mainfrom
Conversation
Codecov ReportBase: 67.91% // Head: 68.02% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2648 +/- ##
==========================================
+ Coverage 67.91% 68.02% +0.11%
==========================================
Files 202 201 -1
Lines 29920 29880 -40
Branches 5832 5819 -13
==========================================
+ Hits 20320 20326 +6
+ Misses 4982 4924 -58
- Partials 4618 4630 +12
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
sporksmith
approved these changes
Jan 9, 2023
bbebc64 to
b798bff
Compare
b798bff to
4160c79
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.
In order to display syscall arguments in strace logging, we sometimes need to know the values of multiple syscall arguments. For example to display the byte buffer for
write(), we need to know bothconst void *bufandsize_t count. Shadow previously would just read bytes until a nul or a memory access error, but this wasn't correct since the buffer is often not nul-terminated.To print a byte buffer like the one in
write(), instead of using*const libc::c_charin thelog_syscall()macro, we now have two typesSyscallStringArgandSyscallBufferArg<const LEN_INDEX: usize>depending on whether the syscall takes a buffer (as inwrite()) or a nul-terminated string (as inopen()). The constant generic inSyscallBufferArgallows us to specify the index of thecountargument. This is a little weird, but allows us to continue using rust's type system for specifying how to display syscall arguments.In the future we can use the same method to display other types of syscall arguments, like socket addresses or socket/ioctl options.