Skip to content

Commit 1bfc7c8

Browse files
authored
Merge branch 'main' into browser_src_tests
2 parents 8dcbbde + ae21049 commit 1bfc7c8

File tree

8 files changed

+41
-44
lines changed

8 files changed

+41
-44
lines changed

eng/pipelines/performance/templates/perf-ios-scenarios-build-jobs.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
parameters:
2-
hybridGlobalization: true
32
mono: false
43
coreclr: false
54
nativeAot: false
65

76
jobs:
87
- ${{ if eq(parameters.mono, true) }}:
9-
# build mono iOS scenarios HybridGlobalization
8+
# build mono iOS scenarios
109
- template: /eng/pipelines/common/platform-matrix.yml
1110
parameters:
1211
jobTemplate: /eng/pipelines/common/global-build-job.yml
@@ -20,8 +19,6 @@ jobs:
2019
isOfficialBuild: false
2120
postBuildSteps:
2221
- template: /eng/pipelines/performance/templates/build-perf-sample-apps.yml
23-
parameters:
24-
hybridGlobalization: ${{ parameters.hybridGlobalization }}
2522

2623
- ${{ if eq(parameters.coreclr, true) }}:
2724
# build CoreCLR iOS scenarios
@@ -43,7 +40,7 @@ jobs:
4340
runtimeType: coreclr
4441

4542
- ${{ if eq(parameters.nativeAot, true) }}:
46-
# build NativeAOT iOS scenarios HybridGlobalization
43+
# build NativeAOT iOS scenarios
4744
- template: /eng/pipelines/common/platform-matrix.yml
4845
parameters:
4946
jobTemplate: /eng/pipelines/common/global-build-job.yml
@@ -57,5 +54,3 @@ jobs:
5754
isOfficialBuild: false
5855
postBuildSteps:
5956
- template: /eng/pipelines/performance/templates/build-perf-sample-apps.yml
60-
parameters:
61-
hybridGlobalization: ${{ parameters.hybridGlobalization }}

src/coreclr/utilcode/debug.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#include "ex.h"
1313
#include "corexcep.h"
1414
#include <time.h>
15+
#if defined(HOST_IOS) || defined(HOST_TVOS) || defined(HOST_MACCATALYST)
16+
#include <sys/time.h>
17+
#endif
1518

1619
#include <minipal/debugger.h>
1720

@@ -160,7 +163,15 @@ VOID LogAssert(
160163
STRESS_LOG2(LF_ASSERT, LL_ALWAYS, "ASSERT:%s:%d\n", szFile, iLine);
161164

162165
struct timespec ts;
166+
#if defined(HOST_IOS) || defined(HOST_TVOS) || defined(HOST_MACCATALYST)
167+
// timespec_get is only available on iOS 13.0+, use gettimeofday instead
168+
struct timeval tv;
169+
gettimeofday(&tv, nullptr);
170+
ts.tv_sec = tv.tv_sec;
171+
ts.tv_nsec = tv.tv_usec * 1000;
172+
#else
163173
int ret = timespec_get(&ts, TIME_UTC);
174+
#endif
164175

165176
struct tm local;
166177
#ifdef HOST_WINDOWS

src/libraries/Common/src/System/Security/Cryptography/ECCng.ImportExport.NamedCurve.cs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,40 +152,29 @@ internal static SafeNCryptKeyHandle ImportKeyBlob(
152152

153153
using (SafeUnicodeStringHandle safeCurveName = new SafeUnicodeStringHandle(curveName))
154154
{
155-
Interop.BCrypt.BCryptBufferDesc desc = default;
156-
Interop.BCrypt.BCryptBuffer buff = default;
157-
158-
IntPtr descPtr = IntPtr.Zero;
159-
IntPtr buffPtr = IntPtr.Zero;
160-
try
155+
unsafe
161156
{
162-
descPtr = Marshal.AllocHGlobal(Marshal.SizeOf(desc));
163-
buffPtr = Marshal.AllocHGlobal(Marshal.SizeOf(buff));
157+
Interop.BCrypt.BCryptBufferDesc desc = default;
158+
Interop.BCrypt.BCryptBuffer buff = default;
159+
164160
buff.cbBuffer = (curveName.Length + 1) * 2; // Add 1 for null terminator
165161
buff.BufferType = Interop.BCrypt.CngBufferDescriptors.NCRYPTBUFFER_ECC_CURVE_NAME;
166162
buff.pvBuffer = safeCurveName.DangerousGetHandle();
167-
Marshal.StructureToPtr(buff, buffPtr, false);
168163

169164
desc.cBuffers = 1;
170-
desc.pBuffers = buffPtr;
165+
desc.pBuffers = (IntPtr)(&buff);
171166
desc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION;
172-
Marshal.StructureToPtr(desc, descPtr, false);
173167

174168
errorCode = Interop.NCrypt.NCryptImportKey(
175169
provider,
176170
IntPtr.Zero,
177171
blobType,
178-
descPtr,
172+
(IntPtr)(&desc),
179173
out keyHandle,
180174
ref MemoryMarshal.GetReference(keyBlob),
181175
keyBlob.Length,
182176
0);
183177
}
184-
finally
185-
{
186-
Marshal.FreeHGlobal(descPtr);
187-
Marshal.FreeHGlobal(buffPtr);
188-
}
189178
}
190179

191180
if (errorCode != ErrorCode.ERROR_SUCCESS)

src/libraries/Common/src/System/Security/Cryptography/MLKem.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ private protected unsafe void ReadCngMLKemBlob(
2626
throw new CryptographicException();
2727
}
2828

29-
int blobHeaderSize = Marshal.SizeOf<BCRYPT_MLKEM_KEY_BLOB>();
29+
int blobHeaderSize = sizeof(BCRYPT_MLKEM_KEY_BLOB);
3030
int keySize = checked((int)blob->cbKey);
3131

3232
if (keySize != destination.Length)

src/libraries/Common/src/System/Security/Cryptography/PqcBlobHelpers.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ internal delegate TReturn EncodeMLKemBlobCallback<TState, TReturn>(
216216
string blobKind,
217217
ReadOnlySpan<byte> blob);
218218

219-
internal static TReturn EncodeMLKemBlob<TState, TReturn>(
219+
internal static unsafe TReturn EncodeMLKemBlob<TState, TReturn>(
220220
KeyBlobMagicNumber kind,
221221
MLKemAlgorithm algorithm,
222222
ReadOnlySpan<byte> key,
@@ -230,7 +230,7 @@ internal static TReturn EncodeMLKemBlob<TState, TReturn>(
230230
// try to accommodate them.
231231
const int MaxKeyStackSize = 128;
232232
string parameterSet = GetMLKemParameterSet(algorithm);
233-
int blobHeaderSize = Marshal.SizeOf<BCRYPT_MLKEM_KEY_BLOB>();
233+
int blobHeaderSize = sizeof(BCRYPT_MLKEM_KEY_BLOB);
234234
int parameterSetMarshalLength = (parameterSet.Length + 1) * 2;
235235
int blobSize =
236236
blobHeaderSize +
@@ -246,15 +246,12 @@ internal static TReturn EncodeMLKemBlob<TState, TReturn>(
246246
{
247247
buffer.Clear();
248248

249-
unsafe
249+
fixed (byte* pBuffer = buffer)
250250
{
251-
fixed (byte* pBuffer = buffer)
252-
{
253-
BCRYPT_MLKEM_KEY_BLOB* blob = (BCRYPT_MLKEM_KEY_BLOB*)pBuffer;
254-
blob->dwMagic = kind;
255-
blob->cbParameterSet = (uint)parameterSetMarshalLength;
256-
blob->cbKey = (uint)key.Length;
257-
}
251+
BCRYPT_MLKEM_KEY_BLOB* blob = (BCRYPT_MLKEM_KEY_BLOB*)pBuffer;
252+
blob->dwMagic = kind;
253+
blob->cbParameterSet = (uint)parameterSetMarshalLength;
254+
blob->cbKey = (uint)key.Length;
258255
}
259256

260257
// This won't write the null byte, but we zeroed the whole buffer earlier.

src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/ChainPal.Windows.BuildChain.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ internal sealed partial class ChainPal : IDisposable, IChainPal
3636
using (SafeCertStoreHandle extraStoreHandle = ConvertStoreToSafeHandle(extraStore))
3737
{
3838
Interop.Crypt32.CERT_CHAIN_PARA chainPara = default;
39-
chainPara.cbSize = Marshal.SizeOf<Interop.Crypt32.CERT_CHAIN_PARA>();
39+
chainPara.cbSize = sizeof(Interop.Crypt32.CERT_CHAIN_PARA);
4040

4141
int applicationPolicyCount;
4242
using (SafeHandle applicationPolicyOids = applicationPolicy!.ToLpstrArray(out applicationPolicyCount))
@@ -88,12 +88,15 @@ private static SafeChainEngineHandle GetChainEngine(
8888
if (trustMode == X509ChainTrustMode.CustomRootTrust)
8989
{
9090
// Need to get a valid SafeCertStoreHandle otherwise the default stores will be trusted
91-
using (SafeCertStoreHandle customTrustStoreHandle = ConvertStoreToSafeHandle(customTrustStore, true))
91+
unsafe
9292
{
93-
Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG customChainEngine = default;
94-
customChainEngine.cbSize = Marshal.SizeOf<Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG>();
95-
customChainEngine.hExclusiveRoot = customTrustStoreHandle.DangerousGetHandle();
96-
chainEngineHandle = Interop.crypt32.CertCreateCertificateChainEngine(ref customChainEngine);
93+
using (SafeCertStoreHandle customTrustStoreHandle = ConvertStoreToSafeHandle(customTrustStore, true))
94+
{
95+
Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG customChainEngine = default;
96+
customChainEngine.cbSize = sizeof(Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG);
97+
customChainEngine.hExclusiveRoot = customTrustStoreHandle.DangerousGetHandle();
98+
chainEngineHandle = Interop.crypt32.CertCreateCertificateChainEngine(ref customChainEngine);
99+
}
97100
}
98101
}
99102
else

src/mono/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public override bool Equals(object? obj)
359359

360360
public override int GetHashCode()
361361
{
362-
// Lame, but easy, and will work, and chances are
362+
// This is easy and will work; chances are
363363
// you will only need a few of these.
364364
return 0;
365365
}

src/mono/mono/component/hot_reload.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,9 +2381,11 @@ hot_reload_apply_changes (int origin, MonoImage *image_base, gconstpointer dmeta
23812381
if (!assembly_update_supported (image_base, error)) {
23822382
return;
23832383
}
2384-
2384+
if (dmeta_bytes == 0 && dil_bytes_orig == 0) // we may receive empty updates
2385+
{
2386+
return;
2387+
}
23852388
static int first_origin = -1;
2386-
23872389
if (first_origin < 0) {
23882390
first_origin = origin;
23892391
}

0 commit comments

Comments
 (0)