aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2016-01-13erts: Make erlang:purge_module/1 safeSverker Eriksson
Problem: erlang:purge_module/1 is not safe in the sense that very bad things may happen if the code to be purged is still referred to by live processes. Introduce erts_internal:purge_module which is the same as the old erlang:purge_module BIF (except it returns false if no such old module). Implement erlang:purge_module in Erlang and let it invoke erts_code_purger for safe purging where all clogging processes first are killed.
2016-01-13erts: Refactor code:purge/1 and code:soft_purge/1Sverker Eriksson
by moving code from code_server to erts_code_purger. This is more or less a copy-paste from code_server.erl to erts_code_purger.erl. All the inner mechanics of code:purge/1 and code:soft_purge/1 are unchanged.
2016-01-13erts: Introduce erts_code_purgerSverker Eriksson
as a system process with preloaded code.
2016-01-11Merge branch 'maint'Henrik Nord
Conflicts: OTP_VERSION
2016-01-11Merge branch 'maint-18' into maintHenrik Nord
2016-01-11Merge branch 'maint'Björn Gustavsson
* maint: Eliminate crash in v3_codegen
2016-01-11Eliminate crash in v3_codegenBjörn Gustavsson
The following code would crash v3_codegen: order(From) -> catch if From#{[] => sufficient} -> saint end. Before explaining the crash, first some background on the stack frame and the Y registers. Certain instructions, most notably the 'call' instructions, clobber all X registers. Before any such instruction, all X registers that have values that will be used after the call must be saved to Y registers (i.e. to the stack frame). adjust_stack/4 will be called when X registers must be saved. There is also another situation when X registers must be saved, namely within a 'catch' if we are about to execute any instruction that may cause an exception. Examples of such instructions are some guard BIFs (such as length/1) and construction of binaries or maps. Within a 'catch', X registers must be be saved because if an exception is thrown and catched all X registers will be destroyed. The same adjust_stack/4 function will be called for those instructions, but only if they occur within a 'catch'. There is actually one more complication. If there is code in a guard within a catch, the X registers should not be saved, because the code in a guard never clobbers any X registers that were alive before the guard code was entered. v3_codegen is written with the implicit assumption that code in guards never cause anything to be saved to Y registers. The code for building maps and binaries would incorrectly save X registers within a guard inside a 'catch'. For construction of binaries, that would mean that a useless but harmelss 'move' instruction was generated. But for construction of maps, the saving of the Y register would not be harmless. There would be a crash when attempting to merge #sr{} records. #sr{} records keeps track of the contents of X and Y registers. When two separate code paths are joined (e.g. at the end of 'case' statement), the register descriptors must be reconciled. Basically, the register descriptors for both paths must be identical. The #sr{} record for one path must not claim that {y,0} contains a certain value, while another path claims that {y,0} is dead. Thus, the crash occurs in sr_merge/2 when failing to reconcile the Y registers. To fix this bug this bug we will introduce a new function called maybe_adjust_stack/5. It will save X registers on the stack only if the code is inside a catch but not inside a guard. We will change all existing code to use this new function when appropriate. Reported-by: Thomas Arts
2016-01-08Update release notesErlang/OTP
2016-01-08ssh: update vsn.mk to 4.2.1Hans Nilsson
2016-01-08ssh: handle secondary ssh_msg_userauth_info_request messageHans Nilsson
2016-01-08ssh: testcase for abnormal keyboard-interactive authenticationHans Nilsson
2016-01-08Merge branch 'maint'Björn Gustavsson
* maint: beam_bool: Fix unsafe optimization
2016-01-07Merge branch 'sverk/proc-dict-opt'Sverker Eriksson
OTP-13167 * sverk/proc-dict-opt: erts: Add new test case pdict_SUITE:mixed erts: Add 'fill_heap' to erts_debug:state_internal_state erts: Rename proc dict size to arraySize erts: Refactor proc dict with 'usedSlots' erts: Add sizeMask for faster proc dict indexing erts: Remove ProcDict.used erts: Add proc dict macros ERTS_PD_START/SIZE erts: Optimize away function "array_put" in proc dict erts: Optimize hashing in process dictionary
2016-01-07Merge branch 'bjorn/compiler/beam_bool/OTP-13208' into maintBjörn Gustavsson
* bjorn/compiler/beam_bool/OTP-13208: beam_bool: Fix unsafe optimization
2016-01-07beam_bool: Fix unsafe optimizationBjörn Gustavsson
beam_bool would make the following code unsafe (which would be reported by beam_validator): scotland(Echo) -> found(case Echo of Echo when true; Echo, Echo, Echo -> Echo; echo -> [] end, Echo = placed). found(_, _) -> million. Basically, beam_bool would see that the 'case' would always return the value of Echo. Thus: scotland(Echo) -> found(Echo, Echo = placed). The only problem is that beam_bool would also remove a 'move' instruction that would save Echo to the stack. Here is the assembly code for part of the function: {allocate_zero,1,1}. {move,{x,0},{y,0}}. %% Save Echo on stack. {bif,'=:=',{f,7},[{x,0},{atom,true}],{x,1}}. {bif,'=:=',{f,7},[{x,0},{atom,true}],{x,2}}. {bif,'=:=',{f,7},[{x,0},{atom,true}],{x,3}}. {bif,'and',{f,7},[{x,2},{x,3}],{x,2}}. {bif,'and',{f,7},[{x,1},{x,2}],{x,1}}. {jump,{f,8}}. {label,7}. {move,{atom,false},{x,1}}. {label,8}. {bif,'or',{f,6},[{atom,true},{x,1}],{x,1}}. {test,is_eq_exact,{f,6},[{x,1},{atom,true}]}. %% Jump never taken. {jump,{f,5}}. {label,6}. {test,is_eq_exact,{f,9},[{x,0},{atom,echo}]}. {move,nil,{x,0}}. {jump,{f,5}}. {label,9}. {test_heap,3,0}. {put_tuple,2,{x,0}}. {put,{atom,case_clause}}. {put,{y,0}}. {line,[{location,"t.erl",5}]}. {call_ext,1,{extfunc,erlang,error,1}}. {jump,{f,5}}. {label,5}. {test,is_eq_exact,{f,12},[{atom,placed},{y,0}]}. beam_bool would see that the is_eq_exact test at label 8 would always succeed. It could therefore remove most of the code before the jump to label 5. Unfortunately it also removed the essential move of Echo to the stack: {allocate_zero,1,1}. %% Instruction incorrectly removed: {move,{x,0},{y,0}}. {jump,{f,5}}. {label,5}. {test,is_eq_exact,{f,12},[{atom,placed},{y,0}]}. The root cause of the problem is that the 'move' instruction is included in the block of 'bif' instructions before label 8. Normally the 'move' instruction would not have been discarded, but because the left operand to the 'or' BIF is 'true', the entire block with 'bif' instructions are dropped. As far as I can see, there is no gain by including 'move' instructions in the first place. There is no way that better code will be produced. In fact, the entire optimization can be given up if 'move' instructions are found in the block. Thus we can fix this bug by never including any 'move' instructions in the block of 'bif' instructions. We can also remove all the code that deals with 'move' instructions within blocks. Reported-by: Thomas Arts
2015-12-28Merge branch 'maint'Zandra
2015-12-28Merge branch 'legoscia/tls_dist_error_reporting' into maintZandra
* legoscia/tls_dist_error_reporting: Report bad options for outgoing TLS distribution Save error reasons for TLS distribution connections Report bad options for TLS distribution connections OTP-13219
2015-12-28Merge branch 'maint'Zandra
2015-12-28Merge branch 'josevalim/jv-map-fun-eval-maint' into maintZandra
* josevalim/jv-map-fun-eval-maint: Use full list of bindings when matching on map keys OTP-13218
2015-12-28Merge branch 'maint'Zandra
2015-12-28Merge branch 'lucafavatella/dialyzer-fun-call' into maintZandra
* lucafavatella/dialyzer-fun-call: Teach Dialyzer call to funs `M:F/A` (literal M, F, A) OTP-13217
2015-12-22Merge branch 'maint'Anders Svensson
2015-12-22Merge branch 'maint-17' into maintAnders Svensson
2015-12-22Merge branch 'maint'Hans Nilsson
* maint: ssh: clean test specs
2015-12-22ssh: clean test specsHans Nilsson
2015-12-22Merge branch 'maint'Hans Nilsson
* maint: ssh: add econnaborted to disconnect msgs in test suite ssh: fix the check that open-ssh supports certain pubkeys in a test suite
2015-12-22Merge branch 'hans/ssh/cuddle_tests' into maintHans Nilsson
* hans/ssh/cuddle_tests: ssh: add econnaborted to disconnect msgs in test suite ssh: fix the check that open-ssh supports certain pubkeys in a test suite
2015-12-22Merge branch 'maint'Hans Nilsson
* maint: ssh: fix error (wrong suite) in test/ssh.spec
2015-12-22ssh: fix error (wrong suite) in test/ssh.specHans Nilsson
2015-12-21Merge branch 'maint'Hans Nilsson
* maint: ssh: benchmark all common kex and cipher algorithms New structure of the report ssh: ssh_benchmark_SUITE re-organized ssh: Add first version of ssh_benchmark_SUITE
2015-12-21ssh: benchmark all common kex and cipher algorithmsHans Nilsson
2015-12-21New structure of the reportHans Nilsson
2015-12-21ssh: ssh_benchmark_SUITE re-organizedHans Nilsson
2015-12-21ssh: Add first version of ssh_benchmark_SUITEHans Nilsson
2015-12-20Update release notesErlang/OTP
2015-12-20Merge branch 'anders/diameter/17.5.6.7/OTP-13211' into maint-17Erlang/OTP
* anders/diameter/17.5.6.7/OTP-13211: vsn -> 1.9.2.2 Update/fix appup for 17.5.6.7 Be resilient to diameter_service state upgrades
2015-12-20Merge branch 'anders/diameter/request_leak/OTP-13137' into maint-17Erlang/OTP
* anders/diameter/request_leak/OTP-13137: Fix request table leak at retransmission Fix request table leak at exit signal
2015-12-20Merge branch 'anders/diameter/17/watchdog/OTP-12969' into maint-17Erlang/OTP
* anders/diameter/17/watchdog/OTP-12969: Fix watchdog function_clause
2015-12-20Merge branch 'anders/diameter/M-bit/OTP-12947' into maint-17Erlang/OTP
* anders/diameter/M-bit/OTP-12947: Add service_opt() strict_mbit
2015-12-20vsn -> 1.9.2.2Anders Svensson
2015-12-20Update/fix appup for 17.5.6.7Anders Svensson
OTP-12947 strict_mbit OTP-12969 watchdog function_clause OTP-13137 request leak diameter_config (that allows the new option) should be loaded after the others. Anchor was missing from one regexp. Patches did not accumulate through older versions.
2015-12-20Be resilient to diameter_service state upgradesAnders Svensson
By not failing in code that looks up state: pick_peer and service_info.
2015-12-18ssh: add econnaborted to disconnect msgs in test suiteHans Nilsson
2015-12-18ssh: fix the check that open-ssh supports certain pubkeys in a test suiteHans Nilsson
2015-12-18Merge branch 'bjorn/deprecate-random/OTP-12502'Björn Gustavsson
* bjorn/deprecate-random/OTP-12502: test_server tests: Update test cases to cope with use of 'rand'
2015-12-17Merge branch 'sverk/crypto/aes-ecb-192-bit'Sverker Eriksson
OTP-13207 * sverk/crypto/aes-ecb-192-bit: crypto: Support 192-bit keys for AES ECB
2015-12-17crypto: Support 192-bit keys for AES ECBAndrew Bennett
2015-12-17Merge branch 'sverk/crypto/aes-cbc-192-bit'Sverker Eriksson
OTP-13206 * sverk/crypto/aes-cbc-192-bit: crypto: Support 192-bit keys for AES CBC
2015-12-17Merge branch 'sverk/crypto/evp-aes-gcm'Sverker Eriksson
OTP-13205 * sverk/crypto/evp-aes-gcm: crypto: Fix potential memory leak in error case for block cipher crypto: Optimize AES-GCM cipher to not use dynamic allocation Use EVP for AES-GCM
2015-12-17test_server tests: Update test cases to cope with use of 'rand'Björn Gustavsson
In 80757f9, test_server was updated use the new 'rand' module instead of 'random', but the the shuffle test cases were not updated.