Skip to content

Commit 4928f3c

Browse files
authored
Merge branch 'main' into adjust-rtt-logic
2 parents 82214a9 + b977a83 commit 4928f3c

39 files changed

+949
-166
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@
117117
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
118118
</Dependency>
119119
<!-- Intermediate is necessary for source build. -->
120-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="9.0.0-alpha.1.24101.1">
120+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="9.0.0-alpha.1.24105.2">
121121
<Uri>https://github.com/dotnet/source-build-externals</Uri>
122-
<Sha>949db2fd23b687c0d545e954943feada8b361ed6</Sha>
122+
<Sha>2c52f66055a098987321c8fe96472679661c4071</Sha>
123123
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
124124
</Dependency>
125125
</ProductDependencies>

src/libraries/System.Net.Security/src/System/Net/Security/SslStreamCertificateContext.Linux.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,17 @@ partial void AddRootCertificate(X509Certificate2? rootCertificate, ref bool tran
154154
return ValueTask.FromResult(_ocspResponse);
155155
}
156156

157+
internal ValueTask<byte[]?> WaitForPendingOcspFetchAsync()
158+
{
159+
Task<byte[]?>? pending = _pendingDownload;
160+
if (pending is not null && !pending.IsFaulted)
161+
{
162+
return new ValueTask<byte[]?>(pending);
163+
}
164+
165+
return ValueTask.FromResult(DateTimeOffset.UtcNow <= _ocspExpiration ? _ocspResponse : null);
166+
}
167+
157168
private ValueTask<byte[]?> DownloadOcspAsync()
158169
{
159170
Task<byte[]?>? pending = _pendingDownload;

src/libraries/System.Net.Security/tests/UnitTests/SslStreamCertificateContextOcspLinuxTests.cs

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
namespace System.Net.Security.Tests;
1717

18+
[PlatformSpecific(TestPlatforms.Linux)]
1819
public class SslStreamCertificateContextOcspLinuxTests
1920
{
2021
[Fact]
@@ -101,7 +102,8 @@ await SimpleTest(PkiOptions.OcspEverywhere, async (root, intermediate, endEntity
101102
intermediate.RevocationExpiration = DateTimeOffset.UtcNow.Add(SslStreamCertificateContext.MinRefreshBeforeExpirationInterval);
102103

103104
SslStreamCertificateContext ctx = ctxFactory(false);
104-
byte[] ocsp = await ctx.GetOcspResponseAsync();
105+
byte[] ocsp = await ctx.WaitForPendingOcspFetchAsync();
106+
105107
Assert.NotNull(ocsp);
106108

107109
intermediate.RevocationExpiration = DateTimeOffset.UtcNow.AddDays(1);
@@ -111,12 +113,10 @@ await SimpleTest(PkiOptions.OcspEverywhere, async (root, intermediate, endEntity
111113
byte[] ocsp2 = ctx.GetOcspResponseNoWaiting();
112114
Assert.Equal(ocsp, ocsp2);
113115

114-
await RetryHelper.ExecuteAsync(async () =>
115-
{
116-
byte[] ocsp3 = await ctx.GetOcspResponseAsync();
117-
Assert.NotNull(ocsp3);
118-
Assert.NotEqual(ocsp, ocsp3);
119-
}, maxAttempts: 5, backoffFunc: i => (i + 1) * 200 /* ms */);
116+
// The download should succeed
117+
byte[] ocsp3 = await ctx.WaitForPendingOcspFetchAsync();
118+
Assert.NotNull(ocsp3);
119+
Assert.NotEqual(ocsp, ocsp3);
120120
});
121121
}
122122

@@ -128,7 +128,10 @@ await SimpleTest(PkiOptions.OcspEverywhere, async (root, intermediate, endEntity
128128
intermediate.RevocationExpiration = DateTimeOffset.UtcNow.AddSeconds(1);
129129

130130
SslStreamCertificateContext ctx = ctxFactory(false);
131+
// Make sure the inner OCSP fetch finished
132+
await ctx.WaitForPendingOcspFetchAsync();
131133

134+
// wait until the cached OCSP response expires
132135
await Task.Delay(2000);
133136

134137
intermediate.RevocationExpiration = DateTimeOffset.UtcNow.AddDays(1);
@@ -137,8 +140,8 @@ await SimpleTest(PkiOptions.OcspEverywhere, async (root, intermediate, endEntity
137140
byte[] ocsp = ctx.GetOcspResponseNoWaiting();
138141
Assert.Null(ocsp);
139142

140-
// subsequent call will return the new response
141-
byte[] ocsp2 = await ctx.GetOcspResponseAsync();
143+
// The download should succeed
144+
byte[] ocsp2 = await ctx.WaitForPendingOcspFetchAsync();
142145
Assert.NotNull(ocsp2);
143146
});
144147
}
@@ -155,25 +158,34 @@ await SimpleTest(PkiOptions.OcspEverywhere, async (root, intermediate, endEntity
155158
intermediate.RevocationExpiration = DateTimeOffset.UtcNow.Add(SslStreamCertificateContext.MinRefreshBeforeExpirationInterval);
156159

157160
SslStreamCertificateContext ctx = ctxFactory(false);
158-
byte[] ocsp = await ctx.GetOcspResponseAsync();
161+
// Make sure the inner OCSP fetch finished
162+
byte[] ocsp = await ctx.WaitForPendingOcspFetchAsync();
159163
Assert.NotNull(ocsp);
160164

161165
responder.RespondKind = RespondKind.Invalid;
162-
for (int i = 0; i < 3; i++)
166+
for (int i = 0; i < 2; i++)
163167
{
164-
await Task.Delay(SslStreamCertificateContext.RefreshAfterFailureBackOffInterval);
165168
byte[] ocsp2 = await ctx.GetOcspResponseAsync();
169+
await ctx.WaitForPendingOcspFetchAsync();
166170
Assert.Equal(ocsp, ocsp2);
171+
await Task.Delay(SslStreamCertificateContext.RefreshAfterFailureBackOffInterval.Add(TimeSpan.FromSeconds(1)));
167172
}
168173

174+
// make sure we try again only after backoff expires
175+
await ctx.WaitForPendingOcspFetchAsync();
176+
await Task.Delay(SslStreamCertificateContext.RefreshAfterFailureBackOffInterval.Add(TimeSpan.FromSeconds(1)));
177+
169178
// after responder comes back online, the staple is eventually refreshed
179+
intermediate.RevocationExpiration = DateTimeOffset.UtcNow.AddDays(1);
170180
responder.RespondKind = RespondKind.Normal;
171-
await RetryHelper.ExecuteAsync(async () =>
172-
{
173-
byte[] ocsp3 = await ctx.GetOcspResponseAsync();
174-
Assert.NotNull(ocsp3);
175-
Assert.NotEqual(ocsp, ocsp3);
176-
}, maxAttempts: 5, backoffFunc: i => (i + 1) * 200 /* ms */);
181+
182+
// dispatch background refresh (first call still returns the old cached value)
183+
await ctx.GetOcspResponseAsync();
184+
185+
// after refresh we should have a new staple
186+
byte[] ocsp3 = await ctx.WaitForPendingOcspFetchAsync();
187+
Assert.NotNull(ocsp3);
188+
Assert.NotEqual(ocsp, ocsp3);
177189
});
178190
}
179191

src/libraries/tests.proj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
<ItemGroup Condition="'$(TargetOS)' == 'browser' and '$(WasmEnableThreads)' == 'true'" >
6565
<!-- https://github.com/dotnet/runtime/issues/91676 -->
6666
<ProjectExclusions Include="$(MonoProjectRoot)sample\wasm\browser-minimal-config\Wasm.Browser.Config.Sample.csproj" />
67+
<!-- https://github.com/dotnet/runtime/issues/98026 -->
68+
<ProjectExclusions Include="$(MonoProjectRoot)sample\wasm\browser-eventpipe\Wasm.Browser.EventPipe.Sample.csproj" />
6769
</ItemGroup>
6870

6971
<!-- wasm EAT/AOT -->

src/mono/mono/metadata/icall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2813,7 +2813,7 @@ ves_icall_RuntimeType_GetCallingConventionFromFunctionPointerInternal (MonoQCall
28132813
MonoType *type = type_handle.type;
28142814
g_assert (type->type == MONO_TYPE_FNPTR);
28152815
// FIXME: Once we address: https://github.com/dotnet/runtime/issues/90308 this should not be needed anymore
2816-
return GUINT_TO_INT8 (type->data.method->suppress_gc_transition ? MONO_CALL_UNMANAGED_MD : type->data.method->call_convention);
2816+
return GUINT_TO_INT8 (mono_method_signature_has_ext_callconv (type->data.method, MONO_EXT_CALLCONV_SUPPRESS_GC_TRANSITION) ? MONO_CALL_UNMANAGED_MD : type->data.method->call_convention);
28172817
}
28182818

28192819
MonoBoolean

src/mono/mono/metadata/loader.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ inflate_generic_signature_checked (MonoImage *image, MonoMethodSignature *sig, M
634634
res->explicit_this = sig->explicit_this;
635635
res->call_convention = sig->call_convention;
636636
res->pinvoke = sig->pinvoke;
637+
res->ext_callconv = sig->ext_callconv;
637638
res->generic_param_count = sig->generic_param_count;
638639
res->sentinelpos = sig->sentinelpos;
639640
res->has_type_parameters = is_open;

0 commit comments

Comments
 (0)