aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
AgeCommit message (Collapse)Author
2010-04-14MacOS X: Boost default stack sizeBjörn Gustavsson
The default stack size on MacOS X for the SMP emulator is too small to support all uses of pcre. For example, the following expression N = 819, re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]). will cause a stack overflow. By bisection of different values for the +sss option, I found that 166 is the smallest value that avoids the crash. Round that up to 256 to give a nice, round power of 2 and a resonable safety margin. Use that value as a default stack size on MacOS X only.
2010-04-14Fix check for compile workspace overflowMichael Santos
Patch from: http://vcs.pcre.org/viewvc/code/trunk/pcre_compile.c?r1=504&r2=505&view=patch Test case: N = 819, re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]). Compiling large regular expressions could overflow the workspace buffer. Modify the test to check for a value smaller than the buffer size.
2010-04-13Merge branch 'bg/fconv' into devErlang/OTP
* bg/fconv: erts: Fix loading of modules with invalid floating point arithmetic
2010-04-08system_info(procs): Fix the value for "OldHeap unused"Satoshi Kinoshita
The value for "OldHeap unused" in the output of erlang:system_info(procs) and in crash dumps, was incorrectly calculated as the size of the entire old heap.
2010-04-07erts: Fix loading of modules with invalid floating point arithmeticBjörn Gustavsson
The following program is supposed to cause an exception at run-time: foo() -> Sum1 = Sum2 = N = 2, pSum - (Sum1*(Sum2/N)). but the loader fails to load because it contains the following instruction: fconv {atom,pSum} {fr,2} Fix the loader so that it can handle fconv instructions where the first operand is a non-numeric literal. Reported-by: Torbjörn Törnkvist
2010-03-30Merge branch 'se/decode_packet' into devErlang/OTP
* se/decode_packet: Fix erlang:decode_packet(httph_bin,..) to not return faulty header strings OTP-8548 se/decode_packet erlang:decode_packet(httph_bin,..) could return corrupt header strings or even crash the VM. This has been fixed. It only happened on 32-bit VM if the header name was unknown and between 16 and 20 characters long. Sockets with simular packet option did not suffer from this bug.
2010-03-29Fix erlang:decode_packet(httph_bin,..) to not return faulty header stringsSverker Eriksson
Unrecognized Http header names was sometimes returned as corrupt sub-binaries pointing to a stack allocated buffer. This only happened on 32-bit VM if the header name was between 16 and 20 characters long. It could in some cases lead to segmentation fault. The solution was to avoid creating sub-binary if the returned string was not part of the original binary.
2010-03-25Merge branch 'bg/compiler-remove-r11-support' into devErlang/OTP
* bg/compiler-remove-r11-support: compiler: Don't support the no_binaries option erts: Don't support the put_string/3 instruction compiler: Don't support the no_constant_pool option compiler: Don't support the r11 option test_server: Don't support communication with R11 nodes binary_SUITE: Don't test bit-level binary roundtrips with R11 nodes erts: Test compatibility of funs with R12 instead of R11 OTP-8531 bg/compiler-remove-r11-support
2010-03-22erts: Don't support the put_string/3 instructionBjörn Gustavsson
Since R14 does not need to load code that can also be loaded in an R11 run-time system, support for the put_string/3 instruction can be removed.
2010-03-22binary_SUITE: Don't test bit-level binary roundtrips with R11 nodesBjörn Gustavsson
2010-03-22erts: Test compatibility of funs with R12 instead of R11Björn Gustavsson
2010-03-22Merge branch 'pan/otp_8332_halfword' into devErlang/OTP
* pan/otp_8332_halfword: Teach testcase in driver_suite the new prototype for driver_async wx: Correct usage of driver callbacks from wx thread Adopt the new (R13B04) Nif functionality to the halfword codebase Support monitoring and demonitoring from driver threads Fix further test-suite problems Correct the VM to work for more test suites Teach {wordsize,internal|external} to system_info/1 Make tracing and distribution work Turn on instruction packing in the loader and virtual machine Add the BeamInstr data type for loaded BEAM code Fix the BEAM dissambler for the half-word emulator Store pointers to heap data in 32-bit words Add a custom mmap wrapper to force heaps into the lower address range Fit all heap data into the 32-bit address range
2010-03-12Teach testcase in driver_suite the new prototype for driver_asyncPatrik Nyblom
The testcase core dunmped. Also made sure the key could actually store long integers in driver_async (which is more of a cosmetic change).
2010-03-10Adopt the new (R13B04) Nif functionality to the halfword codebasePatrik Nyblom
Change erl_int_sizes_config to include HALFWORD_HEAP_EMULATOR, which make it possible for the NIFs to figure out the term size.
2010-03-10Support monitoring and demonitoring from driver threadsPatrik Nyblom
The driver in the wx application does monitoring (and demonitoring) from non-scheduler threads. In the non-half-word emulators, data will be modified without the protection of a lock (which is potentially bad), but the half-word emulator will crash in that situation. While at it, also correct an old bug which make assertions fail in the Kernel test suite.
2010-03-10Fix further test-suite problemsPatrik Nyblom
Fix safe_mul in the loader, which caused failures in the bit syntax test cases. Fix yet another Uint in erl_alloc.h (ERTS_CACHE_LINE_SIZE) causing segmentation fault when we have many schedulers (why only in that situation?). Clean up erl_mseg (remove old code for the Linux 32-bit mmap flag). While at it, also remove compilation warnings.
2010-03-10Correct the VM to work for more test suitesPatrik Nyblom
The following test suites now work: send_term_SUITE trace_nif_SUITE binary_SUITE match_spec_SUITE node_container_SUITE beam_literals_SUITE Also add a testcases for system_info({wordsize,internal|external}).
2010-03-10Teach {wordsize,internal|external} to system_info/1Patrik Nyblom
Some test suites need to differentiate between 32-bit terms and 32-bit pointers. While at it, remove some more warnings in process.c for SMP and debug.
2010-03-10Make tracing and distribution workPatrik Nyblom
Rewrite trace code and external coding. Also slightly correct the interface to the match-spec engine to make tracing work. That will make the test suites runnable.
2010-03-10Turn on instruction packing in the loader and virtual machinePatrik Nyblom
2010-03-10Add the BeamInstr data type for loaded BEAM codePatrik Nyblom
For cleanliness, use BeamInstr instead of the UWord data type to any machine-sized words that are used for BEAM instructions. Only use UWord for untyped words in general.
2010-03-10Fix the BEAM dissambler for the half-word emulatorPatrik Nyblom
2010-03-10Store pointers to heap data in 32-bit wordsPatrik Nyblom
Store Erlang terms in 32-bit entities on the heap, expanding the pointers to 64-bit when needed. This works because all terms are stored on addresses in the 32-bit address range (the 32 most significant bits of pointers to term data are always 0). Introduce a new datatype called UWord (along with its companion SWord), which is an integer having the exact same size as the machine word (a void *), but might be larger than Eterm/Uint. Store code as machine words, as the instructions are pointers to executable code which might reside outside the 32-bit address range. Continuation pointers are stored on the 32-bit stack and hence must point to addresses in the low range, which means that loaded beam code much be placed in the low 32-bit address range (but, as said earlier, the instructions themselves are full words). No Erlang term data can be stored on C stacks (enforced by an earlier commit). This version gives a prompt, but test cases still fail (and dump core). The loader (and emulator loop) has instruction packing disabled. The main issues has been in rewriting loader and actual virtual machine. Subsystems (like distribution) does not work yet.
2010-03-10Add a custom mmap wrapper to force heaps into the lower address rangePatrik Nyblom
The free list is still rudimentary for the mmap wrapper and a better implementation will be needed for production quality.
2010-03-10Fit all heap data into the 32-bit address rangePatrik Nyblom
This is the first step in the implementation of the half-word emulator, a 64-bit emulator where all pointers to heap data will be stored in 32-bit words. Code specific for this emulator variant is conditionally compiled when the HALFWORD_HEAP define has a non-zero value. First force all pointers to heap data to fall into a single 32-bit range, but still store them in 64-bit words. Temporary term data stored on C stack is moved into scheduler specific storage (allocated as heaps) and macros are added to make this happen only in emulators where this is needed. For a vanilla VM the temporary terms are still stored on the C stack.
2010-03-10OTP-8475 status lock needed when looking up ioq from async threadsRickard Green
Driver threads, such as async threads, using <seealso marker="erl_driver#ErlDrvPDL">port data locks</seealso> peeked at the port status field without proper locking when looking up the driver queue.
2010-03-10OTP-8487 unregister/1 on a port can cause the non-smp runtime to crashRickard Green
A call to the BIF unregister(RegName) when a port had the name RegName registered in the runtime system without SMP support caused a runtime system crash. (Thanks to Per Hedeland for the bugfix and test case.)
2010-02-18OTP-8451 Harmless buffer overflow by one byte in asn1 and ram_file_drv.Sverker Eriksson
2010-02-12Merge branch 'ms/pcre-security' into ccase/r13b04_devErlang/OTP
* ms/pcre-security: Fix CVE-2008-2371 (outer level option with alternatives caused crash). OTP-8438 The re module: A regular expression with an option change at the start of a pattern that had top-level alternatives could cause overwriting and/or a crash. (Thanks to Michael Santos.)
2010-02-11Merge branch 'ks/erts' into ccase/r13b04_devErlang/OTP
* ks/erts: hipe_bif0.c: Remove $Id$ erts/preloaded: Add types and specs
2010-02-11hipe_bif0.c: Remove $Id$Kostis Sagonas
2010-02-11OTP-8335 Even more NIF featuresSverker Eriksson
2010-02-11Fix CVE-2008-2371 (outer level option with alternatives caused crash).Michael Santos
The patch is from: http://vcs.pcre.org/viewvc?revision=360&view=revision Test case: re:compile(<<"(?i)[\xc3\xa9\xc3\xbd]|[\xc3\xa9\xc3\xbdA]">>, [unicode]). An option change at the start of a pattern that had top-level alternatives could cause overwriting and/or a crash. This potential security problem was recorded as CVE-2008-2371.
2010-02-10OTP-8420 Fix processes in exiting status that are about to be scheduled,Björn-Egil Dahlberg
to not be allowed to garbage collect.
2010-02-10Merge branch 'egil/lcnt' into ccase/r13b04_devErlang/OTP
* egil/lcnt: Add test suite for lcnt in tools Add lcnt:rt_opt/1 bindings to erts_debug Add runtime option to enable/disable lcnt stats Add auto width on string output Add lcnt documentation Add lock profiling tool OTP-8424 Add lock profiling tool. The Lock profiling tool, lcnt, can make use of the internal lock statistics when the runtime system is built with this feature enabled. This provides a mechanism to examine potential lock bottlenecks within the runtime itself. - Add erts_debug:lock_counters({copy_save, bool()}). This option enables or disables statistics saving for destroyed processes and ets-tables. Enabling this might consume a lot of memory. - Add id-numbering for lock classes which is otherwise undefined.
2010-02-08Add runtime option to enable/disable lcnt statsBjörn-Egil Dahlberg
Add erts_debug:lock_counters({copy_save, bool()}). This option enables or disables statistics saving for destroyed processes and ets-tables. Enabling this might consume a lot of memory. Add id-numbering for lock classes which is otherwise undefined.
2010-02-08Merge branch 'gc/hipe_darwin_amd64' into ccase/r13b04_devErlang/OTP
* gc/hipe_darwin_amd64: Fix hipe memory allocation problems on darwin/amd64 Porting x86 darwin fixes to amd64 darwin hipe asm/m4 code Automatically enable hipe for darwin/amd64 builds Allow configure to enable_hipe for darwin/amd64 builds OTP-8416 HiPE now works in the 64-bit emulator on Mac OS X. (Thanks to Geoff Cant.)
2010-02-08OTP-8412 Fixed numerous compiler warnings generated by gcc 4.4.1 andRickard Green
tile-cc 2.0.1.78377 when compiling the runtime system.
2010-02-06Fix hipe memory allocation problems on darwin/amd64Geoff Cant
HiPE on amd64 needs to be able to allocate memory in the 0x20000000+ range so that compiled code will be addressable with 32bit pointers (when sign extended). By default, when building 64bit executables on OS X, PAGEZERO occupies the first 4GB of virtual memory. The PAGEZERO segment cannot be mmap(ed) or vm_allocate(d) into. To avoid this problem we use the -pagezero_size linker flag to reduce the size of PAGEZERO and free up the 0x20000000+ space.
2010-02-06Porting x86 darwin fixes to amd64 darwin hipe asm/m4 codeGeoff Cant
Compared to GNU as, Mac OS X's assembler uses different directives for text and global sections, and omits type and size directives entirely. We also need to mangle symbol names in order to allow linking with C object files.
2010-02-05Fixed erroneous assertion.Rickard Green
2010-02-04Fixed an erroneous assertion.Rickard Green
2010-02-03Merge branch 'jb/atom-table-size' into ccase/r13b04_devErlang/OTP
* jb/atom-table-size: Add the +t emulator option to change the maximum number of atoms OTP-8405 There is a new +t emulator option for changing the maximum number of atoms. (Thanks to Julien Barbot.)
2010-02-03OTP-8386 Immediately repeated multi-scheduling block/unblock cycles usingRickard Green
erlang:system_flag(multi_scheduling, block | unblock) could deadlock the runtime system.
2010-02-02Add the +t emulator option to change the maximum number of atomsJulien Barbot
It is now possible to increase or decrease the maximum number of atoms the VM can handle. The default value is 1048576 (1024*1024).
2010-01-31hipe_mfait_lock needs to be below proc_main.Rickard Green
2010-01-30Merge branch 'mp/hipe-smp-fixes' into ccase/r13b04_devErlang/OTP
* mp/hipe-smp-fixes: work around hipe_mfa_info_table lock omission fix hipe loader SMP non-atomicity error OTP-8397 The loading of native code was not properly atomic in the SMP emulator, which could cause crashes. Also a per-MFA information table for the native code has now been protected with a lock since it turns that it could be accessed concurrently in the SMP emulator. (Thanks to Mikael Pettersson.)
2010-01-27work around hipe_mfa_info_table lock omissionMikael Pettersson
HiPE maintains per-MFA information such as native code entry point in a table. This table was thought to be read-only at runtime, except when the loader populates it, so it employed no locking. That turned out to be incorrect: if there is an apply of a previously unseen MFA, a native code stub for that MFA is created and recorded in the table, causing it to grow. Work around this for now by slapping a mutex around accesses to that table. Signed-off-by: Mikael Pettersson <[email protected]>
2010-01-27Fix re:replace/4 to handle unicode charlist RE argumentPatrik Nyblom
The real problem is in the re:run/3 BIF. Noticed-by: Rory Byrne Tests-by: Rory Byrne
2010-01-25Merge branch 'ta/os_timestamp_no_mutex' into ccase/r13b04_devErlang/OTP
* ta/os_timestamp_no_mutex: Remove mutex lock around sys_gettimeofday() in os:timestamp/0 OTP-8390 An unecessary lock operation in os:timestamp/0 has been eliminated, making it slightly more efficient. (Thanks to Jonas Falkevik and Tuncer Ayaz.)