Commit fd3f89f
Work around Schannel TLS resume disable race on older Windows (#126693)
## Summary
On Windows Server 2022 (build 20348) and older,
`ApplyControlToken(SSL_SESSION_DISABLE_RECONNECTS)` races with
Schannel's internal session cache — `InitializeSecurityContext`'s
internal `LookupCacheByName` finds a fresh resumable entry and embeds
the session ID in the `ClientHello` before `ApplyControlToken` can
expire it.
## Workaround
After `ApplyControlToken`, delete the security context and retry
`InitializeSecurityContext` with a null context so the new `ClientHello`
is generated without a stale session ID. This follows the same pattern
used by Schannel's own `webcli.c` test and `http.sys`.
The workaround is conditioned on `Environment.OSVersion.Version.Build <
22000` (pre-Windows 11), since newer Schannel builds correctly prevent
cache population when `ApplyControlToken` is used.
Also re-enables the `ClientDisableTlsResume_Succeeds` test that was
disabled due to this issue.
Fixes #103449
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 4f21ff0 commit fd3f89f
2 files changed
Lines changed: 43 additions & 9 deletions
File tree
- src/libraries/System.Net.Security
- src/System/Net/Security
- tests/FunctionalTests
Lines changed: 43 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
29 | 38 | | |
30 | 39 | | |
31 | 40 | | |
| |||
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| |||
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
209 | | - | |
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
214 | 249 | | |
215 | 250 | | |
216 | 251 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| |||
0 commit comments