Merge branch 'upstream'

Former-commit-id: b856f24690af8095efac2561fafe23a0cd68e7c1
This commit is contained in:
Xamarin Public Jenkins (auto-signing) 2019-02-09 08:28:46 +00:00
commit 9061ce6ff2
53 changed files with 160 additions and 104 deletions

View File

@ -1 +1 @@
42d9284971bf51d3e040505f0c7b9b308011035b
614e386f452de288ad25cf8bcc6cc8c52895725e

View File

@ -1 +1 @@
b23890c3e29672d68a1fe844443ac09ff25a2ac9
a6e1aaf149f62742bb8957ffa3a03529a6b46dbe

View File

@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
public const string MonoVersion = "5.20.0.191";
public const string MonoVersion = "5.20.0.197";
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";

View File

@ -277,11 +277,24 @@ namespace System.Reflection.Emit {
return System.Text.Encoding.UTF8.GetString(data, pos, len);
}
internal static string decode_string (byte [] data, int pos, out int rpos)
{
if (data [pos] == 0xff) {
rpos = pos + 1;
return null;
} else {
int len = decode_len (data, pos, out pos);
string s = string_from_bytes (data, pos, len);
pos += len;
rpos = pos;
return s;
}
}
internal string string_arg ()
{
int pos = 2;
int len = decode_len (data, pos, out pos);
return string_from_bytes (data, pos, len);
return decode_string (data, pos, out pos);
}
internal static UnmanagedMarshal get_umarshal (CustomAttributeBuilder customBuilder, bool is_field) {
@ -309,18 +322,14 @@ namespace System.Reflection.Emit {
int paramType; // What is this ?
/* Skip field/property signature */
pos ++;
int fieldPropSig = (int)data [pos ++];
/* Read type */
paramType = ((int)data [pos++]);
if (paramType == 0x55) {
/* enums, the value is preceeded by the type */
int len2 = decode_len (data, pos, out pos);
string_from_bytes (data, pos, len2);
pos += len2;
decode_string (data, pos, out pos);
}
int len = decode_len (data, pos, out pos);
string named_name = string_from_bytes (data, pos, len);
pos += len;
string named_name = decode_string (data, pos, out pos);
switch (named_name) {
case "ArraySubType":
@ -349,9 +358,7 @@ namespace System.Reflection.Emit {
pos += 4;
break;
case "SafeArrayUserDefinedSubType":
len = decode_len (data, pos, out pos);
string_from_bytes (data, pos, len);
pos += len;
decode_string (data, pos, out pos);
break;
case "SizeParamIndex":
value = (int)data [pos++];
@ -360,20 +367,15 @@ namespace System.Reflection.Emit {
hasSize = true;
break;
case "MarshalType":
len = decode_len (data, pos, out pos);
marshalTypeName = string_from_bytes (data, pos, len);
pos += len;
marshalTypeName = decode_string (data, pos, out pos);
break;
case "MarshalTypeRef":
len = decode_len (data, pos, out pos);
marshalTypeName = string_from_bytes (data, pos, len);
marshalTypeRef = Type.GetType (marshalTypeName);
pos += len;
marshalTypeName = decode_string (data, pos, out pos);
if (marshalTypeName != null)
marshalTypeRef = Type.GetType (marshalTypeName);
break;
case "MarshalCookie":
len = decode_len (data, pos, out pos);
marshalCookie = string_from_bytes (data, pos, len);
pos += len;
marshalCookie = decode_string (data, pos, out pos);
break;
default:
throw new Exception ("Unknown MarshalAsAttribute field: " + named_name);

View File

@ -9,6 +9,7 @@ using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
using System.Runtime.InteropServices;
using NUnit.Framework;
namespace MonoTests.System.Reflection.Emit
@ -845,6 +846,59 @@ namespace MonoTests.System.Reflection.Emit
assemblyBuilder1.Save ("Repro55681-2a.dll");
}
[DllImport("SomeLib")]
private static extern void MethodForNullStringMarshalAsFields([MarshalAs(UnmanagedType.LPWStr)] string param);
[Test]
public void NullStringMarshalAsFields () {
// Regression test for https://github.com/mono/mono/issues/12747
//
// MarshalAsAttribute goes through
// CustomAttributeBuilder.get_umarshal which tries to
// build an UnmanagedMarshal value by decoding the CAB's data.
//
// The data decoding needs to handle null string (encoded as 0xFF) properly.
var aName = new AssemblyName("Repro12747");
var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.RunAndSave, tempDir);
var module = assembly.DefineDynamicModule(aName.Name, aName.Name + ".dll");
var prototypeMethodName = nameof(MethodForNullStringMarshalAsFields);
var someMethod = this.GetType().GetMethod(prototypeMethodName, BindingFlags.Static | BindingFlags.NonPublic);
var typeBuilder = module.DefineType("NewType" + module.ToString(), TypeAttributes.Class | TypeAttributes.Public);
var methodBuilder = typeBuilder.DefineMethod("NewMethod", MethodAttributes.Public | MethodAttributes.HideBySig, typeof(void), new[] { typeof(string) });
var il = methodBuilder.GetILGenerator();
il.Emit(OpCodes.Ret);
var param = someMethod.GetParameters()[0];
var paramBuilder = methodBuilder.DefineParameter(1, param.Attributes, null);
MarshalAsAttribute attr = param.GetCustomAttribute<MarshalAsAttribute>();
var attrCtor = typeof(MarshalAsAttribute).GetConstructor(new[] { typeof(UnmanagedType) });
object[] attrCtorArgs = { attr.Value };
// copy over the fields from the real MarshalAsAttribute on the parameter of "MethodForNullStringMarshalAsFields",
// including the ones that were initialized to null
var srcFields = typeof(MarshalAsAttribute).GetFields(BindingFlags.Public | BindingFlags.Instance);
var fieldArguments = new FieldInfo[srcFields.Length];
var fieldArgumentValues = new object[srcFields.Length];
for(int i = 0; i < srcFields.Length; i++)
{
var field = srcFields[i];
fieldArguments[i] = field;
fieldArgumentValues[i] = field.GetValue(attr);
}
var attrBuilder = new CustomAttributeBuilder(attrCtor, attrCtorArgs, Array.Empty<PropertyInfo>(), Array.Empty<object>(),
fieldArguments, fieldArgumentValues);
// this encodes the CustomAttributeBuilder as a data
// blob and then tries to decode it using
// CustomAttributeBuilder.get_umarshal
paramBuilder.SetCustomAttribute(attrBuilder);
var finalType = typeBuilder.CreateType();
}
}
}

View File

@ -1 +1 @@
798ab98b275858de38ea9093f694ac55c9a86318
383ae3ef9dd1b2c400ec51ee81f2076d5153746c

View File

@ -1 +1 @@
807ee298114e63cab56ac11f23f724b64361593e
11edb02350ed75b55fc884159ac11000eb956a3a

View File

@ -1 +1 @@
d16a9e3f8d92c7681eb5e092d7df6b513c4d44ab
1bd22293b7b92de83e22d39e1ff97fa286c884e3

View File

@ -1 +1 @@
4be30bfda39da9a2ecdc34470e4665c753304cb5
1cb06e425be41ed94546d04d837e9432db750448

View File

@ -1 +1 @@
8e522da568214f396478998d70a9137bedfc4bd4
adc618f49511118ee5f21252b88d3949f71dfcde

View File

@ -1 +1 @@
c5f9829e33f69207ea8aac86b8ec8e2b64ff87b9
9e2aafee7d31e49a01f1502aa00b67c1a1904fb0

View File

@ -1 +1 @@
eabd0a96a209dae105d82f03d3f1030ea31917f9
fbd3f505c8886e1d95a5a83c8e1d0976059a4233

View File

@ -1 +1 @@
cd9d8e97314061d17467eb14aeda7610bc40a15d
d61f67c1b8380fb0ee08877aa66ef1ea23aca853

View File

@ -1 +1 @@
807ee298114e63cab56ac11f23f724b64361593e
11edb02350ed75b55fc884159ac11000eb956a3a

View File

@ -1 +1 @@
d16a9e3f8d92c7681eb5e092d7df6b513c4d44ab
1bd22293b7b92de83e22d39e1ff97fa286c884e3

View File

@ -1 +1 @@
4be30bfda39da9a2ecdc34470e4665c753304cb5
1cb06e425be41ed94546d04d837e9432db750448

View File

@ -1 +1 @@
8e522da568214f396478998d70a9137bedfc4bd4
adc618f49511118ee5f21252b88d3949f71dfcde

View File

@ -1 +1 @@
c5f9829e33f69207ea8aac86b8ec8e2b64ff87b9
9e2aafee7d31e49a01f1502aa00b67c1a1904fb0

View File

@ -1 +1 @@
eabd0a96a209dae105d82f03d3f1030ea31917f9
fbd3f505c8886e1d95a5a83c8e1d0976059a4233

View File

@ -1 +1 @@
cd9d8e97314061d17467eb14aeda7610bc40a15d
d61f67c1b8380fb0ee08877aa66ef1ea23aca853

View File

@ -1 +1 @@
807ee298114e63cab56ac11f23f724b64361593e
11edb02350ed75b55fc884159ac11000eb956a3a

View File

@ -1 +1 @@
d16a9e3f8d92c7681eb5e092d7df6b513c4d44ab
1bd22293b7b92de83e22d39e1ff97fa286c884e3

View File

@ -1 +1 @@
4be30bfda39da9a2ecdc34470e4665c753304cb5
1cb06e425be41ed94546d04d837e9432db750448

View File

@ -1 +1 @@
8e522da568214f396478998d70a9137bedfc4bd4
adc618f49511118ee5f21252b88d3949f71dfcde

View File

@ -1 +1 @@
c5f9829e33f69207ea8aac86b8ec8e2b64ff87b9
9e2aafee7d31e49a01f1502aa00b67c1a1904fb0

View File

@ -1 +1 @@
eabd0a96a209dae105d82f03d3f1030ea31917f9
fbd3f505c8886e1d95a5a83c8e1d0976059a4233

View File

@ -1 +1 @@
cd9d8e97314061d17467eb14aeda7610bc40a15d
d61f67c1b8380fb0ee08877aa66ef1ea23aca853

View File

@ -1 +1 @@
807ee298114e63cab56ac11f23f724b64361593e
11edb02350ed75b55fc884159ac11000eb956a3a

View File

@ -1 +1 @@
d16a9e3f8d92c7681eb5e092d7df6b513c4d44ab
1bd22293b7b92de83e22d39e1ff97fa286c884e3

View File

@ -1 +1 @@
4be30bfda39da9a2ecdc34470e4665c753304cb5
1cb06e425be41ed94546d04d837e9432db750448

View File

@ -1 +1 @@
8e522da568214f396478998d70a9137bedfc4bd4
adc618f49511118ee5f21252b88d3949f71dfcde

View File

@ -1 +1 @@
c5f9829e33f69207ea8aac86b8ec8e2b64ff87b9
9e2aafee7d31e49a01f1502aa00b67c1a1904fb0

View File

@ -1 +1 @@
eabd0a96a209dae105d82f03d3f1030ea31917f9
fbd3f505c8886e1d95a5a83c8e1d0976059a4233

View File

@ -1 +1 @@
cd9d8e97314061d17467eb14aeda7610bc40a15d
d61f67c1b8380fb0ee08877aa66ef1ea23aca853

View File

@ -1 +1 @@
d5e52bc3fb391f69b506b5747e78c7ac14d0d127
b933f2b6dd48b23198ed8860a0a6cc6573d9d16c

View File

@ -281,7 +281,7 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
src [0] |= (arg_size << 22);
/* Encode the offset inside the stack slot */
src [0] |= ((ainfo->offset % 8) << 26);
if (ainfo2->storage == ArgOnStack)
if (ainfo2->storage == ArgOnStack || ainfo2->storage == ArgOnStackR4)
dst [0] |= ((ainfo2->offset % 8) << 26);
} else if (ainfo2->storage == ArgOnStack && ainfo2->slot_size != 8) {
/* The caller passes in an address, need to store it into a stack slot */

View File

@ -1 +1 @@
#define FULL_VERSION "explicit/d3ebbdc"
#define FULL_VERSION "explicit/a13ca00"

View File

@ -127,7 +127,7 @@ class C
}
}
static string configDir = "./";
static string configDir = "./merp-crash-test/";
public static void
CrashWithMerp (int testNum)
@ -161,7 +161,7 @@ class C
}
public static void
TestValidateAndCleanup (string configDir, bool silent)
TestValidate (string configDir, bool silent)
{
DumpLogCheck ();
@ -181,7 +181,7 @@ class C
Console.WriteLine ("Xml file {0}", text);
File.Delete (xmlFilePath);
} else {
Console.WriteLine ("Xml file missing");
Console.WriteLine ("Xml file {0} missing", xmlFilePath);
}
if (paramsFileExists) {
@ -190,7 +190,7 @@ class C
Console.WriteLine ("Params file {0}", text);
File.Delete (paramsFilePath);
} else {
Console.WriteLine ("Params file missing");
Console.WriteLine ("Params file {0} missing", paramsFilePath);
}
if (crashFileExists) {
@ -211,7 +211,7 @@ class C
File.Delete (crashFilePath);
// Assert it has the required merp fields
} else {
Console.WriteLine ("Crash file missing");
Console.WriteLine ("Crash file {0} missing", crashFilePath);
}
if (!xmlFileExists)
@ -227,24 +227,7 @@ class C
public static void
Cleanup (string configDir)
{
var xmlFilePath = String.Format("{0}CustomLogsMetadata.xml", configDir);
var paramsFilePath = String.Format("{0}MERP.uploadparams.txt", configDir);
var crashFilePath = String.Format("{0}lastcrashlog.txt", configDir);
// Fixme: Maybe parse these json files rather than
// just checking they exist
var xmlFileExists = File.Exists (xmlFilePath);
var paramsFileExists = File.Exists (paramsFilePath);
var crashFileExists = File.Exists (crashFilePath);
if (xmlFileExists)
File.Delete (xmlFilePath);
if (paramsFileExists)
File.Delete (paramsFilePath);
if (crashFileExists)
File.Delete (crashFilePath);
Directory.Delete (configDir, true);
}
static void DumpLogSet ()
@ -287,13 +270,26 @@ class C
pi.Arguments = String.Format ("{0} {1}", asm, testNum);;
pi.Environment ["MONO_PATH"] = env;
if (!silent)
if (!silent) {
Console.WriteLine ("Running {0}", CrasherClass.Crashers [testNum].Item1);
Console.WriteLine ("MONO_PATH={0} {1} {2} {3}", env, runtime, asm, testNum);
}
var process = Diag.Process.Start (pi);
process.WaitForExit ();
if (Directory.Exists (configDir)) {
Console.WriteLine ("Cleaning up left over configDir {0}", configDir);
Cleanup (configDir);
}
TestValidateAndCleanup (configDir, silent);
Directory.CreateDirectory (configDir);
try {
var process = Diag.Process.Start (pi);
process.WaitForExit ();
TestValidate (configDir, silent);
} finally {
Cleanup (configDir);
}
}
public static void Main (string [] args)
@ -350,7 +346,6 @@ class C
SpawnCrashingRuntime (processExe, CrasherClass.StresserIndex, true);
} catch (Exception e) {
Console.WriteLine ("Stress test caught failure. Shutting down after {1} iterations.\n {0} \n\n", e.InnerException, iter);
Cleanup (configDir);
throw;
}
}

View File

@ -19,7 +19,7 @@ class C
}
public static void
JsonValidateMerp ()
JsonValidateMerp (string configDir)
{
var monoType = Type.GetType ("Mono.Runtime", false);
var m = monoType.GetMethod("EnableMicrosoftTelemetry", BindingFlags.NonPublic | BindingFlags.Static);
@ -32,7 +32,6 @@ class C
var appVersion = "123456";
var eventType = "AppleAppCrash";
var appPath = "/where/mono/lives";
var configDir = "./";
var m_params = new object[] { appBundleId, appSignature, appVersion, merpGUIPath, eventType, appPath, configDir };
@ -63,8 +62,6 @@ class C
var paramsFilePath = String.Format("{0}MERP.uploadparams.txt", configDir);
var crashFilePath = String.Format("{0}lastcrashlog.txt", configDir);
// Fixme: Maybe parse these json files rather than
// just checking they exist
var xmlFileExists = File.Exists (xmlFilePath);
var paramsFileExists = File.Exists (paramsFilePath);
var crashFileExists = File.Exists (crashFilePath);
@ -81,7 +78,7 @@ class C
if (crashFileExists) {
var crashFile = File.ReadAllText (crashFilePath);
//File.Delete (crashFilePath);
File.Delete (crashFilePath);
var checker = new JavaScriptSerializer ();
@ -103,6 +100,13 @@ class C
public static void Main ()
{
JsonValidateState ();
JsonValidateMerp ();
var configDir = "./merp-json-valid/";
Directory.CreateDirectory (configDir);
try {
JsonValidateMerp (configDir);
} finally {
Directory.Delete (configDir, true);
}
}
}

View File

@ -23,6 +23,7 @@
#include <utils/mono-mmap.h>
#include <utils/strenc.h>
#include <utils/mono-io-portability.h>
#include <utils/mono-logger-internals.h>
#if defined(_POSIX_VERSION)
#ifdef HAVE_SYS_ERRNO_H
@ -1021,7 +1022,7 @@ mono_pe_file_map (gunichar2 *filename, gint32 *map_size, void **handle)
filename_ext = mono_unicode_to_external (filename);
if (filename_ext == NULL) {
g_async_safe_printf ("%s: unicode conversion returned NULL", __func__);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_PROCESS, "%s: unicode conversion returned NULL", __func__);
goto exit;
}
@ -1034,37 +1035,37 @@ mono_pe_file_map (gunichar2 *filename, gint32 *map_size, void **handle)
if (!located_filename) {
errno = saved_errno;
g_async_safe_printf ("%s: Error opening file %s (3): %s", __func__, filename_ext, strerror (errno));
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_PROCESS, "%s: Error opening file %s (3): %s", __func__, filename_ext, strerror (errno));
goto error;
}
fd = open (located_filename, O_RDONLY, 0);
if (fd == -1) {
g_async_safe_printf ("%s: Error opening file %s (3): %s", __func__, filename_ext, strerror (errno));
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_PROCESS, "%s: Error opening file %s (3): %s", __func__, filename_ext, strerror (errno));
goto error;
}
}
else if (fd == -1) {
g_async_safe_printf ("%s: Error opening file %s (3): %s", __func__, filename_ext, strerror (errno));
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_PROCESS, "%s: Error opening file %s (3): %s", __func__, filename_ext, strerror (errno));
goto error;
}
if (fstat (fd, &statbuf) == -1) {
g_async_safe_printf ("%s: Error stat()ing file %s: %s", __func__, filename_ext, strerror (errno));
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_PROCESS, "%s: Error stat()ing file %s: %s", __func__, filename_ext, strerror (errno));
goto error;
}
*map_size = statbuf.st_size;
/* Check basic file size */
if (statbuf.st_size < sizeof(IMAGE_DOS_HEADER)) {
g_async_safe_printf ("%s: File %s is too small: %lld", __func__, filename_ext, (long long) statbuf.st_size);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_PROCESS, "%s: File %s is too small: %lld", __func__, filename_ext, (long long) statbuf.st_size);
goto exit;
}
file_map = mono_file_map (statbuf.st_size, MONO_MMAP_READ | MONO_MMAP_PRIVATE, fd, 0, handle);
if (file_map == NULL) {
g_async_safe_printf ("%s: Error mmap()int file %s: %s", __func__, filename_ext, strerror (errno));
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_PROCESS, "%s: Error mmap()int file %s: %s", __func__, filename_ext, strerror (errno));
goto error;
}
exit:

Binary file not shown.

View File

@ -1 +1 @@
2284578bd1c0e74650e8143a0c06fc482684d458
accd51aba71622210895cf94f264bcdd5ccd941b

Binary file not shown.

View File

@ -1 +1 @@
22f634fa30caa15749381abf8029f74290c5d1ae
9d51c5e362caffa8254005266e691d0f34f38c0e

Binary file not shown.

View File

@ -1 +1 @@
b908c0ae69f33af04cd7d8a7322f4f24247d9cdf
6f33ab318482690b6b44e8f6bae2ecc8b01781ec

View File

@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: mono 5.20.0.191\n"
"Project-Id-Version: mono 5.20.0.197\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
"POT-Creation-Date: 2019-02-08 08:13+0000\n"
"POT-Creation-Date: 2019-02-09 08:06+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

Binary file not shown.

View File

@ -1 +1 @@
c38e3cace33a7f13722f8253915ce71a87fe2ba9
d589f80e59f13b276b3e63357edae720244352fb