diff options
author | Sverker Eriksson <[email protected]> | 2012-10-05 11:52:52 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2012-10-09 22:05:11 +0200 |
commit | e5c1d346e29e5b1227ed30ee4d725a09eca0e532 (patch) | |
tree | b5c8114a810459e855d4a81ec918c40e240c82d9 /erts/emulator/sys/win32 | |
parent | 54e7cc9086908a0e5642caa6ac3680557acc5a67 (diff) | |
download | otp-e5c1d346e29e5b1227ed30ee4d725a09eca0e532.tar.gz otp-e5c1d346e29e5b1227ed30ee4d725a09eca0e532.tar.bz2 otp-e5c1d346e29e5b1227ed30ee4d725a09eca0e532.zip |
crypto: Make unloading of crypto safer
Facts:
crypto nif-lib registers callback functions that openssl uses
for memory management and thread synchronization. The callback
functions can only be set once, openssl does not allow changing the
callback functions.
Problem:
If openssl is dynamicly linked to crypto, you might get s scenario
where the crypto lib is unloaded while leaving openssl loaded
with its old pointers to the unloaded crypto code intact.
If crypto is then reloaded (by init:restart() for example), the crypto
nif-lib might get relocated at a different address. crypto calls
openssl which in turn calls the old invalid callback functions...kaboom.
Solution:
Break apart the callback functions into a separate dynamic lib that
crypto loads with dlopen. When crypto is unloaded the callback lib is
left in place to be reused if/when crypto is loaded again.
Diffstat (limited to 'erts/emulator/sys/win32')
-rw-r--r-- | erts/emulator/sys/win32/erl_win32_sys_ddll.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/erts/emulator/sys/win32/erl_win32_sys_ddll.c b/erts/emulator/sys/win32/erl_win32_sys_ddll.c index d00eed932b..54991a610c 100644 --- a/erts/emulator/sys/win32/erl_win32_sys_ddll.c +++ b/erts/emulator/sys/win32/erl_win32_sys_ddll.c @@ -58,7 +58,7 @@ void erl_sys_ddll_init(void) { /* * Open a shared object */ -int erts_sys_ddll_open2(char *full_name, void **handle, ErtsSysDdllError* err) +int erts_sys_ddll_open2(const char *full_name, void **handle, ErtsSysDdllError* err) { int len; char dlname[MAXPATHLEN + 1]; @@ -92,7 +92,7 @@ int erts_sys_ddll_open_noext(char *dlname, void **handle, ErtsSysDdllError* err) /* * Find a symbol in the shared object */ -int erts_sys_ddll_sym2(void *handle, char *func_name, void **function, +int erts_sys_ddll_sym2(void *handle, const char *func_name, void **function, ErtsSysDdllError* err) { FARPROC proc; |