forked from gyroidos/cml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
daemon: introduce observer_finisher for delayed free
We introduce an observer finisher which can be registered in the compartment struct. This finisher is called now in the method compartment_notify_observers() after all observers have been executed in the notify observer list. With this it is possible to register a callback which can cleanly destroy the compartment object triggerd by an observer. Previously on container reload the reaload callback destroyed the compartment object, but in the compartment_notify observers() method the compartment object is accessed after each callback, even if it is the last one. This caused the use-after-free error below. ================================================================= ==210==ERROR: AddressSanitizer: heap-use-after-free on address \ 0x5100000011b8 at pc 0x560d9ae6a3a5 bp 0x7fffd1ff8710 sp 0x7fffd1ff8700 READ of size 8 at 0x5100000011b8 thread T0 #0 0x560d9ae6a3a4 in compartment_notify_observers daemon/compartment.c:1677 gyroidos#1 0x560d9ae6fd49 in compartment_sigchld_handle_helpers daemon/compartment.c:700 gyroidos#2 0x560d9ae70319 in compartment_sigchld_cb daemon/compartment.c:783 gyroidos#3 0x560d9af16329 in event_signal_handler common/event.c:780 gyroidos#4 0x560d9af16329 in event_loop common/event.c:851 gyroidos#5 0x560d9ae4e6ac in main daemon/main.c:146 gyroidos#6 0x7fe2bf99b863 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 gyroidos#7 0x7fe2bf99b90a in __libc_start_main_impl ../csu/libc-start.c:389 gyroidos#8 0x560d9ae509d4 in _start (/usr/sbin/cmld+0x13e9d4) Signed-off-by: Michael Weiß <[email protected]>
- Loading branch information
Showing
5 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters