1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-23 00:00:06 +01:00
libwebsockets/lib/core-net
Andy Green c327c7fdb7 vhost destruction: dont allow all wsi closures to kill vh we are already in process of destroying
Saw this on travis selftests during context destroy

==18895== Invalid read of size 8
==18895==    at 0x415909: __lws_vhost_destroy2 (vhost.c:1063)
==18895==    by 0x40E65B: lws_context_destroy2 (context.c:929)
==18895==    by 0x40EBE5: lws_context_destroy (context.c:1128)
==18895==    by 0x40CC41: main (minimal-http-client-post.c:267)
==18895==  Address 0x6168688 is 728 bytes inside a block of size 792 free'd
==18895==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18895==    by 0x45B29E: _realloc (alloc.c:120)
==18895==    by 0x45B2D6: lws_realloc (alloc.c:130)
==18895==    by 0x415ED7: __lws_vhost_destroy2 (vhost.c:1204)
==18895==    by 0x419164: lws_vhost_unbind_wsi (wsi.c:82)
==18895==    by 0x41236B: __lws_free_wsi (close.c:154)
==18895==    by 0x4134CF: __lws_close_free_wsi_final (close.c:650)
==18895==    by 0x4133BA: __lws_close_free_wsi (close.c:610)
==18895==    by 0x413528: lws_close_free_wsi (close.c:660)
==18895==    by 0x4158C7: __lws_vhost_destroy2 (vhost.c:1053)
==18895==    by 0x40E65B: lws_context_destroy2 (context.c:929)
==18895==    by 0x40EBE5: lws_context_destroy (context.c:1128)

Removing the last wsi from the vhost we started to destroy finalized the
vhost destruction, which is aimed at libuv async close cleanup.  But if
we already entered __lws_vhost_destroy2, we will definitely destroy the vhost
ourselves at the end of that function already.  So defeat the wsi close
triggering it.
2019-12-22 18:17:45 +00:00
..
adopt.c adopt: pass wsi opaque so its set from the start 2019-12-09 14:48:54 +00:00
client.c client: make external http proxying optional 2019-08-26 09:58:57 +01:00
close.c close.c: close reason length wrong 2019-12-14 23:55:28 +00:00
connect.c tls: lws_system per-connection client certs 2019-12-09 14:48:54 +00:00
detailed-latency.c detailed latency stats 2019-09-22 03:06:59 -07:00
dummy-callback.c cgi: minimal example 2019-11-20 05:20:59 +00:00
lws-dsh.c Coverity fixes 2019-08-19 10:12:20 +01:00
network.c LWS_ERRNO: audit uses for case logging may destroy errno 2019-12-14 23:55:28 +00:00
output.c minimal-raw-serial 2019-12-09 14:48:54 +00:00
pollfd.c detailed latency stats 2019-09-22 03:06:59 -07:00
private-lib-core-net.h tls: lws_system per-connection client certs 2019-12-09 14:48:54 +00:00
sequencer.c private.h: rename to contain dir 2019-08-15 10:49:52 +01:00
server.c illumos: fix build errors 2019-11-04 13:49:13 +00:00
service.c lws_state and system state 2019-09-22 09:35:07 -07:00
sorted-usec-list.c unix: sul schedule rename internal api and call regardless of existing timeout 2019-11-01 07:07:33 +00:00
state.c fail paths: deregister notifier and be sure adopt returns NULL 2019-12-06 17:14:28 +00:00
stats.c private.h: rename to contain dir 2019-08-15 10:49:52 +01:00
vhost.c vhost destruction: dont allow all wsi closures to kill vh we are already in process of destroying 2019-12-22 18:17:45 +00:00
wsi-timeout.c cgi: reenable h1 with chunking 2019-11-16 09:00:15 +00:00
wsi.c lws_get_tsi 2019-10-29 09:14:42 +00:00