Add hooks to debug OpenSSL memory allocations#111539
Merged
rzikm merged 47 commits intodotnet:mainfrom Feb 11, 2025
Merged
Conversation
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
Contributor
There was a problem hiding this comment.
Copilot reviewed 2 out of 8 changed files in this pull request and generated 1 comment.
Files not reviewed (6)
- src/native/libs/System.Security.Cryptography.Native/apibridge_30.h: Language not supported
- src/native/libs/System.Security.Cryptography.Native/entrypoints.c: Language not supported
- src/native/libs/System.Security.Cryptography.Native/openssl.c: Language not supported
- src/native/libs/System.Security.Cryptography.Native/openssl.h: Language not supported
- src/native/libs/System.Security.Cryptography.Native/opensslshim.h: Language not supported
- src/native/libs/System.Security.Cryptography.Native/pal_ssl.c: Language not supported
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
Jan 17, 2025
krwq
reviewed
Jan 20, 2025
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs
Show resolved
Hide resolved
jkotas
reviewed
Jan 31, 2025
src/native/libs/System.Security.Cryptography.Native/memory_debug.c
Outdated
Show resolved
Hide resolved
bartonjs
reviewed
Feb 3, 2025
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/README.md
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
This was referenced Feb 4, 2025
Contributor
There was a problem hiding this comment.
Copilot reviewed 2 out of 10 changed files in this pull request and generated no comments.
Files not reviewed (8)
- src/libraries/System.Security.Cryptography/src/ILLink/ILLink.Descriptors.LibraryBuild.xml: Language not supported
- src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt: Language not supported
- src/native/libs/System.Security.Cryptography.Native/apibridge.h: Language not supported
- src/native/libs/System.Security.Cryptography.Native/entrypoints.c: Language not supported
- src/native/libs/System.Security.Cryptography.Native/memory_debug.c: Language not supported
- src/native/libs/System.Security.Cryptography.Native/memory_debug.h: Language not supported
- src/native/libs/System.Security.Cryptography.Native/openssl.c: Language not supported
- src/native/libs/System.Security.Cryptography.Native/opensslshim.h: Language not supported
bartonjs
approved these changes
Feb 7, 2025
This was referenced Feb 10, 2025
Member
Author
|
/ba-g wasm failures are unrelated. |
grendello
added a commit
to grendello/runtime
that referenced
this pull request
Feb 12, 2025
* main: [Android] Run CoreCLR functional tests on Android (dotnet#112283) [LoongArch64] Fix some assertion failures for Debug ILC building Debug NativeAOT testcases. (dotnet#112229) Fix suspicious code fragments (dotnet#112384) `__ComObject` doesn't support dynamic interface map (dotnet#112375) Native DLLs: only load imported DLLs from System32 (dotnet#112359) [main] Update dependencies from dotnet/roslyn (dotnet#112314) Update SVE instructions that writes to GC regs (dotnet#112389) Bring up android+coreclr windows build. (dotnet#112256) Never use heap for return buffers (dotnet#112060) Wait to complete the test before releasing the agile reference. (dotnet#112387) Prevent returning disposed HTTP/1.1 connections to the pool (dotnet#112383) Fingerprint dotnet.js if writing import map to html is enabled (dotnet#112407) Remove duplicate definition of CORECLR_HOSTING_API_LINKAGE (dotnet#112096) Update the exception message to reflect current behavior. (dotnet#112355) Use enum for frametype not v table (dotnet#112166) Enable AltJits build for LoongArch64 and RiscV64 (dotnet#110282) Guard members of MonoType union & fix related bugs (dotnet#111645) Add optional hooks for debugging OpenSSL memory allocations (dotnet#111539) JIT: Optimize struct parameter register accesses in the backend (dotnet#110819) NativeAOT: Cover more opcodes in type preinitializer (dotnet#112073)
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This ressurects #101626. CC: @wfurt.
Changes since his PR:
We had several cases when users complained about large memory use. For than native it is quite difficult to figure out where the memory goes. This PR aims to make that somewhat easier.
OpenSSL provides hooks for memory function so this PR adds switch to optimally hook into that.
The only one caveat that the
CRYPTO_set_mem_functionsworks only if called before any allocations e.g. it needs to be done very early in the process. So I end up putting into initialization process.The simple use pattern is something like
Access through Reflection should be OK since this is only last resort debug hook e.g. it does not need stable API and convenient access.