The branch, master has been updated via 8f8ca58 tevent: Fix bug 9550 - sigprocmask does not work on FreeBSD to stop further signals in a signal handler via 0258138 lib/replace: Include sys/ucontext.h if available. via fe6e323 lib/replace: Add ucontext configure autoconf checks. via 7fe400d lib/replace: Add ucontext configure waf checks. via e54252c lib/replace: Add missing check for sys/wait.h from a82db92 smbd: Fix bug 9544, part 2
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 8f8ca589d2aa7f9deaae6a05cb5ab73da95372bf Author: Jeremy Allison <j...@samba.org> Date: Mon Jan 14 15:22:11 2013 -0800 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 <j...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> Autobuild-User(master): Stefan Metzmacher <me...@samba.org> Autobuild-Date(master): Tue Jan 15 12:13:43 CET 2013 on sn-devel-104 commit 0258138e207c8f3e8bb05a47599aa04b4e9567cf Author: Jeremy Allison <j...@samba.org> Date: Mon Jan 14 15:21:52 2013 -0800 lib/replace: Include sys/ucontext.h if available. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit fe6e323addb967b392bfd406c499a6f67fcdc152 Author: Jeremy Allison <j...@samba.org> Date: Mon Jan 14 15:21:35 2013 -0800 lib/replace: Add ucontext configure autoconf checks. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 7fe400de4c189c8bdf0cc8afdebde2f21680fac2 Author: Jeremy Allison <j...@samba.org> Date: Mon Jan 14 15:21:12 2013 -0800 lib/replace: Add ucontext configure waf checks. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit e54252ceec213644a8d812e6374476639f764643 Author: Jeremy Allison <j...@samba.org> Date: Mon Jan 14 15:06:12 2013 -0800 lib/replace: Add missing check for sys/wait.h Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/replace/libreplace.m4 | 15 ++++++++++++++- lib/replace/system/wait.h | 4 ++++ lib/replace/wscript | 11 ++++++++++- lib/tevent/tevent_signal.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index 5a41844..f4ae715 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -68,7 +68,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]) @@ -126,6 +126,7 @@ AC_CHECK_HEADERS(unix.h) AC_CHECK_HEADERS(malloc.h) AC_CHECK_HEADERS(syscall.h) AC_CHECK_HEADERS(sys/syscall.h) +AC_CHECK_HEADERS(sys/ucontext.h) AC_CHECK_FUNCS(syscall setuid seteuid setreuid setresuid setgid setegid setregid setresgid setgroups) AC_CHECK_FUNCS(chroot bzero strerror strerror_r memalign posix_memalign getpagesize) @@ -415,6 +416,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" 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 diff --git a/lib/replace/wscript b/lib/replace/wscript index 674b99d..dff5847 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -79,7 +79,7 @@ struct foo bar = { .y = 'X', .x = 1 }; conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') conf.CHECK_HEADERS('sys/resource.h sys/security.h sys/shm.h sys/statfs.h sys/statvfs.h sys/termio.h') conf.CHECK_HEADERS('sys/vfs.h sys/xattr.h termio.h termios.h sys/file.h') - conf.CHECK_HEADERS('sys/wait.h sys/stat.h malloc.h grp.h') + conf.CHECK_HEADERS('sys/ucontext.h sys/wait.h sys/stat.h malloc.h grp.h') conf.CHECK_HEADERS('sys/select.h setjmp.h utime.h sys/syslog.h syslog.h') conf.CHECK_HEADERS('stdarg.h vararg.h sys/mount.h mntent.h') conf.CHECK_HEADERS('stropts.h unix.h string.h strings.h sys/param.h limits.h') @@ -203,6 +203,15 @@ struct foo bar = { .y = 'X', .x = 1 }; lib='nsl socket', headers='sys/socket.h netdb.h netinet/in.h') + if conf.CONFIG_SET('HAVE_SYS_UCONTEXT_H') and conf.CONFIG_SET('HAVE_SIGNAL_H'): + conf.CHECK_CODE(''' + ucontext_t uc; + sigaddset(&uc.uc_sigmask, SIGUSR1); + ''', + 'HAVE_UCONTEXT_T', + msg="Checking whether we have ucontext_t", + headers='signal.h sys/ucontext.h') + # these may be builtins, so we need the link=False strategy conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy strncpy bzero', link=False) diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index 77ef7b0..9582f6e 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -121,10 +121,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]); } } -- Samba Shared Repository