[PATCH/RFC future] nptl: reinstate SIGCANCEL/SIGSETXID safeguards

Peter Mazinger ps.m at gmx.net
Thu May 12 22:41:40 UTC 2011


> Commit 8ab3145f (remove sigaction, sigprocmask, and sigfillset from
> libpthread) removed duplicated implementations of the three aforementioned
> functions from libpthread.  However, as Rich Felker pointed out, the
> libc and libpthread versions are not always 100% identical.  A closer
> examination of the pre-8ab3145f disassemblies showed the following:
> 
> libc sigfillset() returns a full set: all 128 bits are set.  libpthread
> sigfillset() sets only 126 bits: everything except SIGCANCEL/SIGSETXID.
> 
> libpthread sigprocmask() has extra code to prevent the caller from
> blocking
> SIGCANCEL/SIGSETXID.  libc sigprocmask() does not.
> 
> No differences were observed in __sigaction(), since the NPTL version of
> this function was always built into libc anyway.
> 
> This patch pulls in the SIGCANCEL/SIGSETXID definitions via pthreadP.h
> when NPTL is enabled, restoring the special signal exclusions needed
> by libpthread.
> 
> Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
> ---
>  libc/signal/sigfillset.c                |    4 ++++
>  libc/sysdeps/linux/common/sigprocmask.c |    4 ++++
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c
> index ef60f10..e041f08 100644
> --- a/libc/signal/sigfillset.c
> +++ b/libc/signal/sigfillset.c
> @@ -23,6 +23,10 @@
>  #include <errno.h>
>  #endif
>  
> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__
> +#include <pthreadP.h>
> +#endif
> +
>  /* Set all signals in SET.  */
>  int
>  sigfillset (sigset_t *set)
> diff --git a/libc/sysdeps/linux/common/sigprocmask.c
> b/libc/sysdeps/linux/common/sigprocmask.c
> index 6230033..a60fa49 100644
> --- a/libc/sysdeps/linux/common/sigprocmask.c
> +++ b/libc/sysdeps/linux/common/sigprocmask.c
> @@ -9,6 +9,10 @@
>  
>  #include <sys/syscall.h>
>  
> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__
> +#include <pthreadP.h>
> +#endif
> +
>  #if defined __USE_POSIX
>  #include <signal.h>
>  
> -- 
> 1.7.5
> 

applied to future branch with modifications (added everywhere, where
SIGCANCEL is used)

Peter
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone


More information about the uClibc mailing list