summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-10-04 10:47:46 +0200
committerStefan Metzmacher <metze@samba.org>2011-10-04 12:51:35 +0200
commit4c6bfac12a274b0bbcdb54681a817b704839222d (patch)
tree866167d3db4c5877af54c647c4395e3cdf01eba2
parentf2b795e9cf3ddb0f6bf0929bd0e423d39d6d239a (diff)
downloadsamba-4c6bfac12a274b0bbcdb54681a817b704839222d.tar.gz
samba-4c6bfac12a274b0bbcdb54681a817b704839222d.tar.bz2
samba-4c6bfac12a274b0bbcdb54681a817b704839222d.zip
s3:lib/util: make sure panic action can attach a debugger on ubuntu (>=10.10)
By default user processes can't attach a debugger to a process. So explicitly allow that for all child processes, before calling the panic action script. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Tue Oct 4 12:51:35 CEST 2011 on sn-devel-104
-rw-r--r--source3/lib/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 689d41ed17..887d1849ee 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -31,6 +31,10 @@
#include <ccan/hash/hash.h>
#include "libcli/security/security.h"
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
+
/* Max allowable allococation - 256mb - 0x10000000 */
#define MAX_ALLOC_SIZE (1024*1024*256)
@@ -778,6 +782,13 @@ void smb_panic_s3(const char *why)
(unsigned long long)sys_getpid(), why));
log_stack_trace();
+#if defined(HAVE_PRCTL) && defined(PR_SET_PTRACER)
+ /*
+ * Make sure all children can attach a debugger.
+ */
+ prctl(PR_SET_PTRACER, getpid(), 0, 0, 0);
+#endif
+
cmd = lp_panic_action();
if (cmd && *cmd) {
DEBUG(0, ("smb_panic(): calling panic action [%s]\n", cmd));