aboutsummaryrefslogtreecommitdiffstats
path: root/erts
AgeCommit message (Collapse)Author
2010-08-27Fix segmentation fault when dumping the crash log with hipe enabled and ↵Paul Guyot
natively compiled modules When loading a module, code area is allocated and header fields code[MI_ATTR_SIZE] as well as code[MI_COMPILE_SIZE] are not cleared. They are only set later when freeze_code is called, if the module has attributes and compilation info, which should always be the case. When loading a native module (as a stub), code is allocated as well (to contain the stub functions), and code[MI_ATTR_SIZE] as well as code[MI_COMPILE_SIZE] are not cleared either. Yet, freeze_code will not be called (since there is no threaded code to freeze for native modules), and as a result, these header fields are never set. They can contain any garbage. Later on, when writing a crash dump, the attributes and compilation info are dumped, using these particular header fields. If the size is garbage, the dump attribute function will iterate until it segfaults. The fix consists in clearing code[MI_ATTR_SIZE] and code[MI_COMPILE_SIZE] in both cases (threaded code and native code). Even if non-native modules should contain code and attributes and therefore the values code[MI_ATTR_SIZE] and code[MI_COMPILE_SIZE] should be set by freeze_code, it seems cleaner and easier to maintain to clear the whole the header in the "initialize code area" section. As a result, crash dump will not segfault. Instead, native modules will have an empty attributes and compilation info section in the crash dump.
2010-08-27fix native code crash when calling unloaded module with on_load functionMikael Pettersson
As reported in erlang-bugs, the following sequence of events crashes the VM: 1. Module M1 is loaded and in native mode. 2. Module M2 is not loaded, in emulated mode, and has an on_load function. 3. M1 calls some function in M2. This works. 4. M1 again calls some function in M2. This segfaults. The reason for the crash is that when the beam loader fixes up export entries after a successful on_load function call, it erroneously clears the ->code[3] field in that module's export entries. This is redundant (no code in beam relies on ->code[3] being NULL), inconsistent with modules without on_load functions (there ->code[3] remains a valid beam instruction after the module is loaded), and breaks native code which needs the old ->address value in an export entry to remain valid after a module load step (before the load ->address points to ->code[3], after the load ->address points to the real code but uses of the old ->address value remain so ->code[3] must remain valid). Thus the fix for the crash is to simply not clear ->code[3]. This patch fixes R14A and should also fix R13B04. (There does exist a performance bug in this area, but it is unrelated to the on_load feature so will be fixed separately.)
2010-08-27robustify hipe_bifs:get_hrvtime/0Mikael Pettersson
The HiPE runtime system has a hipe_bifs:get_hrvtime/0 BIF which mimics the non-standard gethrvtime() C API. It's possible to configure the implementation to use the "perfctr" Linux kernel extension for performance-monitoring counters, in which case get_hrvtime has very high precision and low overhead. Otherwise it uses the same code as runtime(statistics). This patch changes the get_hrvtime implementation to do a runtime check to see if perfctr is available, and to use the fallback code rather than returning a dummy value if perfctr is unavailable, which is common. The current dummy value return is a bug. It messes up the API and either breaks callers (they get badarg when trying to compute on the value) or forces them to implement checks and fallbacks themselves. Timing code in HiPE's test suites and benchmarks is known to be affected.
2010-08-24Merge branch 'rickard/nptl-configure/OTP-8774' into devRickard Green
* rickard/nptl-configure/OTP-8774: Removed unused define Fix propagation of nptl info
2010-08-24Merge branch 'rickard/erts-poll-race/OTP-8773' into devRickard Green
* rickard/erts-poll-race/OTP-8773: Fix race in erts_poll()
2010-08-20Fix race in erts_poll()Rickard Green
A race condition in erts_poll() could cause delay of poll for I/O.
2010-08-20Merge branch 'ms/suppress-epmd-startup-message' into devBjörn Gustavsson
* ms/suppress-epmd-startup-message: epmd: suppress startup message OTP-8775
2010-08-20Merge branch 'bjorn/solaris-fp-exception' into devBjörn Gustavsson
* bjorn/solaris-fp-exception: Solaris/x86: Handle floating point exceptions properly in driver threads
2010-08-20Merge branch 'bjorn/remove-elib_malloc/OTP-8764' into devBjörn Gustavsson
* bjorn/remove-elib_malloc/OTP-8764: erts: Remove broken elib_malloc erts: Remove the unused mem_drv driver erts: Remove stray pre-ISO-C compatibility macros erts: Remove unused decl.h
2010-08-19Removed unused defineRickard Green
2010-08-19Fix propagation of nptl infoRickard Green
2010-08-19Merge branch 'rickard/fix-faulty-assert/OTP-8759' into devRickard Green
* rickard/fix-faulty-assert/OTP-8759: Fix faulty no_empty_run_queues assertion
2010-08-19Remove binary overhead counter from ets objectsPatrik Nyblom
As the overhead counter got larger and never really was needed in ets objects, I removed them. A few stray comments of XXX:PaN type from halfword dev removed in the process.
2010-08-19Merge branch 'hb/type_reference/OTP-8733' into devHans Bolinder
* hb/type_reference/OTP-8733: reference() substituted for ref() in docs
2010-08-18Make it possible to reread and update detected CPU informationRickard Green
Calling erlang:system_info/1 with the new argument 'update_cpu_info' will make the runtime system reread and update the internally stored CPU information. For more information see the documentation of erlang:system_info(update_cpu_info).
2010-08-17Solaris/x86: Handle floating point exceptions properly in driver threadsBjörn Gustavsson
On Solaris/x86, the floating point exceptions bits seems to be propagated to child threads, so if scheduler threads use floating points exceptions, also driver threads will have floating points exception enabled. The problem is that erts_thread_init_float() has not been called for driver threads, and because of that matherr() will crash when called. Fix matherr() so that it will work even if erts_thread_init_float() has not been called. This fix was suggested by Mikael Pettersson.
2010-08-17erts: Remove broken elib_mallocBjörn Gustavsson
elib_malloc is an alternate memory allocator that is no longer possible to build.
2010-08-17erts: Remove the unused mem_drv driverBjörn Gustavsson
The mem_drv driver was only useful when elib_malloc was active.
2010-08-17erts: Remove stray pre-ISO-C compatibility macrosBjörn Gustavsson
A long time ago, the Erlang run-time system could be build with pre-ANSI/ISO-C (K&R) C compilers, but that is no longer possible. Remove the remaining uses of the compatibility macros that made it possible that possible.
2010-08-14erts: Remove unused decl.hBjörn Gustavsson
The header file erts/emulator/beam/decl.h is no longer used.
2010-08-13Add support for NetBSDMartti Kuparinen
These are the current NetBSD pkgsrc patches.
2010-08-13fix hipe_bifs_alloc_data_2 to avoid "Yikes!" warningMikael Pettersson
It's been reported that HiPE-enabled Erlang VMs running on BSD systems sometimes generate messages like Yikes! erts_alloc() returned misaligned address 0x8016a512c These originate from hipe_bif0.c:hipe_bifs_alloc_data_2(). A native code module has an associated data area of some size and alignment. In the case where the size is zero, the alignment is irrelevant, but the allocation BIF checks it anyway. The warning then triggers on systems where malloc(0) returns blocks with less alignment than we (erroneously) expected. The fix is to simply skip the allocation in this case and return NULL. The loader won't actually use the address in this case so that's safe. This is also an optimization since it avoids allocating memory that cannot be used, and it avoids fragmenting the system heap with useless tiny blocks. A second problem is that the warning message failed to identify its origin. Fixed by prefixing the message by the BIF's name rather than the silly Yikes! string. Tested and confirmed to solve the original reporter's problem.
2010-08-12Increase vheap counter to Uint64Björn-Egil Dahlberg
This will reduce the risk of integer wrapping in bin vheap counting. The vheap size series will now use the golden ratio instead of doubling and fibonacci sequences. OTP #8730
2010-08-12Fix wrapping in next vheap calculationBjörn-Egil Dahlberg
OTP #8730
2010-08-12Merge branch 'bjorn/remove-obsolete-driver-support/OTP-8758' into devBjörn Gustavsson
* bjorn/remove-obsolete-driver-support/OTP-8758: Remove obsolete/driver.h and the associated functionality
2010-08-11Fix faulty no_empty_run_queues assertionRickard Green
For a short period of time no_empty_run_queues may have been increased twice for a specific run queue. Two assertions did not take this into account.
2010-08-11Make windows 64bit types be declared more consistentlyPatrik Nyblom
2010-08-11Remove obsolete/driver.h and the associated functionalityBjörn Gustavsson
The obsolete/driver.h header file has been obsolete since R8B. Remove that file, along with obsolete thread APIs for drivers in the emulator and the test cases.
2010-08-10Teach Windows about the int64 functionsPatrik Nyblom
2010-08-10Merge branch 'rickard/trailing-data-alignment/OTP-8754' into devRickard Green
* rickard/trailing-data-alignment/OTP-8754: Align trailing message data for all types of structures
2010-08-10Merge branch 'rickard/ethread-rewrite/OTP-8544' into devRickard Green
* rickard/ethread-rewrite/OTP-8544: Rewrite ethread library
2010-08-10Rewrite ethread libraryRickard Green
Large parts of the ethread library have been rewritten. The ethread library is an Erlang runtime system internal, portable thread library used by the runtime system itself. Most notable improvement is a reader optimized rwlock implementation which dramatically improve the performance of read-lock/read-unlock operations on multi processor systems by avoiding ping-ponging of the rwlock cache lines. The reader optimized rwlock implementation is used by miscellaneous rwlocks in the runtime system that are known to be read-locked frequently, and can be enabled on ETS tables by passing the `{read_concurrency, true}' option upon table creation. See the documentation of `ets:new/2' for more information. The ethread library can now also use the libatomic_ops library for atomic memory accesses. This makes it possible for the Erlang runtime system to utilize optimized atomic operations on more platforms than before. Use the `--with-libatomic_ops=PATH' configure command line argument when specifying where the libatomic_ops installation is located. The libatomic_ops library can be downloaded from: http://www.hpl.hp.com/research/linux/atomic_ops/ The changed API of the ethread library has also caused modifications in the Erlang runtime system. Preparations for the to come "delayed deallocation" feature has also been done since it depends on the ethread library. Note: When building for x86, the ethread library will now use instructions that first appeared on the pentium 4 processor. If you want the runtime system to be compatible with older processors (back to 486) you need to pass the `--enable-ethread-pre-pentium4-compatibility' configure command line argument when configuring the system.
2010-08-07Align trailing message data for all types of structuresRickard Green
Alignment of trailing data in messages has been adjusted. This in order to be able to pass data of any type as trailing data in the future.
2010-08-04epmd: suppress startup messageMichael Santos
Running transient distributed Erlang nodes can generate a large number of informational messages to syslog. Modify epmd to log the startup message only when passed the debug switch. Reported-By: Sergey Samokhin
2010-07-30Fix libm linking with --as-needed flagBjörn-Egil Dahlberg
When building with "--as-needed" linker flags on Linux the build will fail. This has now been fixed.
2010-07-26inet: fix getservbyname buffer overflowMichael Santos
The byte holding the length of the interface name for the getservbyname/2 function is used in a signed context and can become negative, causing the buffer to be overrun. Make the same change for getservbyport/2. Test case: inet:getservbyname(list_to_atom(lists:flatten(lists:duplicate(128, "x"))), tcp).
2010-07-26inet: fix ifr_name buffer overflowMichael Santos
The byte holding the length of the interface name for the ifget/2 functions is used in a signed context and can become negative, causing the ifreq.ifr_name buffer to be overrun. Test case: inet:ifget(lists:duplicate(128, "x"), [addr]).
2010-07-26inet: null terminate ifr_name bufferMichael Santos
The buffer holding the interface name should be null terminated. See man 7 socket on Linux or the definition of IFNAMSIZ in net/if.h on FreeBSD: Length of interface external name, including terminating '\0'.
2010-07-23Teach XP to ignore virtualization part of manifestPatrik Nyblom
ld.sh built files not executable on XP, as parts of the manifest were incomprehensible for XP machines.
2010-07-23NIF doc official support noteSverker Eriksson
2010-07-23NIF 64-bit integer supportSverker Eriksson
2010-07-22Turn off windows "virtualiztion"Sverker Eriksson
2010-07-22Mending halfword heap emulatorSverker Eriksson
2010-07-20Merge branch 'sverker/one_offheap_list/OTP-8737' into devSverker Eriksson
* sverker/one_offheap_list/OTP-8737: One off-heap list, to eliminate two words per ETS object.
2010-07-20One off-heap list, to eliminate two words per ETS object.Sverker Eriksson
Merging the three off-heap lists (binaries, funs and externals) into one list. This reduces memory consumption by two words (pointers) per ETS object.
2010-07-20Merge branch 'sverker/ets_select_hang/OTP-8732' into devSverker Eriksson
* sverker/ets_select_hang/OTP-8732: Fix ets:select hanging on ordered_set with empty list as key.
2010-07-08Merge branch 'sverker/full_INTEGER_EXT/OTP-8540' into devSverker Eriksson
* sverker/full_INTEGER_EXT/OTP-8540: term_to_binary use all 32 bits of INTEGER_EXT
2010-07-08Merge branch 'sverker/driver_int64_bug/OTP-8716' into devSverker Eriksson
* sverker/driver_int64_bug/OTP-8716: Fix bug that caused faulty 64-bit integers from drivers.
2010-07-08nif_SUITE send3 stress testSverker Eriksson
2010-07-08reference() substituted for ref() in docsHans Bolinder