Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordotnet-bot <dotnet-bot@microsoft.com>2022-03-10 23:38:25 +0300
committerdotnet-bot <dotnet-bot@microsoft.com>2022-03-10 23:38:25 +0300
commit1188f73dd084e399c71cfb2eee68af0411e319bd (patch)
treef5d5e5819f15c09933a51a51074c5842c9861ab3
parent666e597dadddccc4c7e81c68099e7db2d606f2ee (diff)
parentbcd6042846b25b233d259ce03dff9023cc4987ef (diff)
Merge in 'release/6.0' changes
-rw-r--r--src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs5
-rw-r--r--src/mono/mono/eglib/CMakeLists.txt4
-rw-r--r--src/mono/mono/eglib/eglib-remap.h4
-rw-r--r--src/mono/mono/eglib/gclock-nanosleep.c31
-rw-r--r--src/mono/mono/eglib/gdate-unix.c2
-rw-r--r--src/mono/mono/eglib/glib.h10
-rw-r--r--src/mono/mono/metadata/class-setup-vtable.c6
-rw-r--r--src/mono/mono/mini/mini-amd64.c2
-rw-r--r--src/mono/mono/mini/mini-arm64.c2
-rw-r--r--src/mono/mono/mini/mini-posix.c5
-rw-r--r--src/mono/mono/mini/mini-s390x.c4
-rw-r--r--src/mono/mono/utils/mono-threads.c3
-rw-r--r--src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs81
-rw-r--r--src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.csproj9
14 files changed, 152 insertions, 16 deletions
diff --git a/src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs b/src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs
index 39a0d67f202..cf55076dfbb 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs
@@ -24,11 +24,6 @@ internal static partial class Interop
//Call ssl specific initializer
Ssl.EnsureLibSslInitialized();
- if (Interop.Crypto.ErrPeekLastError() != 0)
- {
- // It is going to be wrapped in a type load exception but will have the error information
- throw Interop.Crypto.CreateOpenSslCryptographicException();
- }
}
#endif
diff --git a/src/mono/mono/eglib/CMakeLists.txt b/src/mono/mono/eglib/CMakeLists.txt
index 1325ee6c112..69bf7e18869 100644
--- a/src/mono/mono/eglib/CMakeLists.txt
+++ b/src/mono/mono/eglib/CMakeLists.txt
@@ -43,6 +43,10 @@ set(eglib_common_sources
gunicode.c
unicode-data.h)
+if(HAVE_CLOCK_NANOSLEEP)
+list(APPEND eglib_common_sources gclock-nanosleep.c)
+endif()
+
addprefix(eglib_sources ../eglib/ "${eglib_platform_sources};${eglib_common_sources}")
add_library(eglib_objects OBJECT "${eglib_sources}")
diff --git a/src/mono/mono/eglib/eglib-remap.h b/src/mono/mono/eglib/eglib-remap.h
index c3e956842de..3af646a8e47 100644
--- a/src/mono/mono/eglib/eglib-remap.h
+++ b/src/mono/mono/eglib/eglib-remap.h
@@ -318,3 +318,7 @@
#define g_ascii_charcmp monoeg_ascii_charcmp
#define g_ascii_charcasecmp monoeg_ascii_charcasecmp
#define g_warning_d monoeg_warning_d
+
+#ifdef HAVE_CLOCK_NANOSLEEP
+#define g_clock_nanosleep monoeg_clock_nanosleep
+#endif
diff --git a/src/mono/mono/eglib/gclock-nanosleep.c b/src/mono/mono/eglib/gclock-nanosleep.c
new file mode 100644
index 00000000000..f2ced8b2c07
--- /dev/null
+++ b/src/mono/mono/eglib/gclock-nanosleep.c
@@ -0,0 +1,31 @@
+/*
+ * gclock_nanosleep.c: Clock nanosleep on platforms that have clock_nanosleep().
+ *
+ * Copyright 2022 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+
+#include <config.h>
+#include <glib.h>
+#include <errno.h>
+
+gint
+g_clock_nanosleep (clockid_t clockid, gint flags, const struct timespec *request, struct timespec *remain)
+{
+ gint ret = 0;
+
+#if defined(HAVE_CLOCK_NANOSLEEP) && !defined(__PASE__)
+ ret = clock_nanosleep (clockid, flags, request, remain);
+#else
+ g_assert_not_reached ();
+#endif
+
+#ifdef HOST_ANDROID
+ // Workaround for incorrect implementation of clock_nanosleep return value on old Android (<=5.1)
+ // See https://github.com/xamarin/xamarin-android/issues/6600
+ if (ret == -1)
+ ret = errno;
+#endif
+
+ return ret;
+}
diff --git a/src/mono/mono/eglib/gdate-unix.c b/src/mono/mono/eglib/gdate-unix.c
index 53f4bbb3d5a..9a98e663045 100644
--- a/src/mono/mono/eglib/gdate-unix.c
+++ b/src/mono/mono/eglib/gdate-unix.c
@@ -64,7 +64,7 @@ g_usleep (gulong microseconds)
}
do {
- ret = clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &target, NULL);
+ ret = g_clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &target, NULL);
if (ret != 0 && ret != EINTR)
g_error ("%s: clock_nanosleep () returned %d", __func__, ret);
} while (ret == EINTR);
diff --git a/src/mono/mono/eglib/glib.h b/src/mono/mono/eglib/glib.h
index 5a454a03720..4c08f44732e 100644
--- a/src/mono/mono/eglib/glib.h
+++ b/src/mono/mono/eglib/glib.h
@@ -27,6 +27,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <eglib-config.h>
+#include <time.h>
// - Pointers should only be converted to or from pointer-sized integers.
// - Any size integer can be converted to any other size integer.
@@ -1508,4 +1509,13 @@ mono_qsort (void* base, size_t num, size_t size, int (*compare)(const void*, con
#define g_try_realloc(obj, size) (g_cast (monoeg_try_realloc ((obj), (size))))
#define g_memdup(mem, size) (g_cast (monoeg_g_memdup ((mem), (size))))
+/*
+ * Clock Nanosleep
+ */
+
+#ifdef HAVE_CLOCK_NANOSLEEP
+gint
+g_clock_nanosleep (clockid_t clockid, gint flags, const struct timespec *request, struct timespec *remain);
+#endif
+
#endif // __GLIB_H
diff --git a/src/mono/mono/metadata/class-setup-vtable.c b/src/mono/mono/metadata/class-setup-vtable.c
index ae1727efa0b..bbd6b6a2f2c 100644
--- a/src/mono/mono/metadata/class-setup-vtable.c
+++ b/src/mono/mono/metadata/class-setup-vtable.c
@@ -1742,11 +1742,11 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
for (int i = 0; i < iface_onum; i++) {
MonoMethod *decl = iface_overrides [i*2];
MonoMethod *override = iface_overrides [i*2 + 1];
- if (decl->is_inflated) {
+ if (mono_class_is_gtd (override->klass)) {
+ override = mono_class_inflate_generic_method_full_checked (override, ic, mono_class_get_context (ic), error);
+ } else if (decl->is_inflated) {
override = mono_class_inflate_generic_method_checked (override, mono_method_get_context (decl), error);
mono_error_assert_ok (error);
- } else if (mono_class_is_gtd (override->klass)) {
- override = mono_class_inflate_generic_method_full_checked (override, ic, mono_class_get_context (ic), error);
}
if (!apply_override (klass, ic, vtable, decl, override, &override_map, &override_class_map, &conflict_map))
goto fail;
diff --git a/src/mono/mono/mini/mini-amd64.c b/src/mono/mono/mini/mini-amd64.c
index 87c0b175ee6..4bcbcd9caa9 100644
--- a/src/mono/mono/mini/mini-amd64.c
+++ b/src/mono/mono/mini/mini-amd64.c
@@ -6010,9 +6010,9 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, FALSE);
break;
case OP_FCONV_TO_I4:
- case OP_FCONV_TO_I:
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE);
break;
+ case OP_FCONV_TO_I:
case OP_FCONV_TO_I8:
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 8, TRUE);
break;
diff --git a/src/mono/mono/mini/mini-arm64.c b/src/mono/mono/mini/mini-arm64.c
index a868facb7ff..9231ca72bcd 100644
--- a/src/mono/mono/mini/mini-arm64.c
+++ b/src/mono/mono/mini/mini-arm64.c
@@ -4225,7 +4225,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
arm_uxthw (code, dreg, dreg);
break;
case OP_FCONV_TO_I4:
- case OP_FCONV_TO_I:
arm_fcvtzs_dx (code, dreg, sreg1);
arm_sxtwx (code, dreg, dreg);
break;
@@ -4233,6 +4232,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
arm_fcvtzu_dx (code, dreg, sreg1);
break;
case OP_FCONV_TO_I8:
+ case OP_FCONV_TO_I:
arm_fcvtzs_dx (code, dreg, sreg1);
break;
case OP_FCONV_TO_U8:
diff --git a/src/mono/mono/mini/mini-posix.c b/src/mono/mono/mini/mini-posix.c
index 346b4bd43f2..79bf8c84f88 100644
--- a/src/mono/mono/mini/mini-posix.c
+++ b/src/mono/mono/mini/mini-posix.c
@@ -79,6 +79,7 @@
#include <mono/component/debugger-agent.h>
#include "mini-runtime.h"
#include "jit-icalls.h"
+#include <glib.h>
#ifdef HOST_DARWIN
#include <mach/mach.h>
@@ -530,7 +531,7 @@ clock_init_for_profiler (MonoProfilerSampleMode mode)
* CLOCK_PROCESS_CPUTIME_ID clock but don't actually support it. For
* those systems, we fall back to CLOCK_MONOTONIC if we get EINVAL.
*/
- if (clock_nanosleep (CLOCK_PROCESS_CPUTIME_ID, TIMER_ABSTIME, &ts, NULL) != EINVAL) {
+ if (g_clock_nanosleep (CLOCK_PROCESS_CPUTIME_ID, TIMER_ABSTIME, &ts, NULL) != EINVAL) {
sampling_clock = CLOCK_PROCESS_CPUTIME_ID;
break;
}
@@ -554,7 +555,7 @@ clock_sleep_ns_abs (guint64 ns_abs)
then.tv_nsec = ns_abs % 1000000000;
do {
- ret = clock_nanosleep (sampling_clock, TIMER_ABSTIME, &then, NULL);
+ ret = g_clock_nanosleep (sampling_clock, TIMER_ABSTIME, &then, NULL);
if (ret != 0 && ret != EINTR)
g_error ("%s: clock_nanosleep () returned %d", __func__, ret);
diff --git a/src/mono/mono/mini/mini-s390x.c b/src/mono/mono/mini/mini-s390x.c
index 1c4789750f0..3414f6bea2c 100644
--- a/src/mono/mono/mini/mini-s390x.c
+++ b/src/mono/mono/mini/mini-s390x.c
@@ -4282,7 +4282,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
break;
case OP_FCONV_TO_I4:
- case OP_FCONV_TO_I:
s390_cfdbr (code, ins->dreg, 5, ins->sreg1);
break;
case OP_FCONV_TO_U4:
@@ -4293,6 +4292,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
break;
case OP_FCONV_TO_I8:
+ case OP_FCONV_TO_I:
s390_cgdbr (code, ins->dreg, 5, ins->sreg1);
break;
case OP_FCONV_TO_U8:
@@ -4337,7 +4337,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
break;
case OP_RCONV_TO_I4:
- case OP_RCONV_TO_I:
s390_cfebr (code, ins->dreg, 5, ins->sreg1);
break;
case OP_RCONV_TO_U4:
@@ -4348,6 +4347,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
break;
case OP_RCONV_TO_I8:
+ case OP_RCONV_TO_I:
s390_cgebr (code, ins->dreg, 5, ins->sreg1);
break;
case OP_RCONV_TO_U8:
diff --git a/src/mono/mono/utils/mono-threads.c b/src/mono/mono/utils/mono-threads.c
index 52890fe288e..e26cc53e02c 100644
--- a/src/mono/mono/utils/mono-threads.c
+++ b/src/mono/mono/utils/mono-threads.c
@@ -33,6 +33,7 @@
#include <mono/utils/mono-threads-debug.h>
#include <mono/utils/os-event.h>
#include <mono/utils/w32api.h>
+#include <glib.h>
#include <errno.h>
#include <mono/utils/mono-errno.h>
@@ -1743,7 +1744,7 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted)
}
do {
- ret = clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &target, NULL);
+ ret = g_clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &target, NULL);
} while (ret != 0);
#elif HOST_WIN32
Sleep (ms);
diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs
new file mode 100644
index 00000000000..ae083691773
--- /dev/null
+++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs
@@ -0,0 +1,81 @@
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+
+// In GH issue 61244 the mono runtime aborted when inflating the default
+// interface method because the context used was from the base interface.
+
+// The OneArgBaseInterface portion of this test handles the original bug
+// where the base interface has less generic arguments than the derived
+// interface and the runtime aborts.
+
+// The SecondInterface portion of this test handles an additional scenario
+// where the number of generic arguments are the same in the base and
+// derived interface contexts, but the order is changed (or different.)
+// When this occurs the generic info is incorrect for the inflated method.
+
+class Program
+{
+ static int Main(string[] args)
+ {
+ return new TestClass().DoTest();
+ }
+}
+
+public interface OneArgBaseInterface<T1>
+{
+ int SomeFunc1(T1 someParam1, Type someParam1Type);
+}
+
+public interface TwoArgBaseInterface<T1, T2>
+{
+ int SomeFunc1(T1 someParam1, T2 someParam2, Type someParam1Type, Type someParam2Type);
+}
+
+public interface SecondInterface<TParam2Type, TParam1Type> : OneArgBaseInterface<TParam1Type>, TwoArgBaseInterface<TParam1Type, TParam2Type>
+{
+ int OneArgBaseInterface<TParam1Type>.SomeFunc1(TParam1Type someParam1, Type someParam1Type)
+ {
+ if (typeof(TParam1Type) != someParam1Type)
+ {
+ Console.WriteLine("Failed => 101");
+ return 101;
+ }
+
+ return 100;
+ }
+
+ int TwoArgBaseInterface<TParam1Type, TParam2Type>.SomeFunc1(TParam1Type someParam1, TParam2Type someParam2, Type someParam1Type, Type someParam2Type)
+ {
+ if (typeof(TParam1Type) != someParam1Type)
+ {
+ Console.WriteLine("Failed => 102");
+ return 102;
+ }
+
+ if (typeof(TParam2Type) != someParam2Type)
+ {
+ Console.WriteLine("Failed => 103");
+ return 103;
+ }
+
+ return 100;
+ }
+}
+
+public class TestClass : SecondInterface<int, string>
+{
+ public int DoTest ()
+ {
+ int ret = (this as OneArgBaseInterface<string>).SomeFunc1("test string", typeof(string));
+ if (ret != 100)
+ return ret;
+
+ ret = (this as TwoArgBaseInterface<string, int>).SomeFunc1("test string", 0, typeof(string), typeof(int));
+ if (ret != 100)
+ return ret;
+
+ Console.WriteLine("Passed => 100");
+ return 100;
+ }
+} \ No newline at end of file
diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.csproj
new file mode 100644
index 00000000000..42c7a9e8ffc
--- /dev/null
+++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.csproj
@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <OutputType>Exe</OutputType>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).cs" />
+ </ItemGroup>
+</Project>