binfmt/loadbinary: Set signal mask of task loaded by binary manager
The task loaded by binary manager has same signal mask with binary manager.
That's because when a task or thread is created, it inherits signal mask from parent task.
Binary manager blocks all signals excluding SIGKILL so we need to clean it.
#include <string.h>
#include <debug.h>
#include <errno.h>
+#if defined(CONFIG_BINARY_MANAGER) && !defined(CONFIG_DISABLE_SIGNALS)
+#include <signal.h>
+#endif
#include <tinyara/kmalloc.h>
#include <tinyara/sched.h>
@@ -171,6 +174,11 @@ int load_binary(FAR const char *filename, size_t binsize, size_t offset, size_t
tcb->ram_size = size;
#endif
+#if defined(CONFIG_BINARY_MANAGER) && !defined(CONFIG_DISABLE_SIGNALS)
+ /* Clean the signal mask of loaded task because it inherits signal mask from parent task, binary manager. */
+ tcb->sigprocmask = NULL_SIGNAL_SET;
+#endif
+
#ifdef CONFIG_BINFMT_LOADABLE
/* Set up to unload the module (and free the binary_s structure)
* when the task exists.
