We have two initialization places for the signal files context of a
signal files context:
- on vfork when a child process is born and its signal descriptor is
correspondingly inherited from the parent
- on signal descriptor initialization on regular process creation
For the former, at this time, we do not support proper open file
inheritance across vfork/execve for those that do not have the
O_CLOEXEC flag. Therefore, for now, simply just initialize child
process' signal descriptor signal file context as empty.
Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1619
if ((cl_args->flags & CLONE_VM) && !(cl_args->flags & CLONE_VFORK))
cp->signal->altstack.ss_flags = SS_DISABLE;
+#if CONFIG_LIBPOSIX_PROCESS_SIGNALFD
+ /*
+ * TODO: At this time we do not support proper open file inheritance
+ * across vfork/execve for those that do not have the O_CLOEXEC flag.
+ * Therefore, for now, simply just initialize child process' signal
+ * descriptor signal file context as empty.
+ */
+ uk_signal_files_ctx_init(&cp->signal->sigfiles_ctx);
+#endif /* CONFIG_LIBPOSIX_PROCESS_SIGNALFD */
+
return 0;
fail_malloc:
pd->altstack.ss_flags = SS_DISABLE;
+#if CONFIG_LIBPOSIX_PROCESS_SIGNALFD
+ uk_signal_files_ctx_init(&pd->sigfiles_ctx);
+#endif /* CONFIG_LIBPOSIX_PROCESS_SIGNALFD */
+
return 0;
}