summaryrefslogtreecommitdiff
path: root/include/my_stacktrace.h
diff options
context:
space:
mode:
authorDavi Arnaut <davi.arnaut@oracle.com>2010-11-26 19:59:10 -0200
committerDavi Arnaut <davi.arnaut@oracle.com>2010-11-26 19:59:10 -0200
commitd5e928959e55b4c124a783b83c2c70069dbedbca (patch)
tree60dd85b3738059765520bb243a6626f1b7ec5a85 /include/my_stacktrace.h
parent2bdeabe78b2c4ed062fd5b5b2dc2525025a8efaa (diff)
downloadmariadb-git-d5e928959e55b4c124a783b83c2c70069dbedbca.tar.gz
Bug#51817: incorrect assumption: thd->query at 0x2ab2a8360360 is an invalid pointer
The problem is that the logic which checks if a pointer is valid relies on a poor heuristic based on the start and end addresses of the data segment and heap. Apart from miscalculating the heap bounds, this approach also suffers from the fact that memory can come from places other than the heap. See Bug#58528 for a more detailed explanation. On Linux, the solution is to access the process's memory through /proc/self/task/<tid>/mem, which allows for retrieving the contents of pages within the virtual address space of the calling process. If a address range is not mapped, a input/output error is returned. client/mysqltest.cc: Use new interface to my_safe_print_str. include/my_stacktrace.h: Drop name from my_safe_print_str. mysys/stacktrace.c: Access the process's memory through a file descriptor and dump the contents of the memory range. The file descriptor offset is equivalent to a offset into the address space. Do not print the name of the variable associated with the address. It can be better accomplished at a higher level. sql/mysqld.cc: Put the variable dumping information within its own newline block. Use symbolic names which better convey information to the user.
Diffstat (limited to 'include/my_stacktrace.h')
-rw-r--r--include/my_stacktrace.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index 9250fd4579e..b64d5d798a5 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -47,7 +47,7 @@ C_MODE_START
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
void my_init_stacktrace();
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
-void my_safe_print_str(const char* name, const char* val, int max_len);
+void my_safe_print_str(const char* val, int max_len);
void my_write_core(int sig);
#if BACKTRACE_DEMANGLE
char *my_demangle(const char *mangled_name, int *status);