aboutsummaryrefslogtreecommitdiffstats
path: root/erts
AgeCommit message (Collapse)Author
2015-02-27Two minor fixesLeo Liu
* Fix documentation on $char for unicode * Remove duplicate declaration for erts_encode_ext_dist_header_size
2015-02-26hipe: change mfa_info_table lock to rwmutexMikael Pettersson
The hipe_mfa_info_table lock is currently a mutex, causing unnecessary contention and serialization of lookups for apply-like constructs. - change the lock from a mutex to an rwmutex - split hipe_get_na_nofail_locked into a "try" path which only needs a read lock, and a "slow" path which requires a write lock - reimplement hipe_get_na_nofail (used by apply ops etc) to first call the "try" path with a read lock, and if that fails the "slow" path with a write lock - reimplement hipe_get_na_nofail_locked (used by maintenance code) to call the "try" path and then optionally the "slow" path, but without taking locks since its caller already has the write lock - adjust remaining lock ops to take/release full write lock - use _rwlocked as suffix on functions requiring a write lock - change hipe_mfa_get_trampoline to call get_locked not put_locked, allowing it to take a read lock instead of a write lock - change hipe_find_mfa_from_ra() to only take a read lock
2015-02-25Use new time API and be back-compatible in sshErland Schönbeck
otp_SUITE: Ignore undefined functions in ssh
2015-02-20erts: Fix erroneous printout in crashdumpBjörn-Egil Dahlberg
An extra '}' were printed in remote links.
2015-02-19remove perfctr supportMikael Pettersson
Perfctr is a Linux kernel extension that allows programmatic access to the performance monitoring counters found in most current CPUs. However, development of perfctr ceased after 2010, and it cannot be used with Linux kernels newer than 2.6.32. Therefore the perfctr support code in the Erlang VM is effectively dead code, so this patch removes it.
2015-02-18otp_SUITE: Ignore diameter undefined function errorsErland Schönbeck
2015-02-14don't leave a heap hole in erts_bs_get_integer_2Mikael Pettersson
Reset p->htop in the oversize bignum error case to avoid leaving a hole in the heap, which would crash the debug emulator.
2015-02-12Add zlib limited output buffer size functionalityСергей Прохоров
This functionality may be useful for compressed streams with high compression ratio (in case of gzip it may be up to x1000), when small amount of compressed data will produce large amount of uncompressed output. This may lead to DoS attacks, because server easily goes out of memory. Example of such high compression ratio stream: ``` dd if=/dev/zero of=sparse.bin bs=1MB count=100 # 100mb of zeroes gzip sparse.bin # 95kb sparse.bin.gz $ erl > {ok, Compressed} = file:read_file("sparse.bin.gz"), > 97082 = size(Compressed), > Uncompressed = zlib:gunzip(Compressed), > 100000000 = iolist_size(Uncompressed). ```
2015-02-05Merge branch 'bjorn/compiler/dup-bug-fix/OTP-12453'Björn Gustavsson
* bjorn/compiler/dup-bug-fix/OTP-12453: Teach case_opt/3 to avoid unnecessary building sys_core_fold: Optimize let statements more aggressively Suppress warnings for expressions that are assigned to '_' trace_bif_SUITE: Ensure that a call to time/0 is not removed
2015-02-04don't create oversize bignums in binary matchingMikael Pettersson
Bignums are artifically restricted in size. Arithmetic and logical operations check the sizes of resulting bignums, and turn oversize results into system_limit exceptions. However, this check is not performed when bignums are constructed by binary matching. The consequence is that such matchings can construct oversize bignums that satisfy is_integer/1 yet don't work. Performing arithmetic such as Term - 0 fails with a system_limit exception. Worse, performing a logical operation such as Term band Term results in []. The latter occurs because the size checking (e.g. in erts_band()) is a simple ASSERT(is_not_nil(...)) on the result of the bignum operation, which internally is [] (NIL) in the case of oversize results. However, ASSERT is a no-op in release builds, so the error goes unnoticed and [] is returned as the result of the band/2. This patch addresses this by preventing oversize bignums from entering the VM via binary matching: - the internal bytes_to_big() procedure is augmented to return NIL for oversize results, just like big_norm() - callers of bytes_to_big() are augmented to check for NIL returns and signal errors in those cases - erts_bs_get_integer_2() can only fail with badmatch, so that is the Erlang-level result of oversize bignums from binary matches - big_SUITE.erl is extended with a test case that fails without this fix (no error signalled) and passes with it (badmatch occurs) Credit goes to Nico Kruber for the initial bug report.
2015-02-04fix faulty mergeHenrik Nord
2015-02-03Merge branch 'maint'Zandra Hird
Conflicts: OTP_VERSION erts/emulator/sys/unix/sys.c erts/vsn.mk
2015-02-03Merge branch 'maint-17' into maintZandra Hird
2015-02-03trace_bif_SUITE: Ensure that a call to time/0 is not removedBjörn Gustavsson
Assigning the result of a BIF call to a variable used to be sufficient to prevent the call from being optimized away. With the more aggressive optimization that will be introduced in a future commit it will not be sufficient. Matching the return value will prevent the compiler from doing the optimization.
2015-01-30Prepare releaseErlang/OTP
2015-01-30Merge branch 'egil/fix-getifaddrs-realloc/OTP-12445' into maint-17Erlang/OTP
* egil/fix-getifaddrs-realloc/OTP-12445: erts: Fix getifaddrs realloc ptr mismatch
2015-01-30Merge branch 'egil/fix-child_setup-close/OTP-12446' into maint-17Erlang/OTP
* egil/fix-child_setup-close/OTP-12446: erts: Use closefrom() if available when closing fds erts: Don't close all fds twice in child_setup
2015-01-29erts: Fix getifaddrs realloc ptr mismatchBjörn-Egil Dahlberg
When a buffer was exhausted and subsequently a realloc, we could get an invalid pointer. For this to occur we would need to have a realloc to lower adresses. The symptom would be garbage returned from erlang:port_control(Port, 25, []) (prim_inet:getifaddrs(Port) resulting in a badarg) or a segmentation fault.
2015-01-27erts: Use closefrom() if available when closing fdsBjörn-Egil Dahlberg
closefrom() was only used in the vfork() case before, now also used in the fork() case.
2015-01-27erts: Don't close all fds twice in child_setupBjörn-Egil Dahlberg
The commit c2b4eab25c907f453a394d382c04cd04e6c06b49 introduced an error in which child_setup erroneously tried to close all file descriptors twice.
2015-01-26hipe: improve error handling at code allocation failureMikael Pettersson
2015-01-26hipe: remove two obsolete BIFsMikael Pettersson
The hipe_bifs:make_native_stub/2 and hipe_bifs:get_emu_address/1 BIFs were originally used by hipe_unified_loader.erl, but the code been obsolete and disabled for ages. Remove the BIFs and all references to them. In hipe_unified_loader.erl, remove the no-op emu_make_stubs/1 function.
2015-01-26hipe: remove HIPE_ALLOC_CODE macroMikael Pettersson
The HIPE_ALLOC_CODE macro in the HiPE runtime was introduced ages ago to allow x86 and amd64 to switch from erts_alloc() to an mmap() implementation with proper flag setting. Nowadays the macro is identical on all platforms, and serves no purpose. Delete the macro, move the hipe_alloc_code() prototype to hipe_arch.h, and simplify hipe_bifs_enter_code_2().
2015-01-23erts: Check driver version before assigning callbackBjörn-Egil Dahlberg
2015-01-23erts: Don't lookup invalid port for crashdump handlingBjörn-Egil Dahlberg
2015-01-23erts: Reserve a file descriptor for the crashdump fileBjörn-Egil Dahlberg
2015-01-23erts: Use emergency close to close epmdBjörn-Egil Dahlberg
Closes all open socket before writing crashdump to file.
2015-01-16Merge branch 'oliv3/math_log2/OTP-12411'Marcus Arendt
* oliv3/math_log2/OTP-12411: Add math:log2/1
2015-01-15Merge branch 'maint'Bruce Yinhe
2015-01-15Merge branch 'mikpe/hipe-arm-interworking' into maintBruce Yinhe
OTP-12405 * mikpe/hipe-arm-interworking: hipe: fix ARM/Thumb interworking
2015-01-14Add math:log2/1Olivier Girondel
2015-01-14Merge branch 'maint'Marcus Arendt
2015-01-14Merge branch 'dotsimon/sctp_paddrinfo_state' into maintMarcus Arendt
* dotsimon/sctp_paddrinfo_state: Fix inet:getopts involving #sctp_paddrinfo{}
2015-01-13erts: Extend driver interface with emergency_closeBjörn-Egil Dahlberg
The intention of this callback is to close all sockets associated to a port. It is closed only on crashdumps. This will currently only be used for the epmd port.
2015-01-11hipe: fix ARM/Thumb interworkingMikael Pettersson
HiPE on ARM is currently severely broken if the rest of the VM is compiled to run in Thumb mode -- calling native code quickly ends up executing code in the wrong mode and crashing the VM. This is a problem on e.g. Ubuntu which configures its system GCC to generate Thumb by default. It can also be triggered by overriding CC or CFLAGS when compiling the VM. There were three issues that caused the breakage: 1. Assembly-coded functions in hipe_arm_glue.S weren't explicitly tagged as functions, preventing the linker from generating the correct mode-switching call instructions for calls from C to these functions. Fixed by tagging those symbols as functions. 2. A few BIF wrappers were so simple that they performed tailcalls to the C BIFs. This fails to switch mode when C is in Thumb. Fixed by performing ordinary recursive calls when C is in Thumb. 3. The assembly-coded source files weren't explicitly tagged as ARM. Tested with the HiPE testsuite on ARMv7, with the VM built as ARM and as Thumb. Also manually inspected the object code for the beam executable and checked that call sites from C to HiPE's ARM runtime code and vice versa used the correct mode-switching instructions.
2014-12-22Merge branch 'maint'Bruce Yinhe
2014-12-22Merge branch 'mikpe/fix-eacces-spelling' into maintBruce Yinhe
* mikpe/fix-eacces-spelling: fix eacces spelling
2014-12-19Merge branch 'lukas/erts/crashdump_improvements/OTP-12377'Lukas Larsson
* lukas/erts/crashdump_improvements/OTP-12377: erts: Make main thread safe from pipe closed event erts: Improve crash dumps erts: Rename sys_sigset to sys_signal erts: Introduce thread suspend functions erts: Remove usage of QUANTIFY signal erts: Add support for thread names ets: Increase data available in crash dumps and ets:info erts: Start compilation of beam_emu earlier
2014-12-19erts: Make main thread safe from pipe closed eventLukas Larsson
2014-12-19erts: Improve crash dumpsLukas Larsson
This commit improves crash dumps in several ways: * Suspends schedulers to get a current snapshot * Dumps information about scheduler * Dumps stack trace of current running process (including Garbing processes)
2014-12-19erts: Rename sys_sigset to sys_signalLukas Larsson
Also removed old legacy fallback that is no longer used
2014-12-19erts: Introduce thread suspend functionsLukas Larsson
These functions allow any thread to suspend any other thread immediately and then resume all threads. This is useful when doing a crash dump in order to get a more accurate picture of what state the system is in.
2014-12-19erts: Remove usage of QUANTIFY signalLukas Larsson
2014-12-19erts: Add support for thread namesLukas Larsson
2014-12-19ets: Increase data available in crash dumps and ets:infoLukas Larsson
OTP-12376
2014-12-18Merge branch 'maint'Bruce Yinhe
2014-12-18Merge branch 'haguenau/fix-endianness-speling' into maintBruce Yinhe
* haguenau/fix-endianness-speling: Replaced "Endianess" with "Endianness" everywhere
2014-12-16Merge branch 'sverk/ets-take-2/OTP-12309'Sverker Eriksson
* sverk/ets-take-2/OTP-12309: erts: Optimize ets:lookup and ets:take for bags Implement ets:take/2
2014-12-16Merge branch 'sverk/ct-assert'Sverker Eriksson
* sverk/ct-assert: erts: Add compile time assert ERTS_CT_ASSERT
2014-12-16Merge branch 'lukas/erts/non-blocking-shell'Lukas Larsson
* lukas/erts/non-blocking-shell: erts: Fix big-endian issue with printf_putc