From 18a0f0c17839e3662ac86a22975ae45886ae4cf6 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 19 Oct 2022 16:41:24 +1100 Subject: Fix AIX compulation (break addr resolution) Revert c92c1615852ecd4be2d04203600efd3eba578a02, casting to void* cannot fool gcc. The AIX address resolution was broken anyway, so just avoid the problem and make it compile well. --- mysys/my_addr_resolve.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c index 444a47bb7c5..4948ad3e698 100644 --- a/mysys/my_addr_resolve.c +++ b/mysys/my_addr_resolve.c @@ -319,12 +319,20 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) /* Save result for future comparisons. */ strnmov(addr2line_binary, info.dli_fname, sizeof(addr2line_binary)); +#ifdef _AIX + /* + info.dli_fbase is a char on AIX and casting it doesn't fool gcc. + leave backtracing broken on AIX until a real solution can be found. + */ + addr_offset= NULL; +#else /* Check if we should use info.dli_fbase as an offset or not for the base program. This is depending on if the compilation is done with PIE or not. */ - addr_offset= (void*) info.dli_fbase; + addr_offset= info.dli_fbase; +#endif #ifndef __PIE__ if (strcmp(info.dli_fname, my_progname) == 0 && addr_resolve((void*) my_addr_resolve, loc) == 0 && -- cgit v1.2.1 From 899cedb33c8e92a0067f2d74015300454c6235ae Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 26 Oct 2022 19:52:17 -0400 Subject: Fix building my_gethwaddr() on OpenBSD --- mysys/my_gethwaddr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 70e1d549e15..5bb0ed75fb3 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -33,8 +33,14 @@ static my_bool memcpy_and_test(uchar *to, uchar *from, uint len) return res; } -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#ifdef __OpenBSD__ +#include +#include +#include +#else #include +#endif #include #include #include -- cgit v1.2.1 From ab81aefef6e54ec872622f996ed66626700e4d8e Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 26 Oct 2022 20:30:47 -0400 Subject: Fix building my_gethwaddr() on OpenBSD - part for 10.5 and newer --- mysys/my_gethwaddr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 6bba553a549..a2b159cf3b0 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -23,7 +23,7 @@ #ifndef MAIN -#if defined(_AIX) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__) || defined(__sun) || defined(_WIN32) +#if defined(_AIX) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__) || defined(__sun) || defined(_WIN32) static my_bool memcpy_and_test(uchar *to, uchar *from, uint len) { uint i, res= 1; -- cgit v1.2.1 From 92be8d20480ee0e2fb8ec72c005648f2573558ce Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 5 Nov 2022 18:36:43 +0100 Subject: MDEV-29951 server hang in crash handler When trying to output stacktrace, and addr2line is not installed, the child process forked by start_addr2line_fork() will fail to do exec(), and finish with exit(1). There is a problem with exit() though - it runs exit handlers, and for the forked copy of crashing process, it is a bad idea. In 10.5+ code for example, exit handlers include tpool::task_group static destructors, and it will hang infinitely waiting for completion of the outstanding tasks. The fix is to use _exit() instead, which skips the execution of exit handlers --- mysys/my_addr_resolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c index f0c0d214171..ac1bdae187c 100644 --- a/mysys/my_addr_resolve.c +++ b/mysys/my_addr_resolve.c @@ -202,7 +202,7 @@ int start_addr2line_fork(const char *binary_path) close(out[0]); close(out[1]); execlp("addr2line", "addr2line", "-C", "-f", "-e", binary_path, NULL); - exit(1); + _exit(1); } close(in[0]); -- cgit v1.2.1