Re: setuid/pthread interaction broken? 'clone_with_uid()?'

From: Dave McCracken (dmccr@us.ibm.com)
Date: Thu Feb 14 2002 - 11:00:47 EST


--On Thursday, February 14, 2002 16:51:43 +0100 bert hubert <ahu@ds9a.nl>
wrote:

> When a process first issues setuid() and then goes on to create threads,
> those threads run under the setuid() uid - all is well.
>
> However, once the first thread is created, only the thread calling
> setuid() gets setuid in fact. All new threads continue to be created as
> root.
>
> This behaviour exists under 2.2.18 with glibc 2.1.3 and under 2.4.17 with
> glibc 2.2.5, and is shown using the brief program attached.
>
> Is this by design? It appears that all threads created get the uid of the
> thread manager process.

It's the expected behavior for a task-based model like Linux. Each task is
independent and inherits the uid/gid from whoever called clone(). It's
just one of several resources that are specified as process-wide in POSIX,
but are per-task in Linux.

I've been working on a patch to allow clone() to specify shared
credentials, but it's been on the back burner.

Dave McCracken

======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
dmccr@us.ibm.com T/L 678-3059

-
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/



This archive was generated by hypermail 2b29 : Fri Feb 15 2002 - 21:01:02 EST