[release/6.0] Fix unaligned UTF16 string read in collect tracing EventPipe command. #66828
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.
Collect tracing 2 EventPipe command triggers an unaligned UTF16 string read that could cause a SIGBUS on platforms not supporting unaligned reads of UTF16 strings.
On CoreCLR this could even cause a unaligned int read due to optimizations used in UTF8Encoding::GetByteCount.
Customer Impact
Trying to use dotnet-trace command towards a CoreCLR runtime running on 32-bit ARM will trigger SIGBUS and runtime crash making it impossible to trace an application using dotnet-trace diagnostic tooling.
#66772
Testing
Manual validation for .net6. This change is currently in the main branch and has a test running in CI/PR validation. All tests are passing in main. Enabling these same tests in the .net6 branch is possible, but will require larger code changes (~5k LOC from #64358).
Risk
Low