- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.2k
 
Don't unset ALPN list pointer during ALPN selection callback. #99357
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
Conversation
| 
           Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones Issue DetailsFixes #99289. When server issues HelloRetryRequest and client sends a second ClientHello message, we need to do a second round of ALPN selection, so we need to keep it around and not set the ptr to null. The ALPN list handle is going to be alive until the end of the SSL object lifetime runtime/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs Lines 423 to 427 in 961257b 
 
  | 
    
| 
           /azp run runtime-libraries-coreclr outerloop  | 
    
| 
          
Azure Pipelines successfully started running 1 pipeline(s). | 
    
        
          
                src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
          
            Show resolved
            Hide resolved
        
      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.
Can we craft test using NegotiateClientCertificateAsync? It does not need to send cert IMHO just a way how to trigger renegotiation. Perhaps do Theory for 1.2 and 1.3 separately....?
          
 I don't think renegotiation triggers this, its triggered by server sending HelloRetryRequest in response to ClientHello, and I don't think we have public API which can trigger this (I had to manipulate the openssl.cnf to reproduce the issue).  | 
    
          
 Wouldn't the handshake logic be triggered again ... including the callback? I think it does it for certificate validation as far as I remember.  | 
    
| 
           Classical renegotiation after the first handshake was completed does not trigger the ALPN selection callback (Otherwise, we would've noticed already because we test this code path for late client cert negotiation). I have found some discussion at openssl/openssl#2767 and apparently OpenSSL ignores ALPN extension once the application protocol has been established by ServerHello.  | 
    
| 
           Test failures are unrelated.  | 
    
| 
           /azp run runtime-libraries-coreclr outerloop  | 
    
| 
          
Azure Pipelines successfully started running 1 pipeline(s). | 
    
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.
LGTM
| 
           CI failures are unrelated  | 
    
| 
           /backport to release/8.0-staging  | 
    
| 
           Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/8262729469  | 
    
Fixes #99289.
When server issues HelloRetryRequest and client sends a second ClientHello message, we need to do a second round of ALPN selection, so we need to keep it alpn list handle still set in the Ssl ex data slot.
The ALPN list handle is going to be alive until the end of the SSL object lifetime, so there is no risk of dangling pointer as the comment claims.
runtime/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
Lines 423 to 427 in 961257b