1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
* sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Make sure
	SIGSETXID is not blocked.
	* sysdeps/unix/sysv/linux/sigwaitinfo.c (do_sigwaitinfo): Likewise.
	* sysdeps/unix/sysv/linux/sigtimedwait.c (do_sigtimedwait): Likewise.
	* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask): Likewise.
	* sysdeps/generic/sigfillset.c (sigfillset): Don't set SIGSETXID.
This commit is contained in:
Ulrich Drepper
2004-09-28 22:44:12 +00:00
parent 6c81dc423b
commit 53b4fed6ef
9 changed files with 65 additions and 19 deletions

View File

@ -1,5 +1,12 @@
2004-09-28 Ulrich Drepper <drepper@redhat.com> 2004-09-28 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Make sure
SIGSETXID is not blocked.
* sysdeps/unix/sysv/linux/sigwaitinfo.c (do_sigwaitinfo): Likewise.
* sysdeps/unix/sysv/linux/sigtimedwait.c (do_sigtimedwait): Likewise.
* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask): Likewise.
* sysdeps/generic/sigfillset.c (sigfillset): Don't set SIGSETXID.
* sunrpc/get_myaddr.c (get_myaddress): Fix test for failing * sunrpc/get_myaddr.c (get_myaddress): Fix test for failing
getifaddrs call. getifaddrs call.
* sunrpc/pmap_clnt.c (__get_myaddress): Likewise. * sunrpc/pmap_clnt.c (__get_myaddress): Likewise.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -31,13 +31,15 @@ pthread_sigmask (how, newmask, oldmask)
{ {
sigset_t local_newmask; sigset_t local_newmask;
/* The only thing we have to make sure here is that SIGCANCEL is not /* The only thing we have to make sure here is that SIGCANCEL and
blocked. */ SIGSETXID is not blocked. */
if (newmask != NULL if (newmask != NULL
&& __builtin_expect (__sigismember (newmask, SIGCANCEL), 0)) && (__builtin_expect (__sigismember (newmask, SIGCANCEL), 0)
|| __builtin_expect (__sigismember (newmask, SIGSETXID), 0)))
{ {
local_newmask = *newmask; local_newmask = *newmask;
__sigdelset (&local_newmask, SIGCANCEL); __sigdelset (&local_newmask, SIGCANCEL);
__sigdelset (&local_newmask, SIGSETXID);
newmask = &local_newmask; newmask = &local_newmask;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -36,7 +36,7 @@ __sigaction (sig, act, oact)
const struct sigaction *act; const struct sigaction *act;
struct sigaction *oact; struct sigaction *oact;
{ {
if (sig == SIGCANCEL) if (__builtin_expect (sig == SIGCANCEL || sig == SIGSETXID, 0))
{ {
__set_errno (EINVAL); __set_errno (EINVAL);
return -1; return -1;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -37,8 +37,9 @@ __pthread_kill (threadid, signo)
/* Not a valid thread handle. */ /* Not a valid thread handle. */
return ESRCH; return ESRCH;
/* Disallow sending the signal we use for cancellation. */ /* Disallow sending the signal we use for cancellation, timers, for
if (signo == SIGCANCEL || signo == SIGTIMER) for the setxid implementation. */
if (signo == SIGCANCEL || signo == SIGTIMER || signo == SIGSETXID)
return EINVAL; return EINVAL;
/* We have a special syscall to do the work. */ /* We have a special syscall to do the work. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991,96,97,2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 1991,96,97,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -37,6 +37,10 @@ sigfillset (set)
#ifdef SIGCANCEL #ifdef SIGCANCEL
__sigdelset (set, SIGCANCEL); __sigdelset (set, SIGCANCEL);
#endif #endif
/* Likewise for the signal to implement setxid. */
#ifdef SIGSETXID
__sigdelset (set, SIGSETXID);
#endif
return 0; return 0;
} }

View File

@ -43,12 +43,20 @@ __sigprocmask (how, set, oset)
#ifdef SIGCANCEL #ifdef SIGCANCEL
sigset_t local_newmask; sigset_t local_newmask;
/* The only thing we have to make sure here is that SIGCANCEL is not /* The only thing we have to make sure here is that SIGCANCEL and
blocked. */ SIGSETXID are not blocked. */
if (set != NULL && __builtin_expect (__sigismember (set, SIGCANCEL), 0)) if (set != NULL
&& (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
# ifdef SIGSETXID
|| __builtin_expect (__sigismember (set, SIGSETXID), 0)
# endif
))
{ {
local_newmask = *set; local_newmask = *set;
__sigdelset (&local_newmask, SIGCANCEL); __sigdelset (&local_newmask, SIGCANCEL);
# ifdef SIGSETXID
__sigdelset (&local_newmask, SIGSETXID);
# endif
set = &local_newmask; set = &local_newmask;
} }
#endif #endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -32,12 +32,20 @@ do_sigtimedwait (const sigset_t *set, siginfo_t *info,
{ {
#ifdef SIGCANCEL #ifdef SIGCANCEL
sigset_t tmpset; sigset_t tmpset;
if (set != NULL && __sigismember (set, SIGCANCEL)) if (set != NULL
&& (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
# ifdef SIGSETXID
|| __builtin_expect (__sigismember (set, SIGSETXID), 0)
# endif
))
{ {
/* Create a temporary mask without the bit for SIGCANCEL set. */ /* Create a temporary mask without the bit for SIGCANCEL set. */
// We are not copying more than we have to. // We are not copying more than we have to.
memcpy (&tmpset, set, _NSIG / 8); memcpy (&tmpset, set, _NSIG / 8);
__sigdelset (&tmpset, SIGCANCEL); __sigdelset (&tmpset, SIGCANCEL);
# ifdef SIGSETXID
__sigdelset (&tmpset, SIGSETXID);
# endif
set = &tmpset; set = &tmpset;
} }
#endif #endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -36,12 +36,20 @@ do_sigwait (const sigset_t *set, int *sig)
#ifdef SIGCANCEL #ifdef SIGCANCEL
sigset_t tmpset; sigset_t tmpset;
if (set != NULL && __sigismember (set, SIGCANCEL)) if (set != NULL
&& (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
# ifdef SIGSETXID
|| __builtin_expect (__sigismember (set, SIGSETXID), 0)
# endif
))
{ {
/* Create a temporary mask without the bit for SIGCANCEL set. */ /* Create a temporary mask without the bit for SIGCANCEL set. */
// We are not copying more than we have to. // We are not copying more than we have to.
memcpy (&tmpset, set, _NSIG / 8); memcpy (&tmpset, set, _NSIG / 8);
__sigdelset (&tmpset, SIGCANCEL); __sigdelset (&tmpset, SIGCANCEL);
# ifdef SIGSETXID
__sigdelset (&tmpset, SIGSETXID);
# endif
set = &tmpset; set = &tmpset;
} }
#endif #endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -33,12 +33,20 @@ do_sigwaitinfo (const sigset_t *set, siginfo_t *info)
{ {
#ifdef SIGCANCEL #ifdef SIGCANCEL
sigset_t tmpset; sigset_t tmpset;
if (set != NULL && __sigismember (set, SIGCANCEL)) if (set != NULL
&& (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
# ifdef SIGSETXID
|| __builtin_expect (__sigismember (set, SIGSETXID), 0)
# endif
))
{ {
/* Create a temporary mask without the bit for SIGCANCEL set. */ /* Create a temporary mask without the bit for SIGCANCEL set. */
// We are not copying more than we have to. // We are not copying more than we have to.
memcpy (&tmpset, set, _NSIG / 8); memcpy (&tmpset, set, _NSIG / 8);
__sigdelset (&tmpset, SIGCANCEL); __sigdelset (&tmpset, SIGCANCEL);
# ifdef SIGSETXID
__sigdelset (&tmpset, SIGSETXID);
# endif
set = &tmpset; set = &tmpset;
} }
#endif #endif