The Samba-Bugzilla – Attachment 8434 Details for
Bug 9550
sigprocmask does not work on FreeBSD to stop further signals in a signal handler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am patchset for 3.6.next.
bug-9550-3.6.patchset (text/plain), 5.36 KB, created by
Jeremy Allison
on 2013-01-15 18:38:36 UTC
(
hide
)
Description:
git-am patchset for 3.6.next.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2013-01-15 18:38:36 UTC
Size:
5.36 KB
patch
obsolete
>From 6c027e79d16a17a3b67c3a55b277ce88ea76d67d Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Mon, 14 Jan 2013 15:06:12 -0800 >Subject: [PATCH 1/4] lib/replace: Add missing check for sys/wait.h > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Stefan Metzmacher <metze@samba.org> >--- > lib/replace/libreplace.m4 | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > >diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 >index 87e8fdb..52ba6ee 100644 >--- a/lib/replace/libreplace.m4 >+++ b/lib/replace/libreplace.m4 >@@ -66,7 +66,7 @@ AC_FUNC_MEMCMP > AC_CHECK_FUNCS([pipe strftime srandom random srand rand usleep setbuffer lstat getpgrp utime utimes]) > > AC_CHECK_HEADERS(stdbool.h stdint.h sys/select.h) >-AC_CHECK_HEADERS(setjmp.h utime.h) >+AC_CHECK_HEADERS(setjmp.h utime.h sys/wait.h) > > LIBREPLACE_PROVIDE_HEADER([stdint.h]) > LIBREPLACE_PROVIDE_HEADER([stdbool.h]) >-- >1.7.7.3 > > >From 4f8c0ff0c874d8c8a4739f606d5283837475f9c6 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Tue, 15 Jan 2013 10:16:27 -0800 >Subject: [PATCH 2/4] lib/replace: Add ucontext configure autoconf checks. > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > lib/replace/libreplace.m4 | 13 +++++++++++++ > 1 files changed, 13 insertions(+), 0 deletions(-) > >diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 >index 52ba6ee..67f8e3f 100644 >--- a/lib/replace/libreplace.m4 >+++ b/lib/replace/libreplace.m4 >@@ -105,6 +105,7 @@ AC_CHECK_HEADERS(stdarg.h vararg.h) > AC_CHECK_HEADERS(sys/mount.h mntent.h) > AC_CHECK_HEADERS(stropts.h) > AC_CHECK_HEADERS(unix.h) >+AC_CHECK_HEADERS(sys/ucontext.h) > > AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror strerror_r) > AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) >@@ -325,6 +326,18 @@ if test x"$libreplace_cv_struct_timespec" = x"yes"; then > AC_DEFINE(HAVE_STRUCT_TIMESPEC,1,[Whether we have struct timespec]) > fi > >+AC_CACHE_CHECK([for ucontext_t type],libreplace_cv_ucontext_t, [ >+ AC_TRY_COMPILE([ >+#include <signal.h> >+#if HAVE_SYS_UCONTEXT_H >+#include <sys/ucontext.h> >+# endif >+],[ucontext_t uc; sigaddset(&uc.uc_sigmask, SIGUSR1);], >+ libreplace_cv_ucontext_t=yes,libreplace_cv_ucontext_t=no)]) >+if test x"$libreplace_cv_ucontext_t" = x"yes"; then >+ AC_DEFINE(HAVE_UCONTEXT_T,1,[Whether we have ucontext_t]) >+fi >+ > AC_CHECK_FUNCS([printf memset memcpy],,[AC_MSG_ERROR([Required function not found])]) > > echo "LIBREPLACE_BROKEN_CHECKS: END" >-- >1.7.7.3 > > >From c4403378027bee191e8b78cffa281fcc5f1952b1 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Mon, 14 Jan 2013 15:21:52 -0800 >Subject: [PATCH 3/4] lib/replace: Include sys/ucontext.h if available. > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Stefan Metzmacher <metze@samba.org> >--- > lib/replace/system/wait.h | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > >diff --git a/lib/replace/system/wait.h b/lib/replace/system/wait.h >index f0c3bdc..146c61a 100644 >--- a/lib/replace/system/wait.h >+++ b/lib/replace/system/wait.h >@@ -40,6 +40,10 @@ > #include <setjmp.h> > #endif > >+#ifdef HAVE_SYS_UCONTEXT_H >+#include <sys/ucontext.h> >+#endif >+ > #if !defined(HAVE_SIG_ATOMIC_T_TYPE) > typedef int sig_atomic_t; > #endif >-- >1.7.7.3 > > >From 94bae1a12fca0152a5e5ff5f7dfbce026c4385bd Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Mon, 14 Jan 2013 15:22:11 -0800 >Subject: [PATCH 4/4] tevent: Fix bug 9550 - sigprocmask does not work on > FreeBSD to stop further signals in a signal handler > >Mask off signals the correct way from the signal handler. > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Stefan Metzmacher <metze@samba.org> > >Autobuild-User(master): Stefan Metzmacher <metze@samba.org> >Autobuild-Date(master): Tue Jan 15 12:13:43 CET 2013 on sn-devel-104 >--- > lib/tevent/tevent_signal.c | 29 +++++++++++++++++++++++++++++ > 1 files changed, 29 insertions(+), 0 deletions(-) > >diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c >index b790859..cc7fb0a 100644 >--- a/lib/tevent/tevent_signal.c >+++ b/lib/tevent/tevent_signal.c >@@ -122,10 +122,39 @@ static void tevent_common_signal_handler_info(int signum, siginfo_t *info, > if (count+1 == TEVENT_SA_INFO_QUEUE_COUNT) { > /* we've filled the info array - block this signal until > these ones are delivered */ >+#ifdef HAVE_UCONTEXT_T >+ /* >+ * This is the only way for this to work. >+ * By default signum is blocked inside this >+ * signal handler using a temporary mask, >+ * but what we really need to do now is >+ * block it in the callers mask, so it >+ * stays blocked when the temporary signal >+ * handler mask is replaced when we return >+ * from here. The callers mask can be found >+ * in the ucontext_t passed in as the >+ * void *uctx argument. >+ */ >+ ucontext_t *ucp = (ucontext_t *)uctx; >+ sigaddset(&ucp->uc_sigmask, signum); >+#else >+ /* >+ * WARNING !!! WARNING !!!! >+ * >+ * This code doesn't work. >+ * By default signum is blocked inside this >+ * signal handler, but calling sigprocmask >+ * modifies the temporary signal mask being >+ * used *inside* this handler, which will be >+ * replaced by the callers signal mask once >+ * we return from here. See Samba >+ * bug #9550 for details. >+ */ > sigset_t set; > sigemptyset(&set); > sigaddset(&set, signum); > sigprocmask(SIG_BLOCK, &set, NULL); >+#endif > TEVENT_SIG_INCREMENT(sig_state->sig_blocked[signum]); > } > } >-- >1.7.7.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
rsharpe
:
review+
Actions:
View
Attachments on
bug 9550
:
8429
| 8434