-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Aggregate adjacent memory sizes regardless of r+x #45401
Aggregate adjacent memory sizes regardless of r+x #45401
Conversation
Tagging subscribers to this area: @eiriktsarpalis, @jeffhandley Issue DetailsWhen adjacent memory ranges of same module differ by permission, the
|
cc @stephentoub Tested with dotnet console template. e.g. before:
after (extracted the built tarball from artifacts/packages/Shipping directory and copied runtime/.dotnet/sdk over):
|
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFilterTest.cs
Outdated
Show resolved
Hide resolved
Would it be possible to write a test that verifies the new behaviour? Presumably there would no longer be any duplicates in the process modules for the current process? |
Currently we have a test validating that these properties do not throw: runtime/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs Lines 624 to 627 in 4a743ac
Also there is a test which asserts that getting modules multiple times subsequently result in the same modules. Is there anything else we could validate? |
What issue is the PR meant to be addressing? Presumably adjacent regions with different permission sets would be reported as separate modules? Looking at the
Would this be reported differently after your changes? Or am I misunderstanding something? |
It was based on this discussion type thread: #45180.
From the example, this PR would only affect the value of Before: After: Before we were stopping at the row without r and x permission. PR continues to sum all consecutive nodes of the same module (unless end address of previous and start address of current mismatch). |
Ok, so the issue concerned reporting incorrect sizes? Thanks for clarifying. |
Installer failure |
@am11 is there any chance that you could split the PR into two commits: the actual fix and the refactoring? It would make reviewing much easier for us. Thank you! |
@adamsitnik has suggested we create a unit test that validates the new parsing logic using a fixed |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
When adjacent memory ranges of same module differ by permission, the line should not be skipped due to the lack of readability/executability flags.
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
…at.ParseMapModules.cs Co-authored-by: Tom Deseyn <[email protected]>
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
…at.ParseMapModules.cs
iOS simulator launch failure is #45181. |
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
Thanks @am11 for fixing these issues! |
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
…at.ParseMapModules.cs
…at.ParseMapModules.cs
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
Outdated
Show resolved
Hide resolved
Nit: I'm finding the parsing method hard to follow, mainly because it is cobbling together line parsing concerns with process module parsing concerns. I took the liberty of refactoring your code in a branch of my own, kindly consider including something like that. |
@eiriktsarpalis, thanks a lot. Based on:
from https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/exceptions-and-performance#try-parse-pattern, I have also found non- |
Agreed. It's internal as well so won't die on that hill :-) |
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.
Thanks!
When adjacent memory ranges of same module differ by permission, the
line should not be skipped due to the lack of readability/executability
flags.