mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '10.4' into 10.5
This commit is contained in:
@@ -33,13 +33,14 @@
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
|
||||
|
||||
static char *heap_start;
|
||||
|
||||
#if(defined HAVE_BSS_START) && !(defined __linux__)
|
||||
extern char *__bss_start;
|
||||
#endif
|
||||
#else
|
||||
#define PTR_SANE(p) (p)
|
||||
#endif /* __linux */
|
||||
|
||||
|
||||
/**
|
||||
Default handler for printing stacktrace
|
||||
@@ -67,9 +68,9 @@ static sig_handler default_handle_fatal_signal(int sig)
|
||||
|
||||
void my_init_stacktrace(int setup_handlers)
|
||||
{
|
||||
#if(defined HAVE_BSS_START) && !(defined __linux__)
|
||||
#ifdef __linux__
|
||||
heap_start = (char*) &__bss_start;
|
||||
#endif
|
||||
#endif /* __linux */
|
||||
if (setup_handlers)
|
||||
{
|
||||
struct sigaction sa;
|
||||
@@ -186,15 +187,15 @@ static int safe_print_str(const char *addr, size_t max_len)
|
||||
|
||||
int my_safe_print_str(const char* val, size_t max_len)
|
||||
{
|
||||
#ifdef __linux__
|
||||
char *heap_end;
|
||||
|
||||
#ifdef __linux__
|
||||
// Try and make use of /proc filesystem to safely print memory contents.
|
||||
if (!safe_print_str(val, max_len))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
heap_end= (char*) sbrk(0);
|
||||
#endif
|
||||
|
||||
if (!PTR_SANE(val))
|
||||
{
|
||||
|
Reference in New Issue
Block a user