Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

[release/3.1] release existingTrust to avoid native memory leak in ssl handshake on macOS #42985

Merged
merged 1 commit into from
Sep 18, 2020

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented Sep 10, 2020

This is port of dotnet/runtime#41657 to fix dotnet/runtime#34080

Summary

There is memory leak inside of AppleCryptoNative_SslIsHostnameMatch() function which is used to verify peer's name in every client TLS handshake on macOS. There is no workaround and if running long enough, .NET will consume all available memory and crash. The SecTrustRef is internal structure and holds additional objects - like URL of OCSP or CRL responder so leaked memory is bigger than small.

Customer Impact

We have worked with a major customer who has been hitting this leak in an app that they intend to widely deploy within their organization (10K”s of deployments). They are encountering this leak and it is blocking their deployment. They have attempted to work around it by restarting the app when their memory consumption reaches a threshold but this workaround is not sustainable for them at scale so they are seeking a fix backported to 3.1 LTS.

Regression?

no.

Testing

the fix was verified with Apple's development tools e.g. leaks utility

Risk

low. This releases structure we obtained via SSLCopyPeerTrust and it does not change any flow.

cc: @danmosemsft

@wfurt wfurt added os-mac-os-x OS-X aka Mac OS area-System.Net.Security Servicing-consider Issue for next servicing release review labels Sep 10, 2020
@wfurt wfurt added this to the 3.1.x milestone Sep 10, 2020
@wfurt wfurt self-assigned this Sep 10, 2020
@danmoseley
Copy link
Member

@wfurt did the customer verify with a private binary that this fixes the problem for them?

@wfurt
Copy link
Member Author

wfurt commented Sep 10, 2020

I asked on the AWS SDK dotnet/runtime#37318 thread. I will follow-up with support if they don't respond promptly.

@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 10, 2020
@leecow leecow modified the milestones: 3.1.x, 3.1.9 Sep 10, 2020
@leecow
Copy link
Member

leecow commented Sep 10, 2020

Awaiting feedback from customer.

@danmoseley
Copy link
Member

Tactics asked that we wait for the customer acknowledgement that this fixes it for them - but if we don't hear back by 9/18 we should merge it anyway to catch 3.1.9

@Anipik
Copy link

Anipik commented Sep 15, 2020

@wfurt any update from the customer on this one ?

@wfurt
Copy link
Member Author

wfurt commented Sep 16, 2020

no, but they got details they asked for today. We asked them if they can finish verification by Friday but I did not see response yet.

@Anipik
Copy link

Anipik commented Sep 17, 2020

Okay, we can wait another day and then merge it tomorrow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Security os-mac-os-x OS-X aka Mac OS Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants