summaryrefslogtreecommitdiff
path: root/src/pal/src
AgeCommit message (Collapse)AuthorFilesLines
2019-10-15[Tizen] Add coreclr_preload_assembly to CoreCLR host APItizen_5.5.m2_releasesubmit/tizen_5.5_mobile_hotfix/20201026.185106submit/tizen_5.5/20191031.000006submit/tizen/20191014.221258accepted/tizen/unified/20191015.012049accepted/tizen/5.5/unified/mobile/hotfix/20201027.061818accepted/tizen/5.5/unified/20191031.004944Konstantin Baladurin5-113/+882
2019-10-11[Tizen] Implement detecting of sanitized librariesAndrey Drobyshev4-0/+174
Parse ".dynamic" section (ELF dynamic array tags) of the module being added, find ".rel(a).plt" section and search it for presence of '__asan_init' symbol. Change-Id: Ie7cc4c818b791b5f00713b42ba15131325b8152c Signed-off-by: Andrey Drobyshev <a.drobyshev@samsung.com>
2019-09-26add access(2) call before dlopening filesYaroslav Yamshchikov1-0/+9
2019-08-19arm64 out of proc unwind for DAC (#26156)Mike McLaughlin1-10/+69
Removed FEATURE_DATATARGET4 for arm64 Added SP check to createdump's native unwind loop to make it more robust. Issue: https://github.com/dotnet/coreclr/issues/15062
2019-08-07Port to 3.0 - Fix WSL alternate stack check (#25980)Jan Vorlicek2-5/+27
On WSL, the alternate stack check in sigsegv_handler doesn't work. The uc_stack members are always zero no matter whether the handler is executed on an alternate or default stack. So the check to detect whether we are running on an alternate stack or not is always returning false on WSL and it prevents NULL reference exceptions from being handled. The fix is to introduce an env variable COMPlus_EnableAlternateStackCheck that can be used to enable the alternate stack check. By default, the sigsegv_handler is considered to always run on an alternate stack.
2019-07-19Arm32 support VFP registers context to/from native context (#25775)Steve MacLean2-0/+79
2019-07-18Arm32 restore d8-d15 in ThrowExceptionFromContextInternal (#25777)Steve MacLean1-12/+21
2019-07-18Arm64 restore d8-d15 in ThrowExceptionFromContextInternal (#25743)Steve MacLean1-0/+12
2019-07-18Arm64 support SIMD registers context to/from native context (#25757)Steve MacLean2-0/+60
2019-07-18Arm64 Fix Rtl*Context (#25745)Steve MacLean2-5/+5
Fix issues related to save restore of FPCR/FPSR/V0/V31 There were several bugs in the assembly causing FPCR/FPSR to overwrite V0 on RtlCaptureContext. Then restore from V0 on RtlRestoreContext
2019-07-04Fix dotnet-dump/createdump launch failure (#25562)Mike McLaughlin1-1/+2
On CentOS or OpenSUSE dotnet-dump collect fails but a valid coredump is generated. The "prctl()" call is failing that gives the child createdump process permission to ptrace to the runtime process. On CentOS/OpenSUSE the PR_SET_PTRACER option isn't supported and not needed. Issue: https://github.com/dotnet/diagnostics/issues/334
2019-06-29Fix a mutex abandon case with WaitHandle.WaitAll in the PAL (#25452)Koundinya Veluri1-2/+6
Fixes https://github.com/dotnet/coreclr/issues/25108 - Upon a `WaitAll` when all waits are already satisfied, the abandoned flag is overwritten with the abandoned state of the last wait object in the array - So if the first wait object is an abandoned mutex and the second wait object is a signaled event, the `WaitAll` succeeds and does not report that anything was abandoned - Fixed to accumulate into the flag instead of overwriting it
2019-06-21Fix OSX floating point state extraction (#25295)Jan Vorlicek2-159/+66
There was a bug reported on a very recent Mac with Intel i9 processor. A crash in the RtlRestoreContext was happening at the fxrstor instruction due to the fact that the floating point state data were garbage. The investigation has shown that sometimes, the x86_FLOAT_STATE64 cannot be obtained using the thread_get_state API. And it was also found that at the same time, the x86_AVX_STATE64 can be obtained. The state extracted by the AVX variant contains all the registers that the FLOAT variant would extract. However, in some cases, even the x86_AVX_STATE64 cannot be obtained and there is a third flavor that we can get - x86_AVX512_STATE64. Unfortunately, there are cases where none of those can be obtained. It is not clear what causes these cases, it seems only kernel debugging can give us an answer to that. This change modifies the way we extract the floating point state. We first try to get the AVX state, if we fail, we try the AVX512 and finally we fall back to the FLOAT state. If we fail to get the floating point state with any of these, we return context without the floating point state flag set. Also, if only getting the FLOAT state succeeds, we return context without the XSTATE flag set.
2019-06-20Add custom default base address option to crossgen (#25227)Gleb Balykov4-1/+32
* Add crossgen option to setup default base address for native image This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION. * Mmap native images at default base address if env variable COMPlus_UseDefaultBaseAddr=0x1 is setup. This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.
2019-06-17Enable running SIGSEGV handler on non-alternate stack (#25196)Jan Vorlicek1-3/+27
When a third party library that someone loads into a coreclr process registers its own SIGSEGV handler and then chain-calls coreclr SIGSEGV handler on a non-alternate stack, coreclr would currently crash. This fix enables it to execute the SIGSEGV handler on the non-alternate stack (original stack of the interrupted thread) in such case. The disadvantage is that stack overflow would lead to silent crash in such a case, but we cannot do anything about it.
2019-06-17Replace 'assert' with '_ASSERTE' (#25177)Andy Hanson1-1/+1
2019-06-11Use pread() to read DOS/NT headers when mapping PE files (#25059)Leandro A. F. Pereira1-14/+2
Shaves off two syscalls per managed assembly load.
2019-06-10Add support for the NetTrace EventPipe file formatnoahfalk4-12/+72
Right now the new format is not on by default, but it can be enabled using COMPlus_EventPipeNetTraceFormat = 1 for testing purposes. The plan to have a follow up PR that will add shipping configuration mechanisms and change the default setting. See the documentation in the PerfView repo for more details about the format. At a glance the goal is to create a format that is more efficient to produce, has a smaller on disk size, and offers enhanced functionality in a few areas: a) 64 bit thread id support b) Detection of dropped events via sequence numbers c) Better support for extracting subsets of the file Together with the change there was also some refactoring of the EventPipeBufferManager and EventPipeThread. This change addresses (at least in part) the following issues: #19688, #23414, #24188, #20751, #20555, #21827, #24852, #25046
2019-06-06Use CMake's C# support to build DacTableGen instead of manually invoking ↵Jeremy Koritzinsky1-11/+11
csc.exe ourselves. (#24342) * Use CMake's C# support to build DacTableGen instead of manually invoking csc.exe ourselves. * Fix x86 failures. * Disable DAC generation when building with NMake Makefiles and issue an error since the CMake C# support is VS-only. We don't actually support building with NMake (only configure) so this is ok. * Clean up rest of the macro=1's PR Feedback. * Fix Visual Studio generator matching. * Explicitly specify anycpu32bitpreferred for DacTableGen so the ARM64 build doesn't accidentally make it 64-bit * Fix bad merge
2019-06-06Fix tmp dir in configure.cmake (#25003)Jan Vorlicek1-3/+4
The ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS check was using a temp path that had some non-existent components. While this works fine on Linux, it fails to create the temp file on OSX. The fix is to use temp dir in the CMake's output dir.
2019-06-05Fix PAL_GetLogicalProcessorCacheSizeFromOS on mac (#24777)Andy Hanson3-0/+18
* Fix PAL_GetLogicalProcessorCacheSizeFromOS on mac In a previous PR (https://github.com/dotnet/coreclr/commit/ed52a006c01a582d4d34add40c318d6f324b99ba#diff-8447e54277bb962d167a77bb260760d7R1879), GetCacheSizePerLogicalCpu was changed to no longer rely on cpuid on amd64 systems; instead it uses GetLogicalProcessorCacheSizeFromOS(). Unfortunately that function consisted of a number of `#if`s, none of which were active on macs, and we just returned 0. This caused us to default to a gen0size of only 0.25MB, causing many GCs. Fixed by adding a new case that uses `sysctlbyname`. Fix #24658 * Fixes from code review * Check for function sysctlbyname instead of header
2019-06-05Use Modern CMake features instead of CMAKE_CXX_FLAGS (#24861)Jeremy Koritzinsky1-3/+3
* Convert C++ standard settings and warning options from CMAKE_<LANG>_FLAGS to Modern CMake isms. * More $<COMPILE_LANGUAGE> generator expressions instead of CMAKE_CXX_FLAGS. * Use $<COMPILE_LANGUAGE:CXX> for all -fpermissive usage * Fix generator expression that generates multiple flags * Fix invalid use of CMAKE_CXX_FLAGS instead of CMAKE_C_FLAGS. * Treat AppleClang as though it is Clang (match pre-3.0 behavior). * Update our build system to understand that AppleClang is distinct from Clang and remove CMP0025 policy setting. * PR Feedback.
2019-06-02Improve fatal err msg (#24390)Dan Moseley1-1/+1
* Improve fatal err msg * Match SO format * a * Remove dead define * More adjustments to ex msg * And PAL * Remove special case for SOE * Remove excess Debug.Assert newline * Remove excess newline * typo * New format * Remove DebugProvider redundancy * Adjustments * Remove preceding newline * Make other SOE and OOM consistent * Tidy up assertion msg * Fix missing newline after inner exception divider * CR when no inner exception * ToString never CR terminated * disable corefx tests temporarily
2019-05-29Use /proc/<pid>/mem to read memory in remote DBI data target. It makes the ↵Mike McLaughlin1-0/+12
test case run at (#24844) least 4 to 5 times faster than before. Fallback to old transport ReadMemory if /proc/<pid>/mem can't be opened. This happens on attach because of permissions/access, but works fine on the launch (the most important case).
2019-05-29Add COMPlus_LTTng environment variable (#24733)John Salem1-5/+17
* default value is 1, and when set to 0 will disable loading LTTng. Co-Authored-By: Jan Kotas <jkotas@microsoft.com>
2019-05-28Fix initial thread affinity on Linux (#24801)Jan Vorlicek4-9/+51
* Fix initial thread affinity on Linux On Linux, a new thread inherits the affinity mask of the thread that created the new thread. This is a problem for background GC threads that are created by one of the server GC threads that are affinitized to single core. This change adds resetting each new thread affinity to match the current process affinity. In addition to that, I've also fixed the extraction of the CPU count that was using PID 0. While the doc says that 0 represents current process, it in fact means current thread. And as a small bonus, I've added caching of the value returned by the PAL_GetLogicalCpuCountFromOS, since it cannot change during runtime.
2019-05-22Cache current thread ID in TLS (#24699)Leandro A. F. Pereira1-5/+12
While looking at the strace of `corerun` built with logging and debugging information, I was amazed at the number of gettid() calls it was making. While system calls are cheap, they're still not free; cache this number in the thread local storage area. Adds a branch, but it's just a comparison with 0, so it's fine in comparison.
2019-05-21Avoid PAL LoadLibrary simulator for regular PInvoke (#24669)Jan Kotas1-54/+0
Fixes #21009
2019-05-21Add header check for atomic_ops.hAdeel2-0/+4
2019-05-17Merge pull request #24520 from am11/freebsd/set-affinityJan Vorlicek1-0/+4
Fix CPUSET_T definition for FreeBSD
2019-05-16Add support for invariant casing in PAL (#24597)Michal Strehovský5-0/+2573
unicodedata.cpp based on UnicodeData.txt v11.0.
2019-05-15Delete unicode API emulator (#24581)Michal Strehovský10-15419/+23
2019-05-11Adjust PAL_STDCPP_COMPAT to accommodate FreeBSDAdeel1-0/+4
2019-05-10Move EventProvider native layout to be driven by CMake configure (#24478)Jeremy Koritzinsky5-1/+205
* Generate eventpipe implementation as part of CMake configure. * Generate Etw provider as part of CMake configure. * First pass porting over lttng provider to cmake. * Fix up CMake Lttng provider generation. * Move Lttng provider into CMake tree. * Move dummy event provider to CMake * Move genEventing into the CMake tree. * Remove extraneous logging and unused python locator. * Clean up build.sh * Clean up genEventingTests.py * Add dependencies to enable more incremental builds (providers not fully incremental). * Convert to custom command and targets instead of at configure time. * Get each eventing target to incrementally build. * Fix incremental builds * Add missing dependencies on eventing headers. * PR Feedback. Mark all generated files as generated * Clean up eventprovider test CMakeLists
2019-05-09Fix memory leak in PAL_GenerateCoreDump (#24503)Mike McLaughlin1-11/+24
2019-05-08Add generate crash dump command to diagnostics server (#24460)Mike McLaughlin1-87/+181
Add the DiagnosticProtocolHelper class to deserialize and dispatch the new GenerateCoreDump command. Refactor the PAL createdump launch on unhandled exception code to used by a new PAL_GenerateCoreDump method that doesn't depend on the complus dump environment variables. Changed the "full" createdump not to include the uncommitted pages and removed the "add module metadata" workaround for SOS clrstack !UNKNOWN problem now that is fixed in SOS (crashinfo.cpp).
2019-05-07Fixing up time.cpp in the PAL (#24428)Tanner Gooding2-95/+92
* Fixing up time.cpp in the PAL * Fixing GetTickCount64 in the PAL to continue using CLOCK_MONOTONIC_COARSE where available * Reverting QueryPerformanceFrequency in the PAL to return tccSecondsToNanoSeconds for CLOCK_MONOTONIC * Removing two unused variables from GetTickCount64 in the PAL * Updating the PAL to error if neither mach_absolute_time nor clock_gettime(CLOCK_MONOTONIC) are supported. * Fixing the PAL configure.cmake to link rt where applicable
2019-05-02In the PAL GetProcessTimes implement lpCreationTime using the current time ↵Brian Sullivan1-10/+44
returned by gettimeofday This allows IBC profile data to record a meaningful time of when the training scenario was run. Made EPOCH_DIFF a defined constant Change calcTime to be an unsigned 64-bit integer Change constants to units of 100NS instead of NS to avoid division and integer overflows. Use the defined constants SECS_TO_100NS and USECS_TO_100NS when performing time calculations Don't add a space after the Assembly arg when argc is zero
2019-05-02Unify Wformat suppression for libunwindAdeel1-9/+5
2019-04-19Large Pages on Linux & macOS (#24098)Mukul Sabharwal3-7/+40
2019-04-16Fix incorrect thread affinitization (#24045)Jan Vorlicek1-7/+2
The PAL_SetCurrentThreadAffinity was incorrectly adding the specified processor to the current thread affinity set instead of setting the affinity to only the processor specified. It was causing significant performance hit in aspnet benchmarks on machines with many cores. This change crept in when I was refactoring the related code while removing CPU groups emulation.
2019-04-10Fix few issues discovered by testingJan Vorlicek1-4/+3
2019-04-10Fix RecycledLists size on UnixJan Vorlicek1-2/+3
The list size was set to g_SystemInfo.dwNumberOfProcessors which is a number of processors the current process is allowed to run on, but not the total number of processors in the system. Fixed to use PAL_GetTotalCpuCount. Also revert a change to the mbind node mask length computation I've incorrectly made in my last commit and make it clear that the value is a number of used bits in the node mask, which is the highest numa node plus 1. And finally, re-reading the mbind doc, I've found that the maxnode parameter is in fact "number of nodes" in the mask, so fixing that too.
2019-04-09Fix several issuesJan Vorlicek4-17/+11
* Fix build on OSX and Linux machines without NUMA installed - there were couple of places where I was missing ifdefs * Fix bug in nodeMaskLength computation * Remove testing change in eeconfig.cpp that has leaked into the PR * Fix GCToOSInterface::GetTotalProcessorCount for embedded GC to return all processors on the system, not just the ones enabled for the current process.
2019-04-09Remove Unix CPU groups emulationJan Vorlicek5-811/+142
This change removes CPU groups emulation from Unix PAL and modifies the GC and thread pool code accordingly.
2019-04-05Fix rounding to UINT32_MAX (#23764)Ludovic Henry1-10/+3
In case you would have UINT32_MAX - 1 CPUs, you would round up to return UINT32_MAX CPUs.
2019-04-05Partially improve support for `--cpus` from Docker CLI (#23747)Ludovic Henry2-5/+12
* Round up the value of the CPU limit In the case where `--cpus` is set to a value very close to the smaller integer (ex: 1.499999999), it would previously be rounded down. This would mean that the runtime would only try to take advantage of 1 CPU in this example, leading to underutilization. By rounding it up, we augment the pressure on the OS threads scheduler, but even in the worst case scenario (`--cpus=1.000000001` previously being rounded to 1, now rounded to 2), we do not observe any overutilization of the CPU leading to performance degradation. * Teach the ThreadPool of CPU limits By making sure we do take the CPU limits into account when computing the CPU busy time, we ensure we do not have the various heuristic of the threadpool competing with each other: one trying to allocate more threads to increase the CPU busy time, and the other one trying to allocate less threads because there adding more doesn't improve the throughput. Let's take the example of a system with 20 cores, and a docker container with `--cpus=2`. It would mean the total CPU usage of the machine is 2000%, while the CPU limit is 200%. Because the OS scheduler would never allocate more than 200% of its total CPU budget to the docker container, the CPU busy time would never get over 200%. From `PAL_GetCpuBusyTime`, this would indicate that we threadpool threads are mostly doing non-CPU bound work, meaning we could launch more threads.
2019-04-05Fix invalid use of stack memory (#23758)Aaron Robinson1-18/+16
* Fix invalid use of stack memory
2019-03-22Improve detection of CPU limits when running inside a ContainerLudovic Henry1-1/+11
This focuse on better supporting `--cpuset-cpus` which limits the number of processors we have access to on the CPU; it also specifies which specific processor we have access to, but that’s irrelevant here The work has been done here for all runtime components except `Environment.ProcessorCount`. The work consist in fixing `PAL_GetLogicalCpuCountFromOS` to use `sched_getaffinity`. Fixes https://github.com/dotnet/coreclr/issues/22302
2019-03-21Merge pull request #23321 from franksinankaya/gcc_cleanup_14Jan Vorlicek1-2/+2
Integer Conversion issues