[PATCH] exec: fix posix-timers leak and pending signal loss
I've found some problems with exec and fixed them with this patch to de_thread. The second problem is that a multithreaded exec loses all pending signals. This is violation of POSIX rules. But a moment's thought will show it's also just not desireable: if you send a process a SIGTERM while it's in the middle of calling exec, you expect either the original program in that process or the new program being exec'd to handle that signal or be killed by it. As it stands now, you can try to kill a process and have that signal just evaporate if it's multithreaded and calls exec just then. I really don't know what the rationale was behind the de_thread code that allocates a new signal_struct. It doesn't make any sense now. The other code there ensures that the old signal_struct is no longer shared. Except for posix-timers, all the state there is stuff you want to keep. So my changes just keep the old structs when they are no longer shared, and all the right state is retained (after clearing out posix-timers). The final bug is that the cumulative statistics of dead threads and dead child processes are lost in the abandoned signal_struct. This is also fixed by holding on to it instead of replacing it. Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing
Please register or sign in to comment