From 03ef7b46e8ef3aeeedabd50da401b411a3de6b9c Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Tue, 13 Oct 2015 15:32:20 +0200 Subject: [PATCH 1/8] MDEV-10814: CMake test and feature macro for MADV_DONTDUMP availability --- config.h.cmake | 1 + configure.cmake | 1 + 2 files changed, 2 insertions(+) diff --git a/config.h.cmake b/config.h.cmake index 5e48085a61ae7..f7aa36e7c76de 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -206,6 +206,7 @@ #cmakedefine HAVE_NL_LANGINFO 1 #cmakedefine HAVE_MADVISE 1 #cmakedefine HAVE_DECL_MADVISE 1 +#cmakedefine HAVE_MADV_DONTDUMP 1 #cmakedefine HAVE_DECL_TGOTO 1 #cmakedefine HAVE_DECL_MHA_MAPSIZE_VA 1 #cmakedefine HAVE_MALLINFO 1 diff --git a/configure.cmake b/configure.cmake index 0057c7fb1003e..a19fde9a522b2 100644 --- a/configure.cmake +++ b/configure.cmake @@ -516,6 +516,7 @@ ENDIF() CHECK_SYMBOL_EXISTS(log2 math.h HAVE_LOG2) CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN) CHECK_SYMBOL_EXISTS(rint math.h HAVE_RINT) +CHECK_SYMBOL_EXISTS(MADV_DONTDUMP "sys/mman.h" HAVE_MADV_DONTDUMP) # isinf() prototype not found on Solaris CHECK_CXX_SOURCE_COMPILES( From 7fdbccaa4c532ef81099844dc6c5d9b8ad5000dc Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Tue, 13 Oct 2015 15:36:21 +0200 Subject: [PATCH 2/8] MDEV-10814: Add core-nodump option as global startup-only system variable --- include/my_global.h | 5 +++++ include/my_stacktrace.h | 32 ++++++++++++++++++++++++++++++++ mysys/stacktrace.c | 5 +++++ sql/sys_vars.cc | 15 +++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/include/my_global.h b/include/my_global.h index b958a8d9e28f8..fc8cf3e1687a6 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1232,4 +1232,9 @@ static inline double rint(double x) #undef __GNUG__ #endif +/* Fine grained control of what shall be excluded from core dumps */ +#ifdef HAVE_MADV_DONTDUMP +extern ulonglong opt_core_nodump; +#endif /* HAVE_MADV_DONTDUMP */ + #endif /* my_global_h */ diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index fad6e532de9cf..09582aad65009 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -40,6 +40,10 @@ #define BACKTRACE_DEMANGLE 1 #endif +#ifdef HAVE_SYS_MMAN_H +#include +#endif + C_MODE_START #if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) @@ -102,6 +106,34 @@ size_t my_safe_printf_stderr(const char* fmt, ...) */ size_t my_write_stderr(const void *buf, size_t count); +/* + Core dump control options to exclude certain buffers from core dump files + + There are two motivations for excluding things from core dumps: + + * resource utilization: stuff like the InnoDB pool buffer is rarely needed + for post mortem debugging, but on machines with large amounts of memory + just the time and file system space it takes to write a core dump can + become substantial. Large core dump sizes can also become an obstacle + when providing a core dump to a 3rd party for analysis + + * security: certain buffers, especially the InnoDB pool buffer or the + Aria page cache, are likely to contain sensitive user data. Excluding + these from a core dump can improve data security and especially can be + a requirement for being able to pass production server core dumps to + 3rd parties for analysis +*/ + +#ifdef HAVE_MADV_DONTDUMP + +/* Core dump exclusion constants */ +#define CORE_NODUMP_NONE 0 +#define CORE_NODUMP_MAX 1 << 1 +#define CORE_NODUMP_INNODB_POOL_BUFFER 1 << 2 +#define CORE_NODUMP_MYISAM_KEY_BUFFER 1 << 3 + +#endif /* HAVE_MADV_DONTDUMP */ + C_MODE_END #endif /* _my_stacktrace_h_ */ diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 395659238b373..aeb380abdb3c1 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -34,6 +34,11 @@ #include #endif +/* Fine grained control of what shall be excluded from core dumps */ +#ifdef HAVE_MADV_DONTDUMP +ulonglong opt_core_nodump = 0; +#endif + #define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) static char *heap_start; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 1a6bb9a4e54f8..b69d56fc73ab9 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5356,3 +5356,18 @@ static Sys_var_ulonglong Sys_max_thread_mem( "session variable MEM_USED", SESSION_VAR(max_mem_used), CMD_LINE(REQUIRED_ARG), VALID_RANGE(8192, ULONGLONG_MAX), DEFAULT(LONGLONG_MAX), BLOCK_SIZE(1)); + +#ifdef HAVE_MADV_DONTDUMP + +/* keep list in sync with constant definitiosn in my_stacktrace.h */ +static const char *core_nodump_names[] = { "MAX", + "INNODB_POOL_BUFFER", + "MYISAM_KEY_BUFFER", + NULL}; + +static Sys_var_set Sys_core_nodump( + "core_nodump", "Things to exclude from core dumps", + GLOBAL_VAR(opt_core_nodump), CMD_LINE(REQUIRED_ARG), + core_nodump_names, DEFAULT(0)); + +#endif /* HAVE_MADV_DONTDUMP */ From 8cb2014cb1fc765fa1e2994396824e0e4848b0fe Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Tue, 13 Oct 2015 16:34:08 +0200 Subject: [PATCH 3/8] MDEV-10814: Helper function for excluding a certain memory region from core dumps --- include/my_stacktrace.h | 6 ++++++ mysys/stacktrace.c | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index 09582aad65009..0ce777e6e4ba0 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -132,6 +132,12 @@ size_t my_write_stderr(const void *buf, size_t count); #define CORE_NODUMP_INNODB_POOL_BUFFER 1 << 2 #define CORE_NODUMP_MYISAM_KEY_BUFFER 1 << 3 +void exclude_from_coredump(void *ptr, size_t size, ulonglong flags); + +#else /* HAVE_MADV_DONTDUMP */ + +#define exclude_from_coredump(ptr, size, flag) + #endif /* HAVE_MADV_DONTDUMP */ C_MODE_END diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index aeb380abdb3c1..047f6cb775fc5 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -785,3 +785,15 @@ size_t my_safe_printf_stderr(const char* fmt, ...) my_write_stderr(to, result); return result; } + + +#ifdef HAVE_MADV_DONTDUMP + +void exclude_from_coredump(void *ptr, size_t size, ulonglong flags) +{ + if (opt_core_nodump & (flags | CORE_NODUMP_MAX)) { + madvise(ptr, size, MADV_DONTDUMP); + } +} + +#endif /* HAVE_MADV_DONTDUMP */ From 7761699233bc1ba677ebe1fd56bd0149abcad49c Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Wed, 14 Oct 2015 13:34:10 +0200 Subject: [PATCH 4/8] MDEV-10814: exclude InnoDB pool buffer from core dump if requested --- storage/innobase/buf/buf0buf.cc | 5 +++++ storage/xtradb/buf/buf0buf.cc | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 9e07a4d70f093..4688d3160d6c2 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -68,6 +68,9 @@ Created 11/5/1995 Heikki Tuuri #include "lzo/lzo1x.h" #endif +/* for core dump specific stuff */ +#include "my_stacktrace.h" + /* IMPLEMENTATION OF THE BUFFER POOL ================================= @@ -1214,6 +1217,8 @@ buf_chunk_init( } } #endif // HAVE_LIBNUMA + // exclude from core dumps if configured to do so + exclude_from_coredump(chunk->mem, chunk->mem_size, CORE_NODUMP_INNODB_POOL_BUFFER); /* Allocate the block descriptors from the start of the memory block. */ diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 84e3412387d5d..f776abf0c7006 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -65,6 +65,9 @@ Created 11/5/1995 Heikki Tuuri #include "fil0pagecompress.h" #include "ha_prototypes.h" +/* for core dump specific stuff */ +#include "my_stacktrace.h" + /* prototypes for new functions added to ha_innodb.cc */ trx_t* innobase_get_trx(); @@ -1282,6 +1285,8 @@ buf_chunk_init( } } #endif // HAVE_LIBNUMA + // exclude from core dumps if configured to do so + exclude_from_coredump(chunk->mem, chunk->mem_size, CORE_NODUMP_INNODB_POOL_BUFFER); /* Allocate the block descriptors from the start of the memory block. */ From 55cf83caf5b8454b2e7b4810f4b762b7bc74cddb Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Wed, 14 Oct 2015 14:31:42 +0200 Subject: [PATCH 5/8] MDEV-10814: core exclusions - added preliminary documentation --- Docs/README-core-dump-exclusion | 108 ++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 Docs/README-core-dump-exclusion diff --git a/Docs/README-core-dump-exclusion b/Docs/README-core-dump-exclusion new file mode 100644 index 0000000000000..28d38ddf8a854 --- /dev/null +++ b/Docs/README-core-dump-exclusion @@ -0,0 +1,108 @@ +Exclude things from core dumps (on Linux) +========================================= + +Movitation +---------- + +There are two reasons for wanting to reduce core dump size by excluding +certain memory areas from it: + +1. Reduce IO bandwidth and storage space requirements when dumping core + + This reduces the time it takes to take a core dump and also makes + transfering core files easier. + +2. Exclude sensitive data from core dumps + + At the same time backtrace information should remain complete and memory + regions that may be useful when doing post mortem debugging should be kept. + +Original motivation for implementation was that very large InnoDB instances +on machines with >300GB RAM, and accordingly large innodb buffer pool, were +crashing randomly every few days, and enabling core dumps on all of them was +not an option. Also, even after we finally managed to get hold of a core +dump the file size made it very hard to get it to an environment where it +could be analyzed without causng resource issues. + +Implementation +-------------- + +Linux supports options to madvise(2) that control whether a certain region +should be included in core dumps (MADV_DODUMP) or should be excluded +(MADV_DONTDUMP) starting with kernel version. Such memory regions need to +be page aligned so out of the box the feature is only useful when dealing +with large enough malloc() allocations or when directly dealing with +mmap()ed or shared memory regions directly. + +Certain memory allocations now call the new function + + exclude_from_coredump(void *ptr, size_t size, ulonglong flagmask); + +after successfully aquiring memory. A global variable "core_nodump" +may contain a set of memory regions to exclude. If the given flagmask +matches any of these, or if "core_nodump" has the 'magic' value "MAX", +the given memory region is marked to be excluded from core dumps using +the MADV_DONTDUMP advice. + +So far there's only support for excluding static buffers that stay for +the entire life time of the server process. Support for memory regions +allocated on demand, like those for temporary tables or sort buffers, +or that may be resized dynamically, like the query cache, is possible +but tricky as on freeing memory regions the MADV_DONTDUMP advice has to +be removed by an explicit MADV_DODUMP madvise() for the same region. +Otherwise other later memory allocations that happen to reuse fall in +the previously excluded memory range would accidentially be excluded +from being dumped. So at the time memory is freed it is also necessary +to remove the DONTDUMP advise, and for that not only the base address +is needed but also the original allocation size. As this is not always +explicitly preserved dynamic buffers have been excluded for this first +implementation. + + +Configuration +------------- + +A new configuration variable "core_nodump" has been added that controls +which buffer types should be excluded from core dump. The variable +can't be changed dynamically at run time as exclusions happen right +after allocating memory at startup. + +Possible values for "core_nodump" at this point are: + + Value | Description +--------------------|------------------------------------------------------ + NONE | Default: keep current behavior that dumps everything + INNODB_POOL_BUFFER | Exclude InnoDB pool buffer instances from core dump + MYISAM_KEY_BUFFER | Exclude MyISAM key buffer(s) from core dump + MAX | Apply all possible exclusion + + +Testing +------- + +A mysqld with the following minimalistic configuration + + [mysqld] + innodb_buffer_pool_size=8G + core-file + core-nodump=NONE + +will create a core dump of about 9GB when killed with `kill -11 $mysqld_pid`. + +The same mysqld with INNODB_BUFFER_POOL excluded from dumps only takes +about 900M, as was to be expected with the 8GB pool being excluded: + + [mysqld] + innodb_buffer_pool_size=8G + core-file + core-nodump=INNODB_BUFFER_POOL + +Backtraces can be retrieved sucessfully from both core dumps with gdb +and `thread apply all bt full`. + +As InnoDB buffer pool and Myisam key cache implementations can be considered +stable lack of those buffer contents should not affect core dump post mortem +analysis in any way. This may not be the case with new features like tablespace +encryption yet though, so core dump exclusions should be used carefully in such +contexts. + From a7a20db2d53199dea528df4b48e84eb3caba90a8 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 11 Mar 2017 20:17:41 +1100 Subject: [PATCH 6/8] MDEV-10814: core exclusions simplify definations --- include/my_stacktrace.h | 8 ++++---- mysys/stacktrace.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index 0ce777e6e4ba0..f9201722f6f9f 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -127,10 +127,10 @@ size_t my_write_stderr(const void *buf, size_t count); #ifdef HAVE_MADV_DONTDUMP /* Core dump exclusion constants */ -#define CORE_NODUMP_NONE 0 -#define CORE_NODUMP_MAX 1 << 1 -#define CORE_NODUMP_INNODB_POOL_BUFFER 1 << 2 -#define CORE_NODUMP_MYISAM_KEY_BUFFER 1 << 3 +#define CORE_NODUMP_NONE (0) +#define CORE_NODUMP_INNODB_POOL_BUFFER (1 << 1) +#define CORE_NODUMP_MYISAM_KEY_BUFFER (1 << 2) +#define CORE_NODUMP_MAX (255) void exclude_from_coredump(void *ptr, size_t size, ulonglong flags); diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 047f6cb775fc5..ca0d7f7bba6b9 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -791,7 +791,7 @@ size_t my_safe_printf_stderr(const char* fmt, ...) void exclude_from_coredump(void *ptr, size_t size, ulonglong flags) { - if (opt_core_nodump & (flags | CORE_NODUMP_MAX)) { + if (opt_core_nodump & flags) { madvise(ptr, size, MADV_DONTDUMP); } } From a51a8015574fdab59585857edacdfc5fba7b1c85 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 15 Mar 2017 23:18:32 +1100 Subject: [PATCH 7/8] 10814: coredump exclusions reorganise --- include/my_core_no_dump.h | 67 +++++++++++++++++++++++++++++++++ include/my_global.h | 5 --- include/my_stacktrace.h | 38 ------------------- mysys/stacktrace.c | 17 --------- sql/mysqld.cc | 4 ++ sql/sys_vars.cc | 4 +- storage/innobase/buf/buf0buf.cc | 2 +- storage/xtradb/buf/buf0buf.cc | 2 +- 8 files changed, 76 insertions(+), 63 deletions(-) create mode 100644 include/my_core_no_dump.h diff --git a/include/my_core_no_dump.h b/include/my_core_no_dump.h new file mode 100644 index 0000000000000..bd17697ac4aa0 --- /dev/null +++ b/include/my_core_no_dump.h @@ -0,0 +1,67 @@ +/* + Copyright (c) 2016, 2017, MariaDB Corporation. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + +/* This is the include file that should be included 'first' in every C file. */ + +#ifndef MY_CORE_NO_DUMP_INCLUDED +#define MY_CORE_NO_DUMP_INCLUDED + +/* + Core dump control options to exclude certain buffers from core dump files + + There are two motivations for excluding things from core dumps: + + * resource utilization: stuff like the InnoDB pool buffer is rarely needed + for post mortem debugging, but on machines with large amounts of memory + just the time and file system space it takes to write a core dump can + become substantial. Large core dump sizes can also become an obstacle + when providing a core dump to a 3rd party for analysis + + * security: certain buffers, especially the InnoDB pool buffer or the + Aria page cache, are likely to contain sensitive user data. Excluding + these from a core dump can improve data security and especially can be + a requirement for being able to pass production server core dumps to + 3rd parties for analysis +*/ + +#include + +#ifdef HAVE_MADV_DONTDUMP + +#include + +/* Core dump exclusion constants */ +#define CORE_NODUMP_NONE (0) +#define CORE_NODUMP_INNODB_POOL_BUFFER (1 << 1) +#define CORE_NODUMP_MYISAM_KEY_BUFFER (1 << 2) +#define CORE_NODUMP_MAX (255) + +extern ulong opt_core_nodump; + +inline void exclude_from_coredump(void *ptr, size_t size, ulong flags) +{ + if (opt_core_nodump & flags) { + madvise(ptr, size, MADV_DONTDUMP); + } +} + +#else /* HAVE_MADV_DONTDUMP */ + +#define exclude_from_coredump(ptr, size, flag) + +#endif /* HAVE_MADV_DONTDUMP */ + +#endif diff --git a/include/my_global.h b/include/my_global.h index fc8cf3e1687a6..b958a8d9e28f8 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1232,9 +1232,4 @@ static inline double rint(double x) #undef __GNUG__ #endif -/* Fine grained control of what shall be excluded from core dumps */ -#ifdef HAVE_MADV_DONTDUMP -extern ulonglong opt_core_nodump; -#endif /* HAVE_MADV_DONTDUMP */ - #endif /* my_global_h */ diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index f9201722f6f9f..fad6e532de9cf 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -40,10 +40,6 @@ #define BACKTRACE_DEMANGLE 1 #endif -#ifdef HAVE_SYS_MMAN_H -#include -#endif - C_MODE_START #if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) @@ -106,40 +102,6 @@ size_t my_safe_printf_stderr(const char* fmt, ...) */ size_t my_write_stderr(const void *buf, size_t count); -/* - Core dump control options to exclude certain buffers from core dump files - - There are two motivations for excluding things from core dumps: - - * resource utilization: stuff like the InnoDB pool buffer is rarely needed - for post mortem debugging, but on machines with large amounts of memory - just the time and file system space it takes to write a core dump can - become substantial. Large core dump sizes can also become an obstacle - when providing a core dump to a 3rd party for analysis - - * security: certain buffers, especially the InnoDB pool buffer or the - Aria page cache, are likely to contain sensitive user data. Excluding - these from a core dump can improve data security and especially can be - a requirement for being able to pass production server core dumps to - 3rd parties for analysis -*/ - -#ifdef HAVE_MADV_DONTDUMP - -/* Core dump exclusion constants */ -#define CORE_NODUMP_NONE (0) -#define CORE_NODUMP_INNODB_POOL_BUFFER (1 << 1) -#define CORE_NODUMP_MYISAM_KEY_BUFFER (1 << 2) -#define CORE_NODUMP_MAX (255) - -void exclude_from_coredump(void *ptr, size_t size, ulonglong flags); - -#else /* HAVE_MADV_DONTDUMP */ - -#define exclude_from_coredump(ptr, size, flag) - -#endif /* HAVE_MADV_DONTDUMP */ - C_MODE_END #endif /* _my_stacktrace_h_ */ diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index ca0d7f7bba6b9..395659238b373 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -34,11 +34,6 @@ #include #endif -/* Fine grained control of what shall be excluded from core dumps */ -#ifdef HAVE_MADV_DONTDUMP -ulonglong opt_core_nodump = 0; -#endif - #define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) static char *heap_start; @@ -785,15 +780,3 @@ size_t my_safe_printf_stderr(const char* fmt, ...) my_write_stderr(to, result); return result; } - - -#ifdef HAVE_MADV_DONTDUMP - -void exclude_from_coredump(void *ptr, size_t size, ulonglong flags) -{ - if (opt_core_nodump & flags) { - madvise(ptr, size, MADV_DONTDUMP); - } -} - -#endif /* HAVE_MADV_DONTDUMP */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4f83e19f90515..e8e7e93400b53 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -528,6 +528,10 @@ ulong feature_files_opened_with_delayed_keys; ulonglong denied_connections; my_decimal decimal_zero; +#ifdef HAVE_MADV_DONTDUMP +ulong opt_core_nodump; +#endif + /* Maximum length of parameter value which can be set through mysql_send_long_data() call. diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index b69d56fc73ab9..48c420e93131f 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -63,6 +63,8 @@ #include "opt_range.h" #include "rpl_parallel.h" +#include "my_core_no_dump.h" + /* The rule for this file: everything should be 'static'. When a sys_var variable or a function from this file is - in very rare cases - needed @@ -5359,7 +5361,7 @@ static Sys_var_ulonglong Sys_max_thread_mem( #ifdef HAVE_MADV_DONTDUMP -/* keep list in sync with constant definitiosn in my_stacktrace.h */ +/* keep list in sync with constant definitiosn in my_core_no_dump.h */ static const char *core_nodump_names[] = { "MAX", "INNODB_POOL_BUFFER", "MYISAM_KEY_BUFFER", diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 4688d3160d6c2..07c7c856b5989 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -69,7 +69,7 @@ Created 11/5/1995 Heikki Tuuri #endif /* for core dump specific stuff */ -#include "my_stacktrace.h" +#include "my_core_no_dump.h" /* IMPLEMENTATION OF THE BUFFER POOL diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index f776abf0c7006..c9fb3a340739d 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -66,7 +66,7 @@ Created 11/5/1995 Heikki Tuuri #include "ha_prototypes.h" /* for core dump specific stuff */ -#include "my_stacktrace.h" +#include "my_core_no_dump.h" /* prototypes for new functions added to ha_innodb.cc */ trx_t* innobase_get_trx(); From 8a8181b9fae01b8ae22239952ab73b4935f0d75c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 19 Mar 2017 23:58:57 +1100 Subject: [PATCH 8/8] remove MYISAM and restore MAX behaviour --- include/my_core_no_dump.h | 7 +++---- sql/sys_vars.cc | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/my_core_no_dump.h b/include/my_core_no_dump.h index bd17697ac4aa0..61c59746b3a14 100644 --- a/include/my_core_no_dump.h +++ b/include/my_core_no_dump.h @@ -45,15 +45,14 @@ /* Core dump exclusion constants */ #define CORE_NODUMP_NONE (0) -#define CORE_NODUMP_INNODB_POOL_BUFFER (1 << 1) -#define CORE_NODUMP_MYISAM_KEY_BUFFER (1 << 2) -#define CORE_NODUMP_MAX (255) +#define CORE_NODUMP_MAX (1 << 1) +#define CORE_NODUMP_INNODB_POOL_BUFFER (1 << 2) extern ulong opt_core_nodump; inline void exclude_from_coredump(void *ptr, size_t size, ulong flags) { - if (opt_core_nodump & flags) { + if (opt_core_nodump & (flags | CORE_NODUMP_MAX)) { madvise(ptr, size, MADV_DONTDUMP); } } diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 48c420e93131f..39a0fc318db45 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5364,7 +5364,6 @@ static Sys_var_ulonglong Sys_max_thread_mem( /* keep list in sync with constant definitiosn in my_core_no_dump.h */ static const char *core_nodump_names[] = { "MAX", "INNODB_POOL_BUFFER", - "MYISAM_KEY_BUFFER", NULL}; static Sys_var_set Sys_core_nodump(