-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[tests][eventpipe] Port over Dotnet/Diagnostics to enable eventpipe tests on Android #64358
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
Merged
Merged
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
ce5f9c7
[tests][eventpipe] Port over Dotnet/Diagnostics files for mobile even…
mdh1418 0753824
[tests][eventpipe] Add TCP/IP logic for mobile eventpipe tests
mdh1418 4a6eeec
[tests] Remove Microsoft.Diagnostics.NETCore.Client package reference
mdh1418 9e3c2fe
[tests][eventpipe] Downstream Diagnostics IpcTraceTest DiagnosticsCli…
mdh1418 fb602ba
[tests][eventpipe] Downstream Diagnostics roslyn analyzer IpcTraceTes…
mdh1418 b1c6c46
[tests][eventpipe] Enable TCPIP DiagnosticsClient in IpcTraceTest for…
mdh1418 781af1d
[tests][eventpipe] Aesthetic IpcTraceTest modifications
mdh1418 572438c
[tests][eventpipe] Disable subprocesses tests on Android
mdh1418 2bfb0a5
[tests][eventpipe] Update processinfo
88ee4f9
[tests][eventpipe] Update processinfo2
4bf5a8f
[tests][eventpipe] Update eventsourceerror
mdh1418 2e860a4
[tests][eventpipe] Update bigevent
mdh1418 3babfc2
[tests][eventpipe] Update buffersize
mdh1418 07daa4b
[tests][eventpipe] Update rundownvalidation
mdh1418 fe7a901
[tests][eventpipe] Update providervalidation
mdh1418 b2a508d
[tests][eventpipe] Update gcdump
mdh1418 01ea71d
[tests][JIT] Update debuginfo/tester
mdh1418 dc29676
[tests] Segment Microsoft.Diagnostics.NETCore.Client relevant tests f…
mdh1418 27f6411
Account for nonspecified RuntimeFlavor
mdh1418 9b58954
[tests] Moveup Default coreclr RuntimeFlavor property explicit declar…
mdh1418 cb2cacd
[tests] Duplicate Microsoft.Diagnostics.NETCore.Client dependent test…
mdh1418 1e90d7e
Fix debuginfo/tester test skip
mdh1418 98cf133
Temporarily enable bigevent on Linux arm and remove duplicate exclude
mdh1418 fe317a3
Fix unaligned UTF16 string read in collect tracing EventPipe command.
lateralusX 8cdbf34
Revert "[tests] Duplicate Microsoft.Diagnostics.NETCore.Client depend…
mdh1418 7c62cd5
Revert "[tests] Segment Microsoft.Diagnostics.NETCore.Client relevant…
mdh1418 630d280
Revert "Fix debuginfo/tester test skip"
mdh1418 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
@lateralusX Is this mostly meant as a targeted fix? Feels odd we are only safekeeping this one case. I wonder if we can statically test for alignment on these reads or check dynamically if the platform supports it and perform copies when necessary. This also feels like a potential pain point for our portable builds (pretty much would for reads to always be aligned). The fix itself (copying) LGTM, just feels like we might be chasing bugs in this area for a bit.
Uh oh!
There was an error while loading. Please reload this page.
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.
First, fix was evaluating if it was the root cause of the ARM 32-bit issue seen on CoreCLR. Second I didn't want to switch to copy semantics in all cases, since it has been like that for a long time (inherited from C++ codebase) and its an optimization that can be used in most cases of current parsing logic (all except in the collect trace 2). Switching to copy semantics would also change the ownership rules of parsed UTF16 strings meaning we would need to do more adjustments in parsing logic artifacts that currently don't have ownership of the UTF16 strings. I added a runtime assert to make sure the version not doing a byte copy,
ds_ipc_message_try_parse_string_utf16_t
, will enforce that the passed in buffer is property aligned, in order to catch any future unaligned use. I also looked through all existing calls tods_ipc_message_try_parse_string_utf16_t
and they all currently parsed on aligned buffer address (except the fixed collect trace 2 parsing logic) The above function,ipc_message_try_parse_string_utf16_t_byte_array
is also made static, so only called from within that source. Doing a copy if necessary logic would even complicate the ownership rules of these strings more.Since the alignment is based on the parsing logic implemented in functions like
eventpipe_collect_tracing2_command_try_parse_payload
there is no static test, but as I said above, I added a runtime validation on debug builds, so as long as we have tests covering this (that we apparently didn't have until we updated the Diagnostic Client), we should hit assert on debug builds, if we add new payloads that could trigger the same issue in future.The actual SIGBUS happening in this case is also rather interesting since you could argue that it is a compiler optimization bug. ARM supports unaligned reads for word and halfword instructions, but not for double word. The code does two word size reads inside UTF, that would have worked if optimizer didn't bundle them in to a LDRD instruction that will need address to be aligned, so optimization moved from a program that would have worked to one that triggers a SIGBUS.
So to sum up, current fix take care of the scenario currently hit with unaligned UTF16 string in IPC message payload. I added an assert to prevent future incorrect use of UTF16 string parsing function using unaligned addresses. Alternative would be to abandon idea to reuse UTF16 string from payload and always take copy, totally doable, but will add more changes to all current *CommandPayload structs, since they will need to switch to owning copy of UTF16 string and make sure they are freed as part of their fini/free implementations.