forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes overwrite of last captured managed stack frame address in Event…
…Pipe stack trace. (dotnet#72362) When collecting stack frames in EventPipe, buffer manager buffer layout depends on the struct layout of the compiler up until data gets serialized into blocks and put into output stream following nettrace format. In the past, there was a 1:1 map between the data collected for a stack trace and what was copied into buffer manager memory. Due to inefficiency, wasting a lot of memory when having small stack traces, this was optimized by dotnet#68134, greatly reducing overhead and improved EventPipe throughput. That change started to use a different struct when capturing the callstack compared to the layout written into buffer manager. Since buffer manager memory still relies on compiler struct layout, code must take that into account when copying stack data into buffer manager memory, but the new optimized implementation didn't, meaning that it fails in cases where compiler adds padding inside EventPipeStackContentsInstance (done on 64-bit bit systems). That in turn will write event payload, starting 4 bytes into last captured stack frame causing issues for tools to symbolicate address, but payload data will still be correct, since EventPipeEventInstance keeps pointer to payload data, meaning most of the event will still be correct, covering up the overwrite to only affect last managed stack frame and only on 64-bit release builds. Fix adjust the size calculation and make sure it takes any padding added by compiler into the computation of EventPipeEventInstance size.
- Loading branch information
1 parent
d5d9d52
commit 0c32267
Showing
3 changed files
with
23 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 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 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