-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
daemon: refactor IPC usage #664
base: master
Are you sure you want to change the base?
Conversation
duvanan13
commented
Jul 16, 2024
- Prevent new daemon initialization when using FIFO
- Unit test gateway IPC changes to UNIX_SOCKET
- Shared memory is used for multinode testing
- Resolve the TOCTOU issue
+ Prevent new daemon initialization when using FIFO + Unit test gateway IPC changes to UNIX_SOCKET + Shared memory is used for multinode testing + Resolve the TOCTOU issue Signed-off-by: andv <[email protected]> Signed-off-by: LUU QUANG MINH <[email protected]>
Thanks @duvanan13 for joining the pair programming section. Hello @michael-methner , could you kindly review this fix? |
Hello @duvanan13 , hello @minminlittleshrimp , |
Hello @michael-methner , dlt-daemon/src/daemon/dlt-daemon.c Line 2135 in 358ab08
Please kindly check my point. |
Signed-off-by: andv <[email protected]>
@@ -1414,6 +1414,7 @@ int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, in | |||
signal(SIGHUP, dlt_daemon_signal_handler); /* hangup signal */ | |||
signal(SIGQUIT, dlt_daemon_signal_handler); | |||
signal(SIGINT, dlt_daemon_signal_handler); | |||
signal(SIGSEGV, dlt_daemon_signal_handler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handler for SIGSEGV should not be added here. This will cause the application to hang in an endless loop in case a segmentation fault occurs as it will re-execute the same instruction again which caused the segmentation fault (and signal is triggered again)
@@ -2150,6 +2162,7 @@ void dlt_daemon_signal_handler(int sig) | |||
case SIGTERM: | |||
case SIGINT: | |||
case SIGQUIT: | |||
case SIGSEGV: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIGSEGV needs to be handled separately. For example, after calling dlt_daemon_exit_trigger() set the SIG_DFL for SIGSEGV and raise() the same signal (or just let it hit SIGSEGV on its own again).
I really don't advise calling dlt_daemon_exit_trigger() since it calls async-unsafe functions in a signal handler, but since you already break that rule I wont complain.