Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understand PE32+, at least as much as PE32 is understood. #6503

merged 17 commits into from Jan 23, 2018


None yet
4 participants
Copy link

commented Jan 12, 2018

A number of other problems are noticed in the code but commented only.
This fixes

@jaykrell jaykrell requested review from luhenry and spouliot Jan 12, 2018

@jaykrell jaykrell force-pushed the jaykrell:pe32plus.2 branch 2 times, most recently from 28d7a39 to b52368c Jan 12, 2018

@@ -64,9 +103,23 @@ class AuthenticodeBase {
private int dirSecurityOffset;
private int dirSecuritySize;
private int coffSymbolTableOffset;
private bool pe64 = false;

This comment has been minimized.

Copy link

marek-safar Jan 15, 2018


Redundant initialization

dirSecurityOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 152);
dirSecuritySize = BitConverterLE.ToInt32 (fileblock, peOffset + 156);
if (pe64)

This comment has been minimized.

Copy link

marek-safar Jan 15, 2018


Please follow existing curly braces formatting (more bellow)

// Hash from checksum to security_directory.
hash.TransformBlock (fileblock, pe, 76, fileblock, pe);
// then skip 8 bytes for IMAGE_DIRECTORY_ENTRY_SECURITY
pe += 76;

This comment has been minimized.

Copy link

marek-safar Jan 15, 2018


pe += 76 + 8

@@ -279,6 +290,7 @@ private bool Save (string fileName, byte[] asn)
fs.Write (fillup, 0, fillup.Length);
fs.Write (data, 0, data.Length); // length (again)
// This magic value is documented.

This comment has been minimized.

Copy link

marek-safar Jan 15, 2018


Add a constant instead of comment

public class hashfile
public static void Main(string[] args)

This comment has been minimized.

Copy link

marek-safar Jan 15, 2018


Could you convert it to normal nunit test?

g++ writefiles.cpp -o $@

hashfile.exe: hashfile.cs
mcs hashfile.cs /r:$(NONO_PATH)/mono/4.7.1-api/Mono.Security.dll

This comment has been minimized.

Copy link

marek-safar Jan 15, 2018


The path is odd it should be something like ../../lib/$(PROFILE)/Mono.Security.dll if you move it to Mono.Security Makefile


This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2018

I had a typo NONO vs. MONO but these tests all/mostly fail, is the point. They reject PEs before really validating them, that might be valid, and they have array out of bounds for lack of adequate validation or bad code structure (valid files cause the code to access arrays out of bounds). They show there are more bugs in the code than the reported but describes. Do we have precedent for failing tests?


This comment has been minimized.

Copy link

commented Jan 15, 2018

@jaykrell you can add the unit tests with [Ignore ("Fails due to reason XY")] attribute and it'll not be executed (make sure to file a tracking issue so we don't forget to reenable the test).

Does writefiles.cpp need to be in C++? I think it'd be mostly the same in C# and is preferred in the mcs/ tree.


This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2018

C++ is best for everything, except safety/gc and slight hope for portable executables. I can try to write in unsafe C# instead. There isn't much point in the compilation w/o running but I'll try. The "actual" test was with Writeln and more mainstream file. That is missing here.


This comment has been minimized.

Copy link

commented Jan 15, 2018

@jaykrell no need for unsafe C#, you're just writing some bits to a file so System.IO.BinaryWriter should be enough :)

@jaykrell jaykrell force-pushed the jaykrell:pe32plus.2 branch from ff0311b to 3ec5ebf Jan 16, 2018

Copy link

left a comment

Use C or C# over C++, we don't use the latter in the code base, so please stay consistent with that.

The test can be written entirely in C# and using NUnit, it makes it just work with the whole testing infrastructure, so please refrain yourself from creating a new one when it's not absolutely needed.

If the 4k is an issue for the buffer, can't we use a Stream to get rid of this 4k limit?

@@ -0,0 +1,259 @@
#include <stdio.h>

This comment has been minimized.

Copy link

luhenry Jan 16, 2018


Please rewrite in C or C# (slight preference for the latter).

fs.Write (data, 0, 4);
fs.Seek (filesize, SeekOrigin.Begin);
// align certificate entry to a multiple of 8 bytes
if (addsize > 0) {
byte[] fillup = new byte[addsize];
fs.Write (fillup, 0, fillup.Length);

This comment has been minimized.

Copy link

luhenry Jan 16, 2018


Fix indentation

@luhenry luhenry self-assigned this Jan 16, 2018


This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2018

Any buffering is a problem in terms of easily getting the code correct. The documentation and real code all read the entire file into memory, which makes it easy to make it more correct. Rewriting in C is easy. I didn't realize the ident problem. The tests all fail so writing in something shared is less avilable at the moment. Unless we really want to fix things. The remaining bugs are somewhat obscure so maybe don't matter.


This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2018

Oh the C# was missing one level of indent, ok.

jaykrell added some commits Jan 16, 2018

remove test code that people don't like and it wasn't very useful
wordsmithing and new good information in comments

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2018

review again -- offensive tests deleted (there wasn't the preexisting test I thought there was -- no unit tests at all); edited comments, and added new useful information to the comments.

@luhenry luhenry merged commit c8d6314 into mono:master Jan 23, 2018

14 of 21 checks passed

Linux AArch64 Build finished. 88475 tests run, 1440 skipped, 0 failed.
Linux AArch64 Interpreter Build finished. 11172 tests run, 97 skipped, 0 failed.
Linux ARMv7 Interpreter Build finished. 11155 tests run, 97 skipped, 0 failed.
Linux x64 Acceptance Tests Build finished. 2044 tests run, 6 skipped, 0 failed.
Linux x64 Interpreter Build finished. 11175 tests run, 97 skipped, 0 failed.
Windows i386 Build finished. 83520 tests run, 1145 skipped, 9 failed.
Windows x64 Build finished. 83632 tests run, 1147 skipped, 0 failed.
API Diff No public API changes found.
Linux ARMv5 Build finished. 88323 tests run, 1435 skipped, 0 failed.
Linux ARMv7 Build finished. 88323 tests run, 1435 skipped, 0 failed.
Linux i386 Build finished. 88364 tests run, 1432 skipped, 0 failed.
Linux i386 Coop GC Build finished. 88351 tests run, 1432 skipped, 0 failed.
Linux x64 Build finished. 88480 tests run, 1434 skipped, 0 failed.
Linux x64 Coop GC Build finished. 88467 tests run, 1434 skipped, 0 failed.
Linux x64 FullAOT Build finished. 21728 tests run, 552 skipped, 0 failed.
Linux x64 mcs Build finished.
OS X i386 Build finished. 87526 tests run, 1316 skipped, 0 failed.
OS X x64 Build finished. 87642 tests run, 1318 skipped, 0 failed.
PR Trigger Docs Click to view available PR triggers (Xamarin internal).
Test Result Viewer Click to view aggregated test results (Xamarin internal).
license/cla All CLA requirements met.

addstone added a commit to addstone/mono that referenced this pull request Feb 3, 2018

up (#1)
* [object] mono_string_new should not assert on UTF conversion failures (mono#6333)

Revert the embedding API behavior change introduced by dcdfb3c

mono_string_new will:
 * return NULL if the given byte sequence is not a valid UTF-8 sequence
 * assert if there is not enough memory to allocate a new MonoString.

This only changes the behavior of the API function.  The runtime will continue
to use mono_string_new_checked which sets MonoError* for both sorts of

* [runtime] Add CallContext to the list of cross offset types to fix the cross compiler build. (mono#6337)

* [object] Don't leak glib error in mono_string_new_checked

After we save the UTF8 to UTF16 conversion error to MonoError, free the GError.

* [unit-tests] Fix when Mono is compiled with LLVM

* [ci] Add existing LDFLAGS instead of overwriting

* [unit-tests] A few unit tests for mono_string_new_checked

* [utils] Include jemalloc dir in tarball build (mono#6344)

Fixes mono#6343

* [packaging] Windows: remove FSharp.Core from GAC (mono#6345)

See mono#6295 (comment).

* [mcs] readonly struct this can be reassigned within ctor

* [mcs] Implements 7.2 stackalloc to Span assignment conversion.

* Don't add linker tests to tarball

They contain files with very long names which causes issues with `tar`.

We simply remove them from the dist directory before creating
the tarball since we don't use them in the Mono build anyway.

Fixes mono#6349

* Dist files in groups of 100 entries

On some distros the number of strings you can pass to execve()
is limited which means you get the following error when trying
to create the tarball:

make[5]: execvp: /bin/sh: Argument list too long
make[5]: * [../../build/rules.make:303: dist-default] Error 127

To solve this we split the DISTFILES variable into groups of 100
entries and invoke the shell for each group instead of adding all
into the same invocation. Also removed looking for 'makefile' and
'GNUmakefile' since those don't exist in Mono and simplifies the logic.

Found during investigation of mono#6349

* [sre] Emit a memberref token for fields,methods of a gtd

This can happen when emitting code like:
  class Foo<T> {
    T elt;
    public T getter () {
      return elt;  // ILGenerator.Emit (OpCodes.Ldfld, /*FieldBuilder of Foo::elt*/)

the old incorrect code emitted a fielddef token for Foo::elt, but it should be a
memberref for Foo<!0>::elt.

Likewise, if we have
class Foo<T> {
  public T f () { /*...*/}
  public void g () {
    var x = f (); // ILGenerator.Emit (OpCodes.Call, /* MethodBuilder of Foo::f */)
    /*... */

Fixes mono#6192

the old incorrect code would emit a fieldref token for Foo::f but it should be
a memberref for Foo<!0>::f

* [tests] SRE check that a memberref token is emitted for a gtd

Regression test for mono#6192

* Remove duplicated code by factoring on endian parameter. (mono#6321)

* Remove duplicated code by factoring on endian parameter.

* Force inline to mimic previous.

* fix the forceinline part

* Do not forceinline utf32, we never use it.

* [runtime] Adds System.Numeric remapping. Fixes mono#6339

* [packaging] Add check for cygwin paths on Windows (mono#6364)

We don't want to package these, found a few that needed to be removed/fixed.

* [wasm] Improve docs on how to build/test WebAssembly. Add System and System.Core test suite. Improve dep tracking for bcl test suites.

* [valuetypes] use memcmp in default implementation of Equals for unaligned fields

some architectures (e.g. ARM) do not support reads of unaligned pointers

fixes mono#6320

* [packaging] Remove files from gtksharp package that would overwrite Mono files

I found out that we were packaging e.g. MonoPosixHelper.dll from
the gtksharp msi instead of the one we build in Mono :P

This only happened in the x86 build because we don't package
gtksharp in the x64 build.

* The only call to mono_string_to_utf8_mp is in the file that implements it -- object.c. (mono#6377)

So remove it from any header, even an internal one, and make it static.

* [mcs] Allow calling by-ref types virtual methods which can be devirtualized.

* Add a possibility to use empty X.509 certificates.

Fixes mono#6264.

* [configure] change bug URL (mono#6378)

* Update a few more Bugzilla URLs to GitHub (mono#6381)

Also update the WinForms readme to remove outdated content while at it.

* [packaging] Whitelist vbc command in OSX pkg (mono#6382)

We added vbc in mono@8be2726
but didn't whitelist it in the Mac package.

* Bump gtksharp in bockbuild

* Bump corefx (mono#6119)

* Provide g_utf16_ascii_equal and g_utf16_asciiz_equal for comparing
utf16 to ascii for equality.

g_utf16_ascii_equal takes lengths, which are checked first
and unequal length implies unequal strings, and then no characters are looked at.

"z"" for zero means nul terminated and requires scanning the string.
Still, an equality primitive is often desired vs. inverting inequality.

These can cleanup some code -- extracted from a larger not yet commited PR
that uses it.

* Adds support for nanosecond resolution file information where available (Fixes: 6283) (mono#6307)

* Adds support for nanosecond resolution file information where available.

This patch adds support to the runtime to use the nanosecond
information available on Mac and Linux on `struct stat`.
`stat.st_Xtimespec` strucutre on OSX, and `stat.st_Xtime` and
`stat.st_Xtim.tv_nsec` pair on Linux.

Additionally, this adds support in `Mono.Posix` for MacOS nanosecond stat
data, it already had Linux support before.

* Use ULL here to prevent the computation from overflowing

*     Fix some ThreadPool performance counters. (mono#6118)

* Fix some ThreadPool performance counters.

The bug is that some performance counters are always zero.
Because we do not update them.
This addresses two of them: Work items added and thread count.

There is PerformanceCounter class and you can Increment instances,
however its metadata and some of the implementation is in System.dll.
Most of the code is in native.
ThreadPool is in mscorlib.dll, so can't use System.dll.
A few options exist to address this.
We could move and forward the type. We could duplicate and rename
and possibly subset the type.
Here we add a new icall very specifically for the scenario.

There is slight cost for the icall, and for the atomic increment.
There is an attempt to measure but the results were unclear.

Note that the count of work items is not specifically for QueueUserWorkItem
as one might expect, but also for any async calls.

Fix a little bit of typos.

* Take command lines from command line per PR feedback.

* newline at end of file

* [mini] Allow stind.ref only on object references. (mono#6164)

* [mini] Allow stind.ref only on object references.

* [marshal] stind.ref is invalid for non-reference types

* Bump bockbuild

* [I18N] Add CP737 (Greek) and CP775 (Baltic) (mono#6361)

* [I18N] Add CP737 (Greek) and CP775 (Baltic)


* Bump API snapshot submodule

* [interp] move up rtm assigment so it won't be NULL on potential usage (mono#6390)

THROW_EX expands to a potential usage of `rtm`

* XMLDSIG from .NET Core. (mono#6154)

* [runtime] Fix include paths (mono#6402)

VSCode complains about not finding these.

* Fix a race condition in TcpListenerTest caused by sockets' accept queue not filling instantly when machine is under load

* Replace explicit make invocations with uses of the MAKE variable

* [valuetypes] incorporate review feedback for 77a53f0 (mono#6403)

* [interp] Interp fixes (mono#6334)

* [interp] Check for exception at field address failure

For example if the static constructor throws an exception

* [interp] Run class cctor before allocating objects

Otherwise we could end up throwing TypeInitializationException from the finalizer thread. We do the same with jit (emit_class_init).

* [interp] Check for method access failure when doing a call

* [build] Bump bootstrap mcs dependency for mcs builds

* [PerfCounters] Added "Page File Bytes" which shows VmSwap and made few MacOS counters more accurate

* [System] Improve ApplicationSettingsBase behavior (mono#6272)

* [System] Add unit test for Xamarin-2315

* [System] Use temporary directory for saving settings files

This change modifies the ApplicationSettingsBaseTests so that they
store the settings files in a temporary directory. This reduces
the risk of failed tests because of stale files from previous test
run, or from a build that runs in parallel.

* [System] Improve Settings behavior (Xamarin-15818)

Improve behavior of ApplicationSettingsBase class to match Windows .NET
more closely.
* Implement Upgrade to allow Upgrading of settings
* Make SettingsPropertyValue serialization work for complex objects
* Make Save and Update throw in unimplemented configurations
* Changed Reload to clear PropertyValues so they are reloaded
  and fire PropertyChanged event for all Properties
* Modified Reset to do what Reload used to do.
* Added a backup Type loading for custom SettingsProviders
* don't call SettingsSaving on Reset()

* [System] Fire SettingsSaving event (Xamarin-2315)

When calling ApplicationSettingsBase.Save() the SettingsSaving
event has to be fired.

* [System] Add unit tests for Xamarin-15818

* [scripts] Ignore build output

* [corlib] Fixes ThreadPoolTest test

* [ci] Bump timeout in acceptance-tests

* [msvc] Update csproj files

* [System] Clear XDG_DATA_HOME and XDG_CONFIG_HOME in ApplicationSettingsBase tests (mono#6417)

They were set in mono#6272 but since
env vars are process wide we'd end up with non-existing paths once
the tests are done. It is safer to unset the variables after the test.

* [System] Recursively delete directory in ApplicationSettingsBaseTest

Otherwise we'd get a "directory not empty" exception in the
TestFixtureTearDown (which for some reason isn't shown in the log?).

This was added in mono#6272

* Add initial ERROR_DECL for easier to read history.

* Replace MonoError foo; with ERROR_DECL (foo);

* [interp] fix build when interpreter is disabled (mono#6416)

mini-amd64.c:1103:36: error: incomplete definition of type 'struct _MonoInterpCallbacks'
                        gpointer ret_storage = interp_cb->frame_arg_to_storage ((MonoInterpFrameHandle)frame, sig, -1);
./mini-runtime.h:162:16: note: forward declaration of 'struct _MonoInterpCallbacks'
typedef struct _MonoInterpCallbacks MonoInterpCallbacks;
mini-amd64.c:1103:61: error: use of undeclared identifier 'MonoInterpFrameHandle'
                        gpointer ret_storage = interp_cb->frame_arg_to_storage ((MonoInterpFrameHandle)frame, sig, -1);
mini-amd64.c:1134:12: error: incomplete definition of type 'struct _MonoInterpCallbacks'
                interp_cb->frame_arg_to_data ((MonoInterpFrameHandle)frame, sig, i, storage);
./mini-runtime.h:162:16: note: forward declaration of 'struct _MonoInterpCallbacks'
typedef struct _MonoInterpCallbacks MonoInterpCallbacks;
mini-amd64.c:1134:34: error: use of undeclared identifier 'MonoInterpFrameHandle'
                interp_cb->frame_arg_to_data ((MonoInterpFrameHandle)frame, sig, i, storage);
mini-amd64.c:1214:11: error: incomplete definition of type 'struct _MonoInterpCallbacks'
        interp_cb->data_to_frame_arg ((MonoInterpFrameHandle)frame, sig, -1, storage);
./mini-runtime.h:162:16: note: forward declaration of 'struct _MonoInterpCallbacks'
typedef struct _MonoInterpCallbacks MonoInterpCallbacks;
mini-amd64.c:1214:33: error: use of undeclared identifier 'MonoInterpFrameHandle'
        interp_cb->data_to_frame_arg ((MonoInterpFrameHandle)frame, sig, -1, storage);

* [jit] Convert stores into sign/zero extensions for small ints during alias-analysis. Fixes gh mono#6414. (mono#6440)

* [centrinel] Suppress warning about body of mono_internal_thread_handle_ptr (mono#6432)

Since object-internals.h is included in a ton of places, we get one Centrinel warning
about mono_internal_thread_handle_ptr per translation unit every time the
header is included which is ridiculously noisy.

This commit will suppress the warning about the body of this function.

Note that uses of the function will still get a warning since it returns a
MonoInternalThread* and we haven't yet taught Centrinel that those calls are ok since
the thread object is pinned.

* if MONO missing in Fix some ThreadPool performance counters. (mono#6118) (mono#6434)

* Rename some occurences of "error" to "gerror" so that (mono#6447)

"error" is more often specifically MonoError.

* [profiler] Fixed GCResizeEvent value overflow (mono#6335)

In case application was using more than 2GB of heap memory it started reporting minus values because `emit_value` accepts `int`

* openbsd related patches (mono#6358)

* include netinet/in.h for in_addr_t

* there is no need for an openbsd specific implementation anymore
so you use the generic pthread one

* signal.h is required for sigaltstack

* add missing mono/utils/mono-threads.h include

* there is no malloc.h on OpenBSD either

* sys/socket.h is required for struct sockaddr

* add support for btls on openbsd and default to with_tls=pthread as there is only emultls support which is not enough for mono

* there is no need for pthread_attr_init/destroy anymore

* add -Wl,-zwxneeded to LDFLAGS on OpenBSD

W^X is strictly enforced by default on OpenBSD;
a program can only violate it if it is located on a filesystem mounted
with the wxallowed mount(8) option and has been linked with the
above flag

* return_val_and_set_pending_if_nok macro is missing do/while0. (mono#6396)

* [interp] Add missing param support for floating types in interp_entry (mono#6427)

* [interp] Add missing param support for floating types in interp_entry

Remove some duplicated code

* [interp] Reenable thunks.exe on arm

It fails due to the known RGCTX register clobbering by trampolines.

* Implement a couple of SocketAsyncEventArgs methods

* Fix Windows build

fd32522 didn't change this occurrence of 'error' to 'gerror'.

* Make suggestions in github issue template XML comments

* [metadata] Mark several functions external only (mono#6384)

* [runtime] Mark mono_class_get and mono_class_get_full external only.

   Runtime should use mono_class_get_checked and
   mono_class_get_and_inflate_typespec_checked, respectively.

* [runtime] Mark mono_ldtoken external only

   Runtime should use mono_ldtoken_checked

* [metadata] Mark mono_type_create_from_typespec external only

   Runtime should use mono_type_create_from_typespec_checked

* [runtime] Remove mono_class_inflate_generic_method_full.

   Mark mono_class_inflate_generic_method external only.

   Runtime should use mono_class_inflate_generic_method_full_checked.

* [runtime] Mark mono_get_inflated_method external only

   This function is obsolete.  It should have no callers.

* [metadata] Mark mono_field_from_token external only

   Runtime should use mono_field_from_token_checked

* [runtime] Add MonoError arg to mono_class_get_inflated_method

* [metadata] Mark mono_metadata_parse_method_signature external only

   Runtime should use mono_metadata_parse_method_signature_full

* [metadata] Mark mono_metadata_interfaces_from_typedef as external only.

   Runtime should use mono_metadata_interfaces_from_typedef_full

* [mini] Add MonoError arg to mono_class_get_method_generic

   Also move its declaration from metadata/class-internals.h to mini/mini.h
   since it's defined and used in mini/

* [class] Assert that mono_class_get_inflated_method never returns NULL

* Convert GetCurrentThread to coop/handle. (mono#6437)

* Convert thread get and set priority to coop/handle. (mono#6436)

* Cleanup arm64 OP_SHL_IMM to share code with OP_LSHL_IMM. (mono#6444)

* Fix a typo

* [mini] factor out interp into a library (mono#6419)

* [mini] factor out interp into a library

It enables us to ship the interpreter as an add-on to the runtime.
Embedder can statically link it into their application on demand.


configure mono without the interpreter, such as:

$ ./ --enable-minimal=interpreter ...
$ make; make install

run your favorite program with the interpreter and see it fail:

$ ./mono/mini/mono-sgen --interpreter ./mono/mini/basic.exe
Mono IL interpreter support is missing

despite `--enable-minimal=interpreter`, we can still build the interp

% make -C mono/mini
  CC       interp/libmono_ee_interp_static_la-interp.lo
  CC       interp/libmono_ee_interp_static_la-mintops.lo
  CC       interp/libmono_ee_interp_static_la-transform.lo

`libmono-ee-interp-static.a` can be statically linked into the target

* [fixup] include libmono-ee-interp reference in runtime unit-tests

* Add capability to list more than one method to be verbose, document some internal APIs, update man page with more explanations (mono#6426)

* [w32process] Ensure process_handle is a legal value (mono#6449)

* [w32process] Ensure process_handle is a legal value

Fixes mono#6383

* [w32process] Remove dead code

* mono_string_to_utf32 produces unused data. (mono#6375)

* [System] Set exception on Finish*Failure in SocketAsyncEventArgs (mono#6462)

Follow up to mono#6431, we should
capture the exception that is passed to the methods.

Copied the SetResult() method that referencesource uses.

* Bump corert (mono#6420)

* Bump corert

* Bump API snapshot submodule

* Improve sgen error reporting for assemblies it attempts to process (mono#6463)

Makes it simpler to see what is wrong with an assembly.

* [corlib] Optimizes non-intrinsics version of string indexer code

* [msvc] Update csproj files (mono#6473)

* [coop] Disable failing tests on PR (mono#6472)

* [interp] Allow interp stack to be greater than il stack

* [interp] Add support for ldflda with remoting

Field access for classes like MarshalByRefObject need to go through a wrapper.

* [test] Rename test

There were 2 vararg.exe

* Bump monolite version (mono#6475)

missed in 190d357

* [runtime] Don't auto intern a string just because another domain has done the same.

Previously, we tried to keep the intern status of a string consistent across domains. Meaning
that if you interned "FOO" in domain 0, it would return true for String.IsInterned in domain 1.

This behavior exists in the CLR because the string table is shared between domain as string are
what they call agile objects - those that can exit in multiple domains at the same time.

Mono appdomain isolation doesn't work that way and there's not visible advantage of keeping that property.

The reason for this change is to potentially reduce the amount of interned strings and, more importantly,
reduce the amount of domain lookups, which are quite expensive and unsafe.

This should speed up interning queries.

* Pass TRUE for 'repeat' of send variants. This matches behavior of receive variants. Fixes blocking send call where Win32 returns WSAEWOULDBLOCK. (mono#6453)

Related to issue mono#6464

* Reduce use of mono_marshal_string_to_utf16 which appears (mono#6438)

no longer needed. It remains only for register_icall.

Remove casts from void* to HANDLE, as HANDLE always and forever
will also be void*.

Add comments explaining the valid use of INVALID_HANDLE_VALUE (-1).
With CreateFileMapping, for the file handle, it means to
use physical memory / pagefile.

* mono_string_new_utf32_checked leaks in error path, and produces some unused data. (mono#6374)

* mono_string_new_utf32_checked leaks in error path, and produces
 some unused data.

* assume equivalence of error and null

* line damage

* [sdks] Extract versions into a dedicated file (mono#6474)

* [exception] unprotect whole stack guard if a stack overflow occurs


1. it asks for double faulting scenarios we can't do anything about
   it anyway, exception just unmap yet another page

2. `mprotect(2)` behaves weirdly (at least on macOS) if you try to
   change permissions for subsequent pages with different permissions.
   With the previous code it happened that the requested memory range
   would go from somewhere in the stack guard and overlap into the
   regular, unprotected stack and end up with unpredictable behaviour.
   We could be more careful about it, but it would complicate things
   even more.

* Fix bug 60359

* [eglib] Add g_assertf (mono#6483)

* [runtime] Fix some default interface method problems. (mono#6484)

* [runtime] Allow access to protected default interface methods from classes which implement the interface.

* [interp] Add some automatic conversations between virtual and non-virtual calls that .net has. Fixes

* [bcl] Sort the MethodImpl table in PEAPI.

* [runtime] Enable dim-methodimpl.exe test.

* [runtime] Fix vtable construction tracing.

* [interp] Fix null checks on the receiver when converting virtual calls to non-virtual.

* [Tests] Ensure that tests are runnable on xamarin-macios (mono#5875)

* change messages for some system exceptions (consistency with .net)

* Add System.ServiceModel.Description.UseRequestHeadersForMetadataAddressBehavior. (mono#6508)

* [class] Add Obsolete message to ICSharpCode.SharpZipLib.dll (mono#6511)

* [class] Add Obsolete message to ICSharpCode.SharpZipLib.dll

Users should use the nuget package instead, we'll remove the assembly in Mono 6.0

Don't install it into the 4.7.1 reference assembly directory anymore.

* Bump API snapshot submodule

* [msvc] Update csproj files (mono#6516)

* [mcs] C# 7.2 non-trailing named arguments

* [runtime] Disallow casts between int[] and IList<int?> etc. Fixes mono#6401.

* [tests] Bump timeouts in process-stress-?.exe runtime tests (mono#6515)

* [test-runner] Record test duration in NUnit xml

This allows us to keep track of the time on Jenkins.

Also fix issue where we were recording .Seconds of a TimeSpan instead of .TotalSeconds.

* [tests] Bump timeouts in process-stress-?.exe runtime tests

We're seeing these fail sometimes on Linux Azure VMs, let's try
if bumping the timeouts helps.

* [corlib] Fixes StoppedThreadsThrowThreadStateException test build

* In MonoError, provide a uint32_t for initialization with
just one instruction instead of two (at least it makes
a difference on the Apple arm32 target).

Also favor expressions over statements.

* Support for removing ampersand on MonoError variables and other
preparation for MonoError cleanup (specific use-cases instead
of one error_init).

* Remove ampersands on MonoError variables name "error", but not on the others.

* replace new MonoError with ERROR_DECL

* Replace some "error" with "gerror" so that "error" is more often a MonoError or MonoError*.

* fix ssl-bug on linux

* [corlib] Use Environment.Platform to access the platform, rather than probing the file system (mono#6535)

Alternatve patch to: mono#6533

* [msvc] Update csproj files (mono#6538)

* [profiler] Don't double escape special characters. (mono#6534)

The output of parse_generic_type_names is processed by escape_string_for_xml and
we were double escaping `&` character

* Convert thread get/set/clear state to coop/handle. (mono#6389)

* Coop-handle ves_icall_System_Threading_Thread_GetState, SetState, ClrState.
And cleanup.

* Favor mono_internal_thread_handle_ptr.

* [Tests] Skip some of the System.ServiceModel tests when using MOBILE (mono#6545)

Mobile does not support all clases found in System.ServiceModel, we skip
those tests of the not supported classes yet run all the others.

* [mcs] Implements C# 7.0 discards

* [exception] propagte stackoverflow exception to managed code (mono#6458)

we return the address of the StackOverflowException object in
`restore_soft_guard_pages`, so it ends up in the architecture specific
result register (e.g. %rax) where the exception handler expects it.


* [sgen] Fix overflow on large arrays (mono#6542)

* [exceptions] remove restore_stack_prot from managed code (mono#6518)

it's dead code. restore happens in `restore_soft_guard_pages` upon
returning from the altstack machinery.

* Improve GetArgumentName in MonoOptions. Fixes bug-60904 (mono#6506)

* Rewrite Options.GetArgumentName to use Regex

* code cleanup

* code cleanup

* Fix some warnings. (mono#6526)

* return 0 is generally redundant in, as the construction (mono#6528)

of the test program wraps the text in int main() { ... ; return 0; }

* Implement trivial loop detector in the front end and use it to drive inlining decisions. (mono#6478)

This cute hack allow us to cut the budget of perf irrelevant blocks[1] while massively boosting those that are perf relevant[2].

It has a ton of missing features, like it doesn't detect nested loops, it doesn't take hints from inlined methods and it doesn't compute EH info.
Beyond that, inlining budget is all but horrible, so there's ton of room for improvement here.

Results are promising.

A marginal improvements in benchmarks like Roslyn (2% user) while as much as 30% in micro benchmarks where the now bigger methods are in loop bodies.
Code size with Roslyn changed from 5433242 to 5501751, IE extra 68.5k, or 1.2% more.

[1] those ending in throw or in a catch handler
[2] Loops

* Revert "Implement trivial loop detector in the front end and use it to drive inlining decisions. (mono#6478)" (mono#6557)

This reverts commit 411791c.

* [mini] Fix seq point info leak (mono#6522)

* [Tests] Do not assume order of returned interfaces

Updated the System.Reflection.Emit/SaveTest to not depend on order of
interfaces returned from the System.Type::GetInterfaces method, as the
order is not guaranted. As described in the [documentation][0].

Also see github [issue][1] for more information and reasoning.

[1]: xamarin/xamarin-android#1186

* Fix bug 60848: Incorrect unicode custom attribute decoding (mono#6481)

* [runtime] Fix jit info leak when having aot images loaded

When we had a jit info table for aot images loaded in the domain, we would queue jit infos for freeing at domain unload time. This means leaking during entire application life.

Add comment for jit info freeing when having multiple tables.

Fixes #60986.

* [ci] Use correct -arch syntax in CFLAGS on OSX (mono#6570)

In c7d8d24 I unified how we're
passing -arch in CFLAGS to "-arch=XXX" since the original change
in 63a49e9 mixed the formats.

Turns out the correct syntax is "-arch XXX" instead and it broke
the ccache build in bockbuild because it complained about the
unknown format.

Also add LDFLAGS in the amd64 case to match what we have in bockbuild.

* [sdks] Set XCODE_VERSION to 'Xcode' for now to fix the ios build. (mono#6568)

* [sdks] Set more ios version variables to empty to fix the build. (mono#6571)

* [profiler] Write out all uncovered classes/methods in a loaded image. (mono#6544)

* [runtime] Export mono_class_get_checked () for use in profilers.

* [runtime] Expand mono_method_get_header_summary () to collect more info.

It now collects all the trivially-accessible header data that doesn't require
chasing down other metadata.

* [profiler] Use mono_method_get_header_summary () in the coverage code.

We only need code start and size information, not all the data that is present
in the header. By switching to this function, we avoid all the side effects
that come with resolving local variables and exception clauses (which can even
result in loading assemblies in the worst case).

* [profiler] Write out all uncovered classes/methods in a loaded image.


This required a bit of refactoring and some workarounds for various special
cases. This also fixes some race conditions with respect to how data was
inserted into the lock-free hash tables and queues.

* [configure] fix altstack detection

newer linux headers hide the `struct sigaltstack` definition (e.g. on
Ubuntu 17.10), probably because it is encouraged to use `stack_t`

We use `stack_t` in our code anyway:

The change introducing the `ifdef` was already wrong imho:

* Bump msbuild (mono#6569)

* [tests] Disable weak-fields.exe on LLVM as well

* Add CI to WebAssembly. This is PR based on top of # Only the top 3 commits matter for this PR: (mono#6488)

* [WASM] Fix System.Core issues and disable broken tests.

* [wasm] Fix cookie computation heap overflow. Use a local to make it thread safe.

* [wasm] Disable System tests that don't work under WASM. Change the wasm profile to disable BSD sockets.

* [wasm] Address reviewer feedback.

* [wasm] Disable test that requires multiple threads.

* [wasm] Add package target to wasm.

* [wasm] Modify the runner to exit(1) if the test suite fails.

* [wasm] Add CI configuration for WebAssembly.

* [wasm] Fix issues found over review.

* Convert K&R warning farm to ANSI and add static/const.
Also smaller part fix C-vs.-C++-isms.

* Convert ves_icall_System_Threading_Thread_GetName_internal to coophandle. (mono#6435)

Convert thread get name to coop/handle (ves_icall_System_Threading_Thread_GetName_internal).

*  [Tests] Skip System.ServiceModel tests that are not supported on XamMac 4.5 (mono#6574)

* g_assert should be an expression not a statement; provide g_assertf f is format like printf (mono#6235)

* g_assert should be an expression not a statement; provide g_assertf f is format like printf

- g_assert should be an expression, not a statement
   ANSI C assert gets this correct, and I corrected
   widely used NT ASSERT circa 2001 with no ill effects
   Note that ANSI C assert is void, g_assert here is boolean.

 - provide g_assertf
   f is for format, like printf -- too terse?
   Where you might previously say:
   if (!(expr))
     g_error(...); // like printf
    g_assertf(expr, ...)

Manual tests provided -- how to provide a test whose success is failure to compile?
Correct existing eglib/test to build and pass, but don't enable in build.
Enabling it is a line in toplevel to add eglib/test/Makefile
after eglib/Makefile.

* Fix comment in test code.

* format with s instead of hs

* review

* [mini] Make sure mkbundle executables work if they are run from a path on the PATH environment variable. (mono#6147)

* Make sure mkbundle executables work if they are run from a path on the PATH environment variable.

* Review

* Fix build on Windows

* [tests] Change test to use less stack

The interpreter uses a lot of stack and the stack overflows on this test.

* [interp] Add check for class failure

* Fix CLA link in (mono#6585)

It was changed when .NET Foundation switched to new CLA infrastructure.

* Bump linker

* Cleanup mono_string_to_utf16 -- use unichar2 type to advantage over char.

* [mcs] Fixes assumption that string class has no implicit/explicit conversion operators

* [mcs] Adds missing default literal conversion test in probing code path

* Check errors when mono_method_to_ir calls handle_delegate_ctor. (mono#6588)

* [jit] Move more declarations to mini-runtime.h. (mono#6586)

* Split mono_method_get_header_checked into internal and external forms. (mono#6609)

Split mono_method_get_header_checked into internal and external forms. (mono#6609)
External form is mono_method_get_header_checked, the preexisting name.
Internal form is mono_method_get_header_internal.
External must initialize the MonoError for compatibility, internal can/should assume it is already initialized per the new pattern.

* Convert dis, profiler, pedump, unit-tests to new MonoError/ERROR_DECL style. (mono#6607)

Convert dis, profiler, pedump, unit-tests to new MonoError/ERROR_DECL style.

* This test is supposed to take between 1 and 2 seconds, but takes slightly longer in practise and fails.
Give it 2.5 seconds.

Tests run: 120, Passed: 119, Errors: 0, Failures: 1, Inconclusive: 0
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
Elapsed time: 00:00:32.8320000

Errors and Failures:

    EndBuildWaitsForSubmissionCompletion (MonoTests.Microsoft.Build.Execution.BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion)
    Expected: less than or equal to 00:00:02
    But was: 00:00:02.0757916

at MonoTests.Microsoft.Build.Execution.BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion () [0x00126] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs:105
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305

* [interp] Disable tests on arm due to known issue

Due to clobbering of R8 by interp entry.

* [Tests] Skip a subset of the System.IdentityModel for iOS and Mac. (mono#6594)

* Bump bockbuild to bump gtksharp (mono#6604)


* [interp] Decrease stack usage (mono#6580)

Avoid inlining some functions with high stack frame locals usage (ex functions that use MonoLMFExt which is a big structure).

No performance cost was observed on microbenchmarks, while stack usage decreased by over 3 times on amd64 and over 4 times on arm.

* [mono-error] Use g_assertf in mono_error_assert_ok implementation

Also add two more variants

* mono_error_assert_msg_ok (err, msg) to print "msg, due to <err>" on failure
* mono_error_assertf_ok (err, fmt, args...) to print
  "<formatted args>, due to <err>" on failure.

* [mono-error] Use mono_error_assert{f,_msg}_ok instead of if (is_ok (e)) g_error(...)

* Fix missed closedir in commit 947d0bc (mono#6599)

* Fix watchos tests for (mono#6600)

*  Fix configure `--disable-boehm` to build more tests. (mono#6614)

* Add test for reproduce problem in debugger stepping

* [mcs] Implements C# 7 tuples implicit deconstruction

* [runtime] Apply cctor filters to callees of cctors (mono#6562)

* [perfcounters] Move machine handling from native to managed. (mono#6543)

* Move machine handling of performance counters from native
to managed -- just slightly less native code therefore.

* PR feedback: Rename ValidMachine to IsValidMachine.
             Use string::operator== instead of .Length/[].
             Change InstanceExistsInternal to return bool/MonoBoolean directly instead of int.
             Remove question mark on FIXME comment for more reliable grep.
             Remove redundant zeroing of a pointer.

* [jit] Clear cfg->error after inlining, the error can be ignored, it will happen when the called method is JITted. (mono#6587)

* Bump corefx

* Bump API snapshot submodule

* [interp] Disable mixed mode tests

When an exception is thrown from jitted code, the EH mechanism correctly sets the interp resume data to the right interp frame that should catch the exception, but it resumes to the interpreter by force, setting the MonoContext. This context has invalid data (for example the SP points to a InterpFrame and it is not the real sp at interp exit)

This bug was exposed by inlining changes from d3763c6

* Fixes an issue where a pipestream handle may be closed twice (Case 942966)

* [tests] Fix cscs/mcs specific GetMethodBody logic

* Fix NUnit reference generation

* [msvc] Update csproj files (mono#6642)

* Understand PE32+, at least as much as PE32 is understood. (mono#6503)

* Minimal fix to Authenticode infrastructure to understand PE32+.
A number of other problems are noticed in the code but commented only.
This fixes

* Induce many array out of bounds accesses, and some other error paths.

* Tweaks.

* tweak

* Move braces, move addition, document constants and use them.

* whitespace

* fix comment

* remove diff-minimizing hacks

* cosmetic

* move braces and assume zero-initialization; adjust comment.

* improving Makefile but still a ways to go

* fix C# indent

* Change from C++ to C, and cleanup Makefile.

* update clean target in Makefile

* cleanup Makefile and C#

* remove test code that people don't like and it wasn't very useful
wordsmithing and new good information in comments

* Fix indentation

* [sgen] Use sgen_is_object_alive_for_current_gen () instead of sgen_is_object_alive (), the latter doesn't work for oldspace objects, causing the gc handle to be freed even through the object is still alive. Fixes mono#6490. (mono#6501)

* Reusee class unload cache filter logic from metadata in debugger. (mono#6641)

Debugger maintains it's own list of loaded classes. The unload/filter
logic does not handle composite types like arrays and generic instances.
Expose and reuse the logic from metadata that properly detects any
usage of an image within a type.

This prevents the cache from containing MonoClass values which have
already been freed by the metadata cleaning code.

* [offsetdumper] remove InterpMethodArguments

Every user of this tool is using architectures that are implementing

* [ci] Align acceptance tests timeouts

* [interp] Remove checks not needed for try blocks

Leave from catch clauses is translated to MINT_LEAVE_S_CHECK, which does the exception reset and abort rethrow.

* [interp] Initialize sp for first interp frame

During interp frame unwinding, we were initializing the sp field (to the corresponding interpreter frame) starting with the parent frames of the first interpreter frame.

* [interp] Interp frames are also managed

* [interp] Abide by the abort threshold constraint

For mono_thread_get_undeniable_exception to work, it needs to unwind the stack and find the first managed frame. This is only possible if we push an interp LMF with a frame for the interp to native transition.

* [Test] Skip some tests from System.ServiceModel on WatchOS.

Some of the classes are not supported in the platform while are
supported in MOBILE. Skip them accordingly.

* Address review comments.

* [WindowsBase] Use case-insensitive extension match in System.IO.Packaging.ZipPackage

* Avoid crash under GNOME if no gtk+2 available (mono#6654)

gtk+2 is non-essential part of the GNOME 3 desktop nowadays.

* [System.IO.Compression.FileSystem] Improve ZipCreateFromEntryChangeTimestamp test

`entry.LastWriteTime` is an unspecified/local DateTime but we're
comparing it against `date` which is in UTC. This could lead to
issues where the Day isn't matching when running the test around


* [unit-tests] Add test-mono-string to .gitignore

* [scripts] now uses command-line arguments.

* [interp] Don't push lmf with no interp frame data

* Bump corefx

* [System.Core] Enable more tests

* Bump api-snapshot

* Bump API snapshot submodule

* [corlib] Implements StackTraceHiddenAttribute

* [build] Add recursive run-xunit-test target

* [msvc] Update csproj files (mono#6696)

* [packaging] Set MONO_BUILD_REVISION for OSX package build (mono#6698)

Otherwise the default bockbuild behavior is to use the tip of
MONO_BRANCH which is not what we want when building on Jenkins.

* [packaging] Produce correct Windows .msi file name

We've been using a certain pattern for the Windows .msi for a long
time but the build output used a different name which we simply
manually renamed before publishing.

Since we want to automate as much as possible we can change the
build to produce the correct name right away.

* [packaging] Add signing to Windows build

* [packaging] Move setting build description to end

This ensures we don't advertise the link if e.g. signing fails.

* [packaging] Fix variable

* Remove extra reference count on images loaded via byte array. (mono#6656)

* [interp] use libmonoldflags (to enforce -no-undefined)

it has the right logic to avoid this:

ld: -undefined and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together

i.e. setting `-no-undefined`. However, this requires that we link
against `libmonosgen` on those platforms.

* [packaging] Add GitHub status for packaging result

PKG-mono for the OSX .pkg and MSI-mono_{x86|x64} for the Windows .msi

* [packaging] Move GitHubCommitStatusSetter into node

* [packaging] Bump mono-basic to bring latest fixes (mono#6706)

* [ci] Reenable System.Runtime.CompilerServices.Unsafe-xunit on 32bits (mono#6708)

The corefx bump was done so we can reenable this.

Fixes mono#6379.

* [corlib] Optimization for stacktrace build up

* fixed markdown syntax

* [System]: Enable ServicePoint tests from CoreFX.

* [acceptance-tests] Some improvements to the profiler stress runner.

* Print combined stdout and stderr in console output.
* Print the RNG seed used for a test run on startup and in the test report.
* Set the individual test timeout back to 6 hours.
* Use the nodefaults profiler option.
* Allow configuration through environment variables:
 - MONO_PROFILER_STRESS_OPTIONS: Specify a set of profiler options to use
   instead of the randomly generated ones.
 - MONO_PROFILER_STRESS_REGEX: Specify a regular expression to filter which
   tests should be run.
 - MONO_PROFILER_STRESS_SEED: Specify the RNG seed. Useful for reproducing full
   test runs at a later point.
 - MONO_PROFILER_STRESS_TIMEOUT: Specify a different individual test timeout
   from the default.

* [sgen] Don't report gc_resize profiler events from worker threads.

See 4acc3df for why this is problematic. The
bug was introduced in d7ac79c.

This fixes an occasional deadlock in the profiler stress tests.

* Bump corefx

* fix leak in FontFamily

* [runtime] Avoid building a separate static library, use the shared object files for the static library as well. (mono#5233)

* [interp] config.h must be included first; only by .c files

Not by headers.

* [interp] Fix some leaking error paths in generate ()

If there's an error, we should free the TransformData before returning

* [interp] Don't use external only functions in transform.c

Switch over to various _checked alternatives and propagate the MonoError outwards

* [metadata] New method mono_method_has_no_body

Returns TRUE if the method flags indicate that it's not expected to have a
body because it is abstract, a PInvoke, an internal call or a
runtime method.

* Revert "[mini] Align stack when resuming to catch handler"

This reverts commit ab20369.

It breaks llvm EH : xamarin/xamarin-macios#3241

* [threads] Return boolean instead of pointer from Thread_internal (mono#6661)

* [ci] update ARM label for ignored interpreter tests (mono#6738)

image got upgraded for interpreter lanes too

* Save 1K of stack and an extra string copy when a heap allocation was going (mono#6720)

to be done unconditionally anyway. And make it valid C++.

* [github] Tweaks to issue template

* [wasm] Fix WASM CI script. (mono#6741)

* Fix warnings (mono#6685)

* [checked-build] Fix warnings in g_free of g_getenv results

checked-build.c:63:12: warning: passing 'const gchar *' (aka 'const char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                        g_free (env_string);
../../mono/eglib/glib.h:126:20: note: passing argument to parameter 'ptr' here
void g_free (void *ptr);
checked-build.c:79:12: warning: passing 'const gchar *' (aka 'const char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                        g_free (env_string);
../../mono/eglib/glib.h:126:20: note: passing argument to parameter 'ptr' here
void g_free (void *ptr);

* [boehm] Fix warning in GC_push_all call

boehm-gc.c:603:17: warning: incompatible pointer types passing 'HandleChunkElem [125]' to parameter of type 'ptr_t' (aka 'char *') [-Wincompatible-pointer-types]
                        GC_push_all (cur->elems, (char*)(cur->elems + cur->size) + 1);
../../libgc/include/private/gc_priv.h:1318:34: note: passing argument to parameter 'bottom' here
void GC_push_all GC_PROTO((ptr_t bottom, ptr_t top));

* [github] Add issues template (mono#6739)

* [wasm] Fix nunit dep description. (mono#6749)

* [sdks] Remove obsolete --with-glib=embedded configure option. (mono#6751)

* [runtime] Fix the build with the --disable-libraries configure option. (mono#6750)

* [System]: Refactor and cleanup WebResponseStream (mono#6662)

We are now using nested streams to take care of buffering, chunked encoding and automatic decompression.

GZip / Deflate decompression have been moved inside `WebResponseStream`, the `HttpWebResponse` now always returns a `WebResponseStream` (and not a `GZipStream`) because we have to do extra book-keeping after reading the entire content.

* [System]: Use WebClient from CoreFX. (mono#6711)

The CoreFX version has a few error checks which are not in the
referencesource, switching to CoreFX allows us to enable their tests.

Use Path.GetRandomFileName() and Path.GetTempFileName() in tests.

* [jit] Fix OP_ICONV_TO_OVF_I8_UN, it should use OP_ZEXT_I4 instead of a 0 shift which can be eliminated by cprop. (mono#6753)

Fixes mono#6721.

* Check for compiler switches to mitigate Spectre/Meltdown

This commit implements checking whether the compiler used to build mono supports
the recently added switches to generate code designed to mitigate the effects of
the Spectre/Meltdown bugs of the modern CPUs (

As of this commit the options are implemented for GCC 8.x, 7.3 and backported to
some older versions of gcc 7.x (e.g. in Ubuntu). The options tested for, and
used, here are:

  -mindirect-branch (
  -mfunction-return (

Checks and usage of the above flags is hidden behind the
`--with-spectre-mitigation` configure option, defaulting to `no`.

Two additional options are implemented to specify the kind of thunk to implement
by each of the flags above:

    Convert indirect branches to the specified kind of thunk (defaults to inline)

    Convert function return instructions to the specified kind of
    thunk (defaults to inline)

* [interp] build library of interp even if it's disabled and ship it

so the install directory looks like this:

$ find . -name '*interp*'

* [jit] Avoid extending the size of Vector2/Vector3 to 16 bytes. Disable SIMD for these types for now, since the SIMD code can't handle types (mono#6746)

which are smaller than a SIMD reg.

Fixes mono#6411.

* [msvc] Update csproj files (mono#6758)

* [sdks] Add more targets for XA (mono#6678)

* [sdks] Remove redundant dependency

* [sdks] Build mxe-Win{32,64}

* [sdks] Build host-{Darwin,Linux,mxe-Win{32,64}}

* [sdks] Build llvm-llvm{win,}{32,64}

* [m4] Drop autoconf min version in ax_check_compile_flag.m4 (mono#6764)

It should work with earlier versions too and prevent issues like

* [sdks] Fix build for llvm  (mono#6770)

* [sdks] Fix build for llvm

* [sdks] Have .stamp-%-configure always depend on .stamp-%-toolchain

* [sdks] Dependencies on directories should always be order-only

* [boringssl] Bump to include Neale's big endian fixes (mono#6761)

mono/boringssl#4 and followup 2ba8564f8b6.

joncham added a commit to Unity-Technologies/mono that referenced this pull request Apr 6, 2018

Understand PE32+, at least as much as PE32 is understood. (mono#6503)
* Minimal fix to Authenticode infrastructure to understand PE32+.
A number of other problems are noticed in the code but commented only.
This fixes

* Induce many array out of bounds accesses, and some other error paths.

* Tweaks.

* tweak

* Move braces, move addition, document constants and use them.

* whitespace

* fix comment

* remove diff-minimizing hacks

* cosmetic

* move braces and assume zero-initialization; adjust comment.

* improving Makefile but still a ways to go

* fix C# indent

* Change from C++ to C, and cleanup Makefile.

* update clean target in Makefile

* cleanup Makefile and C#

* remove test code that people don't like and it wasn't very useful
wordsmithing and new good information in comments

* Fix indentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.