Uh oh!
There was an error while loading. Please reload this page.
Zlib: Add some protections to the allocator used by zlib - #84604
Conversation
ghost
commented
Apr 11, 2023
Tagging subscribers to this area: @dotnet/area-system-io-compression Issue DetailsThis adds defense-in-depth protections to the allocator used by zlib to help mitigate the risk posed by potential future CVEs against this library. Basic defenses against use-of-uninitialized-memory bugs, local buffer overruns, and double-free bugs are provided. The overall goal is that should a future CVE be found that fits one of those categories, the CVE's nominal severity can drop from Critical -> Important or from Important -> Moderate because of the difficulty of successful exploit. The .c files included in this PR describe the defenses in more detail. Windows benchmark results:
|
carlossanlop
left a comment
There was a problem hiding this comment.
Do you think we can have tests that verify this new code?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
GrabYourPitchforks
commented
Apr 11, 2023
@carlossanlop I'm open to suggestions as to how to test this! The most straightforward way that occurs to me is to have a callback mechanism, but now we're leaking abstractions through the DLL's exports and inserting complexity. :( |
danmoseley
commented
Apr 12, 2023
do you plan to offer these to zlib upstream? |
No. Per our other conversation, I don't think it's necessary. |
I also reran the aspnet benchmarks after ripping out the LFH code and didn't observe any difference before + after the change. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Move allocator files under Compression.Native dir - Update pal_zlib includes, use calloc instead of malloc - Remove custom typedefs from zlib unix allocator
High level notes from the latest iteration:
I smoke tested the Unix version on my Ubuntu box by making a change to cmakelists.txt and forcing us to use the internal version, even though the distro already had a shared zlib library. New test run since the other one went stale: https://dev.azure.com/dnceng-public/public/_build/results?buildId=246796 |
carlossanlop
left a comment
There was a problem hiding this comment.
Thanks for the change. And thanks for all the comments, they were quite helpful.
GrabYourPitchforks
commented
Jul 26, 2023
/backport to release/7.0-staging |
Started backporting to release/7.0-staging: https://github.com/dotnet/runtime/actions/runs/5674150369 |
This adds defense-in-depth protections to the allocator used by zlib to help mitigate the risk posed by potential future CVEs against this library. Basic defenses against use-of-uninitialized-memory bugs, local buffer overruns, and double-free bugs are provided. The overall goal is that should a future CVE be found that fits one of those categories, the CVE's nominal severity can drop from Critical -> Important or from Important -> Moderate because of the difficulty of successful exploit.
The .c files included in this PR describe the defenses in more detail.
Windows benchmark results:
Though the three PRs #84602, #84603, and #84604 are all related to zlib; they're each fully standalone and can be reviewed as isolated units.