Re: [patch] exit_free(), 2.5.31-A0

Ingo Molnar (mingo@elte.hu)
Tue, 13 Aug 2002 20:22:13 +0200 (CEST)


On Tue, 13 Aug 2002, Linus Torvalds wrote:

> If the parent wants to get notified on child death, it should damn well
> get notified on child death. Not "in case the child exists politely".

yes i agree. If the parent wants that, then it does not specify the
CLONE_DETACHED flag when creating the child thread. It is the parent that
specifies this flag and it has the freedom to decide whether it wants
signal based notification or not.

if CLONE_DETACHED is not specified upon creation then *no matter what the
child thread does* - both sys_exit() and sys_exit_free() notify the
parent. It's not a matter of politeness.

> We don't depend on processes calling "exit()" to clean up all the stuff
> they left behind. The VM gets cleaned up even for bad processes.

We'd be more than happy to do this cleanup in userspace, but how do you
free a stack which might as well be used by a debugger or a signal handler
right before executing the final "int $0x80" instruction?

should every signal handler start with code that tries to figure out
whether the stack is still valid (by calling gettid() and comparing it
with the TID written into a special offset on the stack)? Should the
exiting thread mask all signals before freeing the stack and calling
sys_exit()?

Ingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/