diff options
author | Niklas Therning <niklas@therning.org> | 2016-11-15 18:22:33 +0300 |
---|---|---|
committer | Niklas Therning <niklas@therning.org> | 2016-11-16 11:14:25 +0300 |
commit | ed892ccf27849c082ce6ca46fa8b96d86ca7c329 (patch) | |
tree | 8240e5df0bcd09dfd2b8a84c769e5b22ef758a46 /msvc/monoposixhelper.def | |
parent | f3002a1f72df7165dd42b7abb6d5b1b5ccaa035b (diff) |
Prevent Mono.Posix from using multiple C runtimes on Windows
Since libMonoPosixHelper.dll is linked against ucrtbase.dll the C runtime
wrapper functions in it will call into ucrtbase.dll. Some pinvokes in
Mono.Unix.Native.Stdlib, however, bind directly to C runtime functions in
msvcrt. This is problematic if a resource (heap memory, file pointer, etc) is
allocated using one C runtime and then operated upon using funcitons form the
other C runtime. E.g., Stdlib.malloc() calls into a wrapper in
libMonoPosixHelper so it will use the ucrtbase heap while Stdlib.free() calls
directly into msvcrt's free() which will abort the process since it's called
with a pointer in an unknown heap.
This commit adds libMonoPosixHelper wrappers for all memory and file related
functions in Stdlib to ensure that all such functions use the same C runtime.
Some of the Mono.Posix tests still fail but at least the test suite doesn't
crash after this change. The test failures will be addressed in a future PR.
Diffstat (limited to 'msvc/monoposixhelper.def')
-rw-r--r-- | msvc/monoposixhelper.def | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/msvc/monoposixhelper.def b/msvc/monoposixhelper.def index 027280d5a91..bd2ac9f5a83 100644 --- a/msvc/monoposixhelper.def +++ b/msvc/monoposixhelper.def @@ -49,8 +49,20 @@ Mono_Posix_Stdlib__IOLBF Mono_Posix_Stdlib__IONBF
Mono_Posix_Stdlib_calloc
Mono_Posix_Stdlib_clearerr
+Mono_Posix_Stdlib_fclose
+Mono_Posix_Stdlib_feof
+Mono_Posix_Stdlib_ferror
+Mono_Posix_Stdlib_fflush
+Mono_Posix_Stdlib_fgetc
Mono_Posix_Stdlib_fgetpos
+Mono_Posix_Stdlib_fgets
+Mono_Posix_Stdlib_fopen
+Mono_Posix_Stdlib_fprintf
+Mono_Posix_Stdlib_fputc
+Mono_Posix_Stdlib_fputs
Mono_Posix_Stdlib_fread
+Mono_Posix_Stdlib_free
+Mono_Posix_Stdlib_freopen
Mono_Posix_Stdlib_fseek
Mono_Posix_Stdlib_fsetpos
Mono_Posix_Stdlib_ftell
@@ -65,6 +77,8 @@ Mono_Posix_Stdlib_stderr Mono_Posix_Stdlib_stdin
Mono_Posix_Stdlib_stdout
Mono_Posix_Stdlib_strlen
+Mono_Posix_Stdlib_tmpfile
+Mono_Posix_Stdlib_ungetc
Mono_Posix_ToAccessModes
Mono_Posix_ToConfstrName
Mono_Posix_ToDirectoryNotifyFlags
|