This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: setuid and setgid are async-signal-safe?
On 30 October 2012 12:29, Mike Frysinger <vapier@gentoo.org> wrote:
> On Tuesday 30 October 2012 01:59:13 jiji vinitha wrote:
>> I have referred the setgid/setuid implementation in glibc-2.15 .
>> However,I could not understand the algorithm is truly async-signal safe or
>> not. Is glibc-2.15's setgid/setuid implementation async-signal safe?
>
> all it does is make a syscall to the kernel. why do you think it isn't safe ?
Not really. for a multithreaded process it sends a signal to all
threads to interrupt and make the syscall so that all threads of the
process are setuid/setgid.
It should be async signal-safe, but there is one caveat that I can
think of - If a signal interrupts a setuid operation and the signal
handler calls setuid, then there could theoretically be a deadlock on
stack_cache_lock in _nptl_setxid.
--
http://siddhesh.in