From 5a5d7f0518b564e7f840c6c939bb6618c778b21b Mon Sep 17 00:00:00 2001 From: Anipik Date: Tue, 17 Aug 2021 14:33:53 -0700 Subject: [PATCH 1/9] update branding to rc2 --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 4265ca9042750..64624929e6700 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ 0 6.0.100 rc - 1 + 2 $(MajorVersion).$(MinorVersion).0.0 From 0c015ecbd0aa9307830e53ceb7690bf527a9ab96 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Aug 2021 15:37:06 -0400 Subject: [PATCH 2/9] Fix Debug.Assert use of string interpolation (#57667) Co-authored-by: Stephen Toub --- .../tools/Common/JitInterface/SystemVStructClassificator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs b/src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs index 55b8e2d1dc02c..c4105d1ce9173 100644 --- a/src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs +++ b/src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs @@ -158,7 +158,7 @@ private static SystemVClassificationType TypeDef2SystemVClassification(TypeDesc case TypeFlags.GenericParameter: case TypeFlags.SignatureTypeVariable: case TypeFlags.SignatureMethodVariable: - Debug.Assert(false, $"Type {typeDesc} with unexpected category {typeDesc.Category}"); + Debug.Fail($"Type {typeDesc} with unexpected category {typeDesc.Category}"); return SystemVClassificationTypeUnknown; default: return SystemVClassificationTypeUnknown; From 9e56917546210a649262af4d1616f52553253a11 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Aug 2021 12:43:47 -0700 Subject: [PATCH 3/9] Throw on invalid payload length in WebSockets (#57636) Co-authored-by: Natalia Kondratyeva --- .../src/Resources/Strings.resx | 5 ++- .../System/Net/WebSockets/ManagedWebSocket.cs | 8 +++++ .../tests/WebSocketCreateTest.cs | 31 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Net.WebSockets/src/Resources/Strings.resx b/src/libraries/System.Net.WebSockets/src/Resources/Strings.resx index 693f8d3863fd7..e96ac19e3f8ef 100644 --- a/src/libraries/System.Net.WebSockets/src/Resources/Strings.resx +++ b/src/libraries/System.Net.WebSockets/src/Resources/Strings.resx @@ -165,4 +165,7 @@ The compression options for a continuation cannot be different than the options used to send the first fragment of the message. - \ No newline at end of file + + The WebSocket received a frame with an invalid payload length. + + diff --git a/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs b/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs index 05b171cf94ed7..ec62d92ac11a9 100644 --- a/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs +++ b/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs @@ -1116,6 +1116,14 @@ private async ValueTask CloseWithReceiveErrorAndThrowAsync( return SR.net_Websockets_ReservedBitsSet; } + if (header.PayloadLength < 0) + { + // as per RFC, if payload length is a 64-bit integer, the most significant bit MUST be 0 + // frame-payload-length-63 = %x0000000000000000-7FFFFFFFFFFFFFFF; 64 bits in length + resultHeader = default; + return SR.net_Websockets_InvalidPayloadLength; + } + if (header.Compressed && _inflater is null) { resultHeader = default; diff --git a/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs b/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs index f940df0add3ae..f9fd4e3c564e5 100644 --- a/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs +++ b/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs @@ -149,6 +149,37 @@ public async Task ReceiveAsync_InvalidFrameHeader_AbortsAndThrowsException(byte } } + [Theory] + [InlineData(new byte[] { 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, false)] // max allowed value + [InlineData(new byte[] { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, true)] + public async Task ReceiveAsync_InvalidPayloadLength_AbortsAndThrowsException(byte[] lenBytes, bool shouldFail) + { + var frame = new byte[11]; + frame[0] = 0b1_000_0010; // FIN, RSV, OPCODE + frame[1] = 0b0_1111111; // MASK, PAYLOAD_LEN + Assert.Equal(8, lenBytes.Length); + Array.Copy(lenBytes, 0, frame, 2, lenBytes.Length); // EXTENDED_PAYLOAD_LEN + frame[10] = (byte)'a'; + + using var stream = new MemoryStream(frame, writable: true); + using WebSocket websocket = CreateFromStream(stream, false, null, Timeout.InfiniteTimeSpan); + + var buffer = new byte[1]; + Task t = websocket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None); + if (shouldFail) + { + var exc = await Assert.ThrowsAsync(() => t); + Assert.Equal(WebSocketState.Aborted, websocket.State); + } + else + { + WebSocketReceiveResult result = await t; + Assert.False(result.EndOfMessage); + Assert.Equal(1, result.Count); + Assert.Equal('a', (char)buffer[0]); + } + } + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "System.Net.Sockets is not supported on this platform.")] [ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] From 5d0820af5eac70f95d1395d60cb000e4fb08a49b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 07:20:23 -0700 Subject: [PATCH 4/9] [release/6.0] JIT: don't clone loops where init or limit is a cast local (#57685) * JIT: don't clone loops where init or limit is a cast local The loop cloner assumes all computations it introduces are compatible with TYP_INT, so don't allow cloning when the initial or final value are variables with incompatible types. Fixes #57535. * Apply suggestions from code review Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com> Co-authored-by: Andy Ayers Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com> --- src/coreclr/jit/loopcloning.cpp | 18 +++++++++-- .../JitBlue/Runtime_57535/Runtime_57535.cs | 28 +++++++++++++++++ .../Runtime_57535/Runtime_57535.csproj | 12 +++++++ .../JitBlue/Runtime_57535/Runtime_57535_1.cs | 31 +++++++++++++++++++ .../Runtime_57535/Runtime_57535_1.csproj | 12 +++++++ 5 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.csproj create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.csproj diff --git a/src/coreclr/jit/loopcloning.cpp b/src/coreclr/jit/loopcloning.cpp index 69e916c324952..9b2898a3270ed 100644 --- a/src/coreclr/jit/loopcloning.cpp +++ b/src/coreclr/jit/loopcloning.cpp @@ -968,7 +968,14 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext else if (loop->lpFlags & LPFLG_VAR_INIT) { // initVar >= 0 - LC_Condition geZero(GT_GE, LC_Expr(LC_Ident(loop->lpVarInit, LC_Ident::Var)), + const unsigned initLcl = loop->lpVarInit; + if (!genActualTypeIsInt(lvaGetDesc(initLcl))) + { + JITDUMP("> Init var V%02u not compatible with TYP_INT\n", initLcl); + return false; + } + + LC_Condition geZero(GT_GE, LC_Expr(LC_Ident(initLcl, LC_Ident::Var)), LC_Expr(LC_Ident(0, LC_Ident::Const))); context->EnsureConditions(loopNum)->Push(geZero); } @@ -992,9 +999,14 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext } else if (loop->lpFlags & LPFLG_VAR_LIMIT) { - unsigned limitLcl = loop->lpVarLimit(); - ident = LC_Ident(limitLcl, LC_Ident::Var); + const unsigned limitLcl = loop->lpVarLimit(); + if (!genActualTypeIsInt(lvaGetDesc(limitLcl))) + { + JITDUMP("> Limit var V%02u not compatible with TYP_INT\n", limitLcl); + return false; + } + ident = LC_Ident(limitLcl, LC_Ident::Var); LC_Condition geZero(GT_GE, LC_Expr(ident), LC_Expr(LC_Ident(0, LC_Ident::Const))); context->EnsureConditions(loopNum)->Push(geZero); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.cs new file mode 100644 index 0000000000000..1af66647dff37 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.cs @@ -0,0 +1,28 @@ +using System; +using System.Runtime.CompilerServices; + +class Runtime_57535 +{ + static long z; + + public static int Main() + { + z = 10; + int[] a = F(); + long zz = z; + int result = 0; + for (int i = 0; i < (int) zz; i++) + { + result += a[i]; + } + return result; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static int[] F() + { + int[] result = new int[100]; + result[3] = 100; + return result; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.csproj new file mode 100644 index 0000000000000..f3e1cbd44b404 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.cs new file mode 100644 index 0000000000000..83040ad93efca --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.cs @@ -0,0 +1,31 @@ +using System; +using System.Runtime.CompilerServices; + +class Runtime_57535_1 +{ + static long z; + + public static int Main() + { + z = 2; + int[] a = F(); + long zz = z; + int result = 0; + for (int i = (int) zz; i < a.Length; i++) + { + result += a[i]; + } + Bar(zz); + return result; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static int[] F() + { + int[] result = new int[100]; + result[3] = 100; + return result; + } + + static void Bar(long z) {} +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.csproj new file mode 100644 index 0000000000000..f3e1cbd44b404 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + From 5aeb4f3271fa2488903064b83efd174fc720648d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 09:09:14 -0700 Subject: [PATCH 5/9] [release/6.0] Fix incorrect VN when folding GT_NEG(GT_MUL(A, C)) (#57686) * Fix incorrect VN when folding GT_NEG(GT_MUL(A, C)) Fixes #57640 * Fix test name Co-authored-by: Jakob Botsch Nielsen --- src/coreclr/jit/morph.cpp | 1 + .../JitBlue/Runtime_57640/Runtime_57640.cs | 25 +++++++++++++++++++ .../Runtime_57640/Runtime_57640.csproj | 12 +++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.csproj diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 2ff290263c279..2b50b7286f25b 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -13177,6 +13177,7 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac) GenTree* newOp2 = gtNewIconNode(-constVal, op1op2->TypeGet()); // -C mulOrDiv->gtOp1 = newOp1; mulOrDiv->gtOp2 = newOp2; + mulOrDiv->SetVNsFromNode(tree); DEBUG_DESTROY_NODE(tree); DEBUG_DESTROY_NODE(op1op2); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.cs new file mode 100644 index 0000000000000..906780463e8a2 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Generated by Fuzzlyn v1.2 on 2021-08-15 23:15:19 +// Run on .NET 6.0.0-dev on Arm Linux +// Seed: 18219619158927602726 +// Reduced from 82.6 KiB to 0.3 KiB in 00:02:54 +// Debug: Outputs 14270 +// Release: Outputs 4294953026 +public class Runtime_57640 +{ + static long[] s_28 = new long[]{1}; + public static int Main() + { + bool correct = true; + var vr10 = s_28[0]; + for (int vr13 = 0; vr13 < 2; vr13++) + { + uint vr12 = (uint)(0 - (-14270 * vr10)); + correct &= vr12 == 14270; + } + + return correct ? 100 : -1; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.csproj new file mode 100644 index 0000000000000..f3e1cbd44b404 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + From b614529f28772bd0f1f1834f4ccf154e1a57e8a5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 18:13:31 +0200 Subject: [PATCH 6/9] Update dependencies from https://github.com/mono/linker build 20210818.3 (#57700) Microsoft.NET.ILLink.Tasks From Version 6.0.100-preview.6.21416.1 -> To Version 6.0.100-preview.6.21418.3 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 2 +- eng/Versions.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1ebd09b7378e7..bc87a4d8fe441 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -190,7 +190,7 @@ https://github.com/dotnet/runtime fde6b37e985605d862c070256de7c97e2a3f3342 - + https://github.com/mono/linker 5b2391c2c56af47350a5789375e8dbddc692e67f diff --git a/eng/Versions.props b/eng/Versions.props index 64624929e6700..7e1084207bf04 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -169,7 +169,7 @@ 5.0.0-preview-20201009.2 - 6.0.100-preview.6.21416.1 + 6.0.100-preview.6.21418.3 $(MicrosoftNETILLinkTasksVersion) 6.0.0-rc.1.21416.1 From a06a1f436b3d1218160d5a71e517aa739ff01bc5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 19:02:58 +0200 Subject: [PATCH 7/9] [release/6.0] Adding null check to avoid abort when invalid IL is encountered (#57731) When a callvirt instruction is encountered on a static method, there is a hard abort/crash. This commit avoids the problem. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Bill Holmes --- src/mono/mono/mini/method-to-ir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 5b607e55636ea..5d17be0c34a7d 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -7314,7 +7314,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b sp -= n; - if (virtual_ && cmethod && sp [0]->opcode == OP_TYPED_OBJREF) { + if (virtual_ && cmethod && sp [0] && sp [0]->opcode == OP_TYPED_OBJREF) { ERROR_DECL (error); MonoMethod *new_cmethod = mono_class_get_virtual_method (sp [0]->klass, cmethod, error); From aa219d8aa2a03726e02a643cf8b36fec13d2d484 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 20 Aug 2021 10:23:11 +0200 Subject: [PATCH 8/9] Update dependencies from https://github.com/dotnet/icu build 20210819.2 (#57764) Microsoft.NETCore.Runtime.ICU.Transport From Version 6.0.0-rc.1.21416.1 -> To Version 6.0.0-rc.2.21419.2 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bc87a4d8fe441..36b4e3e7097c4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/icu - 05dbba88d0ae799b4fea1e13c69b0c02beb7dcbe + 2e5cc6f3c87a83cba41a5784840d8bbe198e3a45 https://github.com/dotnet/msquic diff --git a/eng/Versions.props b/eng/Versions.props index 7e1084207bf04..948437f175f11 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -172,7 +172,7 @@ 6.0.100-preview.6.21418.3 $(MicrosoftNETILLinkTasksVersion) - 6.0.0-rc.1.21416.1 + 6.0.0-rc.2.21419.2 6.0.0-preview.7.21417.1 From 1393ea8b00ed62025f2d0f7a4862f38abe8b73f2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 20 Aug 2021 10:29:28 +0200 Subject: [PATCH 9/9] Update dependencies from https://github.com/mono/linker build 20210819.1 (#57765) Microsoft.NET.ILLink.Tasks From Version 6.0.100-preview.6.21418.3 -> To Version 6.0.100-preview.6.21419.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 36b4e3e7097c4..6233de03c5d7f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -190,9 +190,9 @@ https://github.com/dotnet/runtime fde6b37e985605d862c070256de7c97e2a3f3342 - + https://github.com/mono/linker - 5b2391c2c56af47350a5789375e8dbddc692e67f + 5851f6d62fedd9eb2edea9712c9764ca2ad6ab60 https://github.com/dotnet/xharness diff --git a/eng/Versions.props b/eng/Versions.props index 948437f175f11..e165bb5ad1494 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -169,7 +169,7 @@ 5.0.0-preview-20201009.2 - 6.0.100-preview.6.21418.3 + 6.0.100-preview.6.21419.1 $(MicrosoftNETILLinkTasksVersion) 6.0.0-rc.2.21419.2