aboutsummaryrefslogtreecommitdiffstats
path: root/testing/openvas-smb/disable-backtrace.patch
blob: f5e0ef819f2eba6f179baa10c0237b3d3bb16553 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
diff --git a/samba/include/config.h b/samba/include/config.h
index b99c4d5..dd85ee4 100644
--- a/samba/include/config.h
+++ b/samba/include/config.h
@@ -38,7 +38,7 @@
 /* #define HAVE_ATTR_XATTR_H 1 */
 
 /* Define to 1 if you have the `backtrace' function. */
-#define HAVE_BACKTRACE 1
+#define HAVE_BACKTRACE 0
 
 /* Define to 1 if you have the <blkid/blkid.h> header file. */
 /* #undef HAVE_BLKID_BLKID_H */
diff --git a/samba/include/config_tmp.h b/samba/include/config_tmp.h
index e85cb77..9c7e93c 100644
--- a/samba/include/config_tmp.h
+++ b/samba/include/config_tmp.h
@@ -38,7 +38,7 @@
 #define HAVE_ATTR_XATTR_H 1
 
 /* Define to 1 if you have the `backtrace' function. */
-#define HAVE_BACKTRACE 1
+#define HAVE_BACKTRACE 0
 
 /* Define to 1 if you have the <blkid/blkid.h> header file. */
 /* #undef HAVE_BLKID_BLKID_H */
diff --git a/samba/lib/util/fault.c b/samba/lib/util/fault.c
index c7d6b7e..a9cdabb 100644
--- a/samba/lib/util/fault.c
+++ b/samba/lib/util/fault.c
@@ -36,83 +36,6 @@ static struct {
 
 static const char *progname;
 
-#ifdef HAVE_BACKTRACE
-#include <execinfo.h>
-#elif HAVE_LIBEXC_H
-#include <libexc.h>
-#endif
-
-/**
- * Write backtrace to debug log
- */
-_PUBLIC_ void call_backtrace(void)
-{
-#ifdef HAVE_BACKTRACE
-#ifndef BACKTRACE_STACK_SIZE
-#define BACKTRACE_STACK_SIZE 64
-#endif
-	void *backtrace_stack[BACKTRACE_STACK_SIZE];
-	size_t backtrace_size;
-	char **backtrace_strings;
-
-	/* get the backtrace (stack frames) */
-	backtrace_size = backtrace(backtrace_stack,BACKTRACE_STACK_SIZE);
-	backtrace_strings = backtrace_symbols(backtrace_stack, backtrace_size);
-
-	DEBUG(0, ("BACKTRACE: %lu stack frames:\n", 
-		  (unsigned long)backtrace_size));
-	
-	if (backtrace_strings) {
-		int i;
-
-		for (i = 0; i < backtrace_size; i++)
-			DEBUGADD(0, (" #%u %s\n", i, backtrace_strings[i]));
-
-		/* Leak the backtrace_strings, rather than risk what free() might do */
-	}
-
-#elif HAVE_LIBEXC
-
-#define NAMESIZE 32 /* Arbitrary */
-#ifndef BACKTRACE_STACK_SIZE
-#define BACKTRACE_STACK_SIZE 64
-#endif
-
-	/* The IRIX libexc library provides an API for unwinding the stack. See
-	 * libexc(3) for details. Apparantly trace_back_stack leaks memory, but
-	 * since we are about to abort anyway, it hardly matters.
-	 *
-	 * Note that if we paniced due to a SIGSEGV or SIGBUS (or similar) this
-	 * will fail with a nasty message upon failing to open the /proc entry.
-	 */
-	{
-		uint64_t	addrs[BACKTRACE_STACK_SIZE];
-		char *      	names[BACKTRACE_STACK_SIZE];
-		char		namebuf[BACKTRACE_STACK_SIZE * NAMESIZE];
-
-		int		i;
-		int		levels;
-
-		ZERO_ARRAY(addrs);
-		ZERO_ARRAY(names);
-		ZERO_ARRAY(namebuf);
-
-		for (i = 0; i < BACKTRACE_STACK_SIZE; i++) {
-			names[i] = namebuf + (i * NAMESIZE);
-		}
-
-		levels = trace_back_stack(0, addrs, names,
-				BACKTRACE_STACK_SIZE, NAMESIZE);
-
-		DEBUG(0, ("BACKTRACE: %d stack frames:\n", levels));
-		for (i = 0; i < levels; i++) {
-			DEBUGADD(0, (" #%d 0x%llx %s\n", i, addrs[i], names[i]));
-		}
-     }
-#undef NAMESIZE
-#endif
-}
-
 _PUBLIC_ const char *panic_action = NULL;
 
 /**
@@ -143,8 +66,6 @@ _PUBLIC_ void smb_panic(const char *why)
 	}
 	DEBUG(0,("PANIC: %s\n", why));
 
-	call_backtrace();
-
 #ifdef SIGABRT
 	CatchSignal(SIGABRT,SIGNAL_CAST SIG_DFL);
 #endif
diff --git a/samba/lib/util/util_proto.h b/samba/lib/util/util_proto.h
index efc787f..bb48f46 100644
--- a/samba/lib/util/util_proto.h
+++ b/samba/lib/util/util_proto.h
@@ -44,7 +44,6 @@ _PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops);
 
 /* The following definitions come from lib/util/fault.c  */
 
-_PUBLIC_ void call_backtrace(void);
 _PUBLIC_ void smb_panic(const char *why);
 _PUBLIC_ void fault_setup(const char *pname);
 _PUBLIC_ BOOL register_fault_handler(const char *name, void (*fault_handler)(int sig));