aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/configure.in60
-rw-r--r--erts/doc/src/notes.xml2
-rw-r--r--erts/emulator/beam/beam_bif_load.c4
-rw-r--r--erts/emulator/drivers/common/inet_drv.c18
-rw-r--r--erts/emulator/hipe/hipe_bif2.c26
-rw-r--r--erts/emulator/hipe/hipe_mkliterals.c12
-rw-r--r--erts/emulator/test/code_SUITE.erl2
-rw-r--r--erts/epmd/test/epmd_SUITE.erl139
8 files changed, 168 insertions, 95 deletions
diff --git a/erts/configure.in b/erts/configure.in
index e4c6a7852f..fac07f8b6a 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -3524,6 +3524,8 @@ dnl use "PATH/include" and "PATH/lib".
AC_SUBST(SSL_INCLUDE)
AC_SUBST(SSL_ROOT)
AC_SUBST(SSL_LIBDIR)
+AC_SUBST(SSL_CRYPTO_LIBNAME)
+AC_SUBST(SSL_SSL_LIBNAME)
AC_SUBST(SSL_CC_RUNTIME_LIBRARY_PATH)
AC_SUBST(SSL_LD_RUNTIME_LIBRARY_PATH)
AC_SUBST(SSL_DED_LD_RUNTIME_LIBRARY_PATH)
@@ -3687,19 +3689,41 @@ case "$erl_xcomp_without_sysroot-$with_ssl" in
CRYPTO_APP=crypto
SSH_APP=ssh
- AC_MSG_CHECKING(for OpenSSL >= 0.9.7 in standard locations)
+ SSL_CRYPTO_LIBNAME=crypto
+ SSL_SSL_LIBNAME=ssl
+
+ AC_MSG_CHECKING(for OpenSSL >= 0.9.7 in standard locations)
for rdir in $extra_dir /cygdrive/c/OpenSSL $std_ssl_locations; do
dir="$erl_xcomp_sysroot$rdir"
if test -f "$erl_xcomp_isysroot$rdir/include/openssl/opensslv.h"; then
is_real_ssl=yes
SSL_ROOT="$dir"
if test "x$MIXED_CYGWIN" = "xyes" ; then
- if test -f "$dir/lib/VC/ssleay32.lib" || \
- test -f "$dir/lib/VC/openssl.lib"; then
+ if test -f "$dir/lib/VC/libeay32.lib"; then
+ SSL_RUNTIME_LIBDIR="$rdir/lib/VC"
+ SSL_LIBDIR="$dir/lib/VC"
+ SSL_CRYPTO_LIBNAME=libeay32
+ SSL_SSL_LIBNAME=ssleay32
+ elif test -f "$dir/lib/VC/openssl.lib"; then
SSL_RUNTIME_LIBDIR="$rdir/lib/VC"
SSL_LIBDIR="$dir/lib/VC"
- elif test -f "$dir/lib/ssleay32.lib" || \
- test -f "$dir/lib/openssl.lib"; then
+ elif test -f $dir/lib/VC/libeay32MD.lib; then
+ SSL_CRYPTO_LIBNAME=libeay32MD
+ SSL_SSL_LIBNAME=ssleay32MD
+ if test "x$enable_dynamic_ssl" = "xno" && \
+ test -f $dir/lib/VC/static/libeay32MD.lib; then
+ SSL_RUNTIME_LIBDIR="$rdir/lib/VC/static"
+ SSL_LIBDIR="$dir/lib/VC/static"
+ else
+ SSL_RUNTIME_LIBDIR="$rdir/lib/VC"
+ SSL_LIBDIR="$dir/lib/VC"
+ fi
+ elif test -f "$dir/lib/libeay32.lib"; then
+ SSL_RUNTIME_LIBDIR="$rdir/lib"
+ SSL_LIBDIR="$dir/lib"
+ SSL_CRYPTO_LIBNAME=libeay32
+ SSL_CRYPTO_LIBNAME=ssleay32
+ elif test -f "$dir/lib/openssl.lib"; then
SSL_RUNTIME_LIBDIR="$rdir/lib"
SSL_LIBDIR="$dir/lib"
else
@@ -3859,8 +3883,32 @@ dnl so it is - be adoptable
AC_MSG_ERROR(Invalid path to option --with-ssl=PATH)
fi
SSL_ROOT="$with_ssl"
+ SSL_CRYPTO_LIBNAME=crypto
+ SSL_SSL_LIBNAME=ssl
if test "x$MIXED_CYGWIN" = "xyes" && test -d "$with_ssl/lib/VC"; then
- SSL_LIBDIR="$with_ssl/lib/VC"
+ if test -f "$with_ssl/lib/VC/libeay32.lib"; then
+ SSL_LIBDIR="$with_ssl/lib/VC"
+ SSL_CRYPTO_LIBNAME=libeay32
+ SSL_SSL_LIBNAME=ssleay32
+ elif test -f "$with_ssl/lib/VC/openssl.lib"; then
+ SSL_LIBDIR="$with_ssl/lib/VC"
+ elif test -f $with_ssl/lib/VC/libeay32MD.lib; then
+ SSL_CRYPTO_LIBNAME=libeay32MD
+ SSL_SSL_LIBNAME=ssleay32MD
+ if test "x$enable_dynamic_ssl" = "xno" && \
+ test -f $with_ssl/lib/VC/static/libeay32MD.lib; then
+ SSL_LIBDIR="$with_ssl/lib/VC/static"
+ else
+ SSL_LIBDIR="$with_ssl/lib/VC"
+ fi
+ elif test -f "$with_ssl/lib/libeay32.lib"; then
+ SSL_LIBDIR="$with_ssl/lib"
+ SSL_CRYPTO_LIBNAME=libeay32
+ SSL_CRYPTO_LIBNAME=ssleay32
+ else
+ # This probably wont work, but that's what the user said, so...
+ SSL_LIBDIR="$with_ssl/lib"
+ fi
elif test "x$ac_cv_sizeof_void_p" = "x8"; then
if test -f "$with_ssl/lib64/libcrypto.a"; then
SSL_LIBDIR="$with_ssl/lib64"
diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml
index f5607945a8..7383ea381d 100644
--- a/erts/doc/src/notes.xml
+++ b/erts/doc/src/notes.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2004</year><year>2010</year>
+ <year>2004</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 1dbf6f9b92..d76a7d8e9f 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1999-2010. All Rights Reserved.
+ * Copyright Ericsson AB 1999-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -142,7 +142,7 @@ BIF_RETTYPE code_is_module_native_1(BIF_ALIST_1)
if ((modp = erts_get_module(BIF_ARG_1)) == NULL) {
return am_undefined;
}
- return (is_native(modp->code) ||
+ return ((modp->code && is_native(modp->code)) ||
(modp->old_code != 0 && is_native(modp->old_code))) ?
am_true : am_false;
}
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index aec456151c..40c4a0df08 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -1948,7 +1948,7 @@ static int http_response_inetdrv(void *arg, int major, int minor,
tcp_descriptor* desc = (tcp_descriptor*) arg;
int i = 0;
ErlDrvTermData spec[27];
- ErlDrvTermData caller;
+ ErlDrvTermData caller = ERL_DRV_NIL;
if (desc->inet.active == INET_PASSIVE) {
/* {inet_async,S,Ref,{ok,{http_response,Version,Status,Phrase}}} */
@@ -2041,7 +2041,7 @@ http_request_inetdrv(void* arg, const http_atom_t* meth, const char* meth_ptr,
tcp_descriptor* desc = (tcp_descriptor*) arg;
int i = 0;
ErlDrvTermData spec[43];
- ErlDrvTermData caller;
+ ErlDrvTermData caller = ERL_DRV_NIL;
if (desc->inet.active == INET_PASSIVE) {
/* {inet_async, S, Ref, {ok,{http_request,Meth,Uri,Version}}} */
@@ -2092,7 +2092,7 @@ http_header_inetdrv(void* arg, const http_atom_t* name, const char* name_ptr,
tcp_descriptor* desc = (tcp_descriptor*) arg;
int i = 0;
ErlDrvTermData spec[26];
- ErlDrvTermData caller;
+ ErlDrvTermData caller = ERL_DRV_NIL;
if (desc->inet.active == INET_PASSIVE) {
/* {inet_async,S,Ref,{ok,{http_header,Bit,Name,IValue,Value}} */
@@ -2221,7 +2221,7 @@ int ssl_tls_inetdrv(void* arg, unsigned type, unsigned major, unsigned minor,
tcp_descriptor* desc = (tcp_descriptor*) arg;
int i = 0;
ErlDrvTermData spec[28];
- ErlDrvTermData caller;
+ ErlDrvTermData caller = ERL_DRV_NIL;
ErlDrvBinary* bin;
int ret;
@@ -7980,11 +7980,11 @@ static int tcp_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, int len,
timeout = get_int32(buf);
if (desc->inet.state == TCP_STATE_ACCEPTING) {
- unsigned long time_left;
- int oid;
- ErlDrvTermData ocaller;
- int oreq;
- unsigned otimeout;
+ unsigned long time_left = 0;
+ int oid = 0;
+ ErlDrvTermData ocaller = ERL_DRV_NIL;
+ int oreq = 0;
+ unsigned otimeout = 0;
ErlDrvTermData caller = driver_caller(desc->inet.port);
MultiTimerData *mtd = NULL,*omtd = NULL;
ErlDrvMonitor monitor, omonitor;
diff --git a/erts/emulator/hipe/hipe_bif2.c b/erts/emulator/hipe/hipe_bif2.c
index 19cd32c68f..2660f74a82 100644
--- a/erts/emulator/hipe/hipe_bif2.c
+++ b/erts/emulator/hipe/hipe_bif2.c
@@ -1,9 +1,8 @@
/*
* %CopyrightBegin%
-
- *
+ *
* Copyright Ericsson AB 2001-2011. All Rights Reserved.
- *
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
@@ -37,14 +36,25 @@
#include "hipe_arch.h"
#include "hipe_stack.h"
-BIF_RETTYPE hipe_bifs_show_estack_1(BIF_ALIST_1)
+static void proc_unlock(Process* c_p, Process* rp)
{
+ ErtsProcLocks locks = ERTS_PROC_LOCKS_ALL;
+ if (rp == c_p) {
+ locks &= ~ERTS_PROC_LOCK_MAIN;
+ }
+ if (rp && locks) {
+ erts_smp_proc_unlock(rp, locks);
+ }
+}
+
+BIF_RETTYPE hipe_bifs_show_estack_1(BIF_ALIST_1)
+{
Process *rp = erts_pid2proc(BIF_P, ERTS_PROC_LOCK_MAIN,
BIF_ARG_1, ERTS_PROC_LOCKS_ALL);
if (!rp)
BIF_ERROR(BIF_P, BADARG);
hipe_print_estack(rp);
- erts_smp_proc_unlock(rp, ERTS_PROC_LOCKS_ALL);
+ proc_unlock(BIF_P, rp);
BIF_RET(am_true);
}
@@ -55,7 +65,7 @@ BIF_RETTYPE hipe_bifs_show_heap_1(BIF_ALIST_1)
if (!rp)
BIF_ERROR(BIF_P, BADARG);
hipe_print_heap(rp);
- erts_smp_proc_unlock(rp, ERTS_PROC_LOCKS_ALL);
+ proc_unlock(BIF_P, rp);
BIF_RET(am_true);
}
@@ -66,7 +76,7 @@ BIF_RETTYPE hipe_bifs_show_nstack_1(BIF_ALIST_1)
if (!rp)
BIF_ERROR(BIF_P, BADARG);
hipe_print_nstack(rp);
- erts_smp_proc_unlock(rp, ERTS_PROC_LOCKS_ALL);
+ proc_unlock(BIF_P, rp);
BIF_RET(am_true);
}
@@ -82,7 +92,7 @@ BIF_RETTYPE hipe_bifs_show_pcb_1(BIF_ALIST_1)
if (!rp)
BIF_ERROR(BIF_P, BADARG);
hipe_print_pcb(rp);
- erts_smp_proc_unlock(rp, ERTS_PROC_LOCKS_ALL);
+ proc_unlock(BIF_P, rp);
BIF_RET(am_true);
}
diff --git a/erts/emulator/hipe/hipe_mkliterals.c b/erts/emulator/hipe/hipe_mkliterals.c
index 650861b54b..bced90785d 100644
--- a/erts/emulator/hipe/hipe_mkliterals.c
+++ b/erts/emulator/hipe/hipe_mkliterals.c
@@ -587,9 +587,9 @@ static void print_params(FILE *fp, void (*print_param)(FILE*,const struct rts_pa
(*print_param)(fp, &rts_params[i]);
}
-static int do_c(FILE *fp)
+static int do_c(FILE *fp, const char* this_exe)
{
- fprintf(fp, "/* File: hipe_literals.h, generated by hipe_mkliterals */\n");
+ fprintf(fp, "/* File: hipe_literals.h, generated by %s */\n", this_exe);
fprintf(fp, "#ifndef __HIPE_LITERALS_H__\n");
fprintf(fp, "#define __HIPE_LITERALS_H__\n\n");
print_literals(fp, c_define_literal);
@@ -603,9 +603,9 @@ static int do_c(FILE *fp)
return 0;
}
-static int do_e(FILE *fp)
+static int do_e(FILE *fp, const char* this_exe)
{
- fprintf(fp, "%%%% File: hipe_literals.hrl, generated by hipe_mkliterals");
+ fprintf(fp, "%%%% File: hipe_literals.hrl, generated by %s", this_exe);
fprintf(fp, "\n\n");
print_literals(fp, e_define_literal);
fprintf(fp, "\n");
@@ -622,9 +622,9 @@ int main(int argc, const char **argv)
compute_crc();
if (argc == 2) {
if (strcmp(argv[1], "-c") == 0)
- return do_c(stdout);
+ return do_c(stdout, argv[0]);
if (strcmp(argv[1], "-e") == 0)
- return do_e(stdout);
+ return do_e(stdout, argv[0]);
}
fprintf(stderr, "usage: %s [-c | -e] > output-file\n", argv[0]);
return 1;
diff --git a/erts/emulator/test/code_SUITE.erl b/erts/emulator/test/code_SUITE.erl
index c1a048be75..a062cea117 100644
--- a/erts/emulator/test/code_SUITE.erl
+++ b/erts/emulator/test/code_SUITE.erl
@@ -498,7 +498,9 @@ do_false_dependency(Init, Code) ->
?line unlink(Pid), exit(Pid, kill),
?line true = erlang:purge_module(cpbugx),
?line true = erlang:delete_module(cpbugx),
+ ?line code:is_module_native(cpbugx), % test is_module_native on deleted code
?line true = erlang:purge_module(cpbugx),
+ ?line code:is_module_native(cpbugx), % test is_module_native on purged code
ok.
false_dependency_loop(Parent, Init, SendInitAck) ->
diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl
index 72c890503d..6889ec0b34 100644
--- a/erts/epmd/test/epmd_SUITE.erl
+++ b/erts/epmd/test/epmd_SUITE.erl
@@ -780,42 +780,43 @@ no_nonlocal_register(suite) ->
no_nonlocal_register(doc) ->
["Ensure that we cannot register throug a nonlocal connection"];
no_nonlocal_register(Config) when is_list(Config) ->
+ ?line case {os:find_executable("ssh"),ct:get_config(ssh_proxy_host)} of
+ {SSH,Name} when is_list(Name), is_list(SSH) ->
+ do_no_nonlocal_register(Config,Name);
+ {false,_} ->
+ {skip, "No ssh command found to create proxy"};
+ _ ->
+ {skip, "No ssh_proxy_host configured in ts.config"}
+ end.
+do_no_nonlocal_register(Config,SSHHost) when is_list(Config) ->
?line ok = epmdrun(),
- ?line {ok,Ifs} = inet:getiflist(),
- ?line Addr0 = [ inet:ifget(I, [addr]) || I <- Ifs ],
- ?line Addr1 = [ A || {ok,[{addr,A}]} <- Addr0],
- ?line Addr = lists:filter(fun({127,_,_,_}) ->
- false;
- (_) ->
- true
- end,Addr1),
- %% Now we should have all non loopback interface addresses,
- %% none should accept a alive2 registration.
- ?line Res = lists:map(fun(Ad={A1,A2,A3,A4}) ->
- try
- Name = "gurka_"++
- integer_to_list(A1)++"_"++
- integer_to_list(A2)++"_"++
- integer_to_list(A3)++"_"++
- integer_to_list(A4),
- Bname = list_to_binary(Name),
- NameS = byte_size(Bname),
- ?line Bin= <<$x:8,4747:16,$M:8,0:8,5:16,
- 5:16,NameS:16,Bname/binary,
- 0:16>>,
- ?line S = size(Bin),
- {ok, E} = connect(Ad),
- gen_tcp:send(E,[<<S:16>>,Bin]),
- closed = recv(E,1),
- gen_tcp:close(E),
- true
- catch
- _:_ ->
- false
- end
- end, Addr),
- erlang:display(Res),
- ?line true = alltrue(Res),
+ ?line ProxyPort = proxy_port(),
+ ?line ok = ssh_proxy(SSHHost,ProxyPort),
+ Res = try
+ ?line Name = "gurka_"
+ %++
+ %integer_to_list(A1)++"_"++
+ %integer_to_list(A2)++"_"++
+ %integer_to_list(A3)++"_"++
+ %integer_to_list(A4)
+ ,
+ ?line Bname = list_to_binary(Name),
+ ?line NameS = byte_size(Bname),
+ ?line Bin= <<$x:8,4747:16,$M:8,0:8,5:16,
+ 5:16,NameS:16,Bname/binary,
+ 0:16>>,
+ ?line S = size(Bin),
+ ?line {ok, E} = connect("localhost",ProxyPort,passive),
+ ?line gen_tcp:send(E,[<<S:16>>,Bin]),
+ ?line closed = recv(E,1),
+ ?line gen_tcp:close(E),
+ true
+ catch
+ _:_ ->
+ false
+ end,
+ %erlang:display(Res),
+ true = Res,
ok.
no_nonlocal_kill(suite) ->
@@ -823,35 +824,34 @@ no_nonlocal_kill(suite) ->
no_nonlocal_kill(doc) ->
["Ensure that we cannot kill through nonlocal connection"];
no_nonlocal_kill(Config) when is_list(Config) ->
+ ?line case {os:find_executable("ssh"),ct:get_config(ssh_proxy_host)} of
+ {SSH,Name} when is_list(Name), is_list(SSH) ->
+ do_no_nonlocal_kill(Config,Name);
+ {false,_} ->
+ {skip, "No ssh command found to create proxy"};
+ _ ->
+ {skip, "No ssh_proxy_host configured in ts.config"}
+ end.
+do_no_nonlocal_kill(Config,SSHHost) when is_list(Config) ->
?line ok = epmdrun(),
- ?line {ok,Ifs} = inet:getiflist(),
- ?line Addr0 = [ inet:ifget(I, [addr]) || I <- Ifs ],
- ?line Addr1 = [ A || {ok,[{addr,A}]} <- Addr0],
- ?line Addr = lists:filter(fun({127,_,_,_}) ->
- false;
- (_) ->
- true
- end,Addr1),
- %% Now we should have all non loopback interface addresses,
- %% none should accept a alive2 registration.
- ?line Res = lists:map(fun(Ad) ->
- try
- {ok, E} = connect(Ad),
- M = [?EPMD_KILL_REQ],
- send(E, [size16(M), M]),
- closed = recv(E,2),
- gen_tcp:close(E),
- sleep(?MEDIUM_PAUSE),
- {ok, E2} = connect(Ad),
- gen_tcp:close(E2),
- true
- catch
- _:_ ->
- false
- end
- end, Addr),
- erlang:display(Res),
- ?line true = alltrue(Res),
+ ?line ProxyPort = proxy_port(),
+ ?line ok = ssh_proxy(SSHHost,ProxyPort),
+ Res = try
+ {ok, E} = connect("localhost",ProxyPort,passive),
+ M = [?EPMD_KILL_REQ],
+ send(E, [size16(M), M]),
+ closed = recv(E,2),
+ gen_tcp:close(E),
+ sleep(?MEDIUM_PAUSE),
+ {ok, E2} = connect("localhost",ProxyPort,passive),
+ gen_tcp:close(E2),
+ true
+ catch
+ _:_ ->
+ false
+ end,
+ %erlang:display(Res),
+ true = Res,
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
no_live_killing(doc) ->
@@ -896,6 +896,19 @@ cleanup() ->
true
end.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Start an ssh channel to simulate remote access
+
+proxy_port() ->
+ ?PORT+1.
+
+ssh_proxy(SSHHost,ProxyPort) ->
+ ?line Host = lists:nth(2,string:tokens(atom_to_list(node()),"@")),
+ % Requires proxy to be a unix host with the command 'read' accessible
+ ?line osrun("ssh -L "++integer_to_list(ProxyPort)++":"++Host++":"
+ ++integer_to_list(?PORT)++" "++SSHHost++" read").
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Normal debug start of epmd