From 5af15532cefecb5665736f30e00960c17700d1b0 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Fri, 10 Feb 2017 21:38:11 +0530 Subject: Avoid mutex lock wait in socket close failure In case of absence to close a socket fd during an exit from application we try to close the same by traversing the socket_fds in swrap_destructor. But the early lock taken on libc_symbol_binding_mutex inside the destructor blocks the subsequent request for locking the same while loading libc_close within swrap_close. Also added a test case to verify this flaw in destructor. Signed-off-by: Anoop C S Reviewed-by: Andreas Schneider Reviewed-by: Michael Adam --- src/socket_wrapper.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 186b696..3d468c3 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -5656,8 +5656,6 @@ void swrap_destructor(void) { struct socket_info_fd *s = socket_fds; - SWRAP_LOCK_ALL; - while (s != NULL) { swrap_close(s->fd); s = socket_fds; @@ -5671,6 +5669,4 @@ void swrap_destructor(void) if (swrap.libc.socket_handle) { dlclose(swrap.libc.socket_handle); } - - SWRAP_UNLOCK_ALL; } -- cgit