Re: [PATCH] revert zap_other_threads breakage, disallow CLONE_THREADwithout CLONE_DETACHED

From: Linus Torvalds
Date: Thu Aug 14 2003 - 12:41:28 EST



On Tue, 12 Aug 2003, Roland McGrath wrote:
>
> Please apply this patch to get us back out of this useless quagmire and
> disallow the problematic case that noone wants to try to use any more.
>
> - if ((clone_flags & CLONE_THREAD) && !(clone_flags & CLONE_SIGHAND))
> + if ((clone_flags & CLONE_THREAD) &&
> + (clone_flags & (CLONE_SIGHAND|CLONE_DETACHED)) != (CLONE_SIGHAND|CLONE_DETACHED))
> return ERR_PTR(-EINVAL);
> if ((clone_flags & CLONE_DETACHED) && !(clone_flags & CLONE_THREAD))

Look at the condition that follows: it disallows CLONE_DETACHED for
non-threads.

Which really means that together with the first change, CLONE_DETACHED is
always the same thing as CLONE_THREAD: you can't have one without the
other.

Which means that they are logically not separate bits any more, and we
should just get rid of CLONE_DETACHED altogether, and use CLONE_THREAD in
all cases where it is tested for.

I'd really prefer not to keep a bit around that has to mean the same thing
as another bit - that way just lies madness. So I'll document
CLONE_DETACHED as being a no-op, and change the _one_ place that used it
to just use CLONE_THREAD instead.

Linus

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