mysqld: --dumpable option for KSPP w/ hidepid=2 This provides a mysqld option to force prctl(PR_SET_DUMPABLE, 1). The existing code-path to wsrep_sst_rsync does not work under KSPP with hidepid=2 cannot see the mysqld process, because it has PR_SET_DUMPABLE==0. Users with KSPP & hidepid=2 should set --dumpable for now. In future it would better if wsrep_sst_rsync did not assume that mysqld was not present just because it could not see the PID. Signed-off-by: Robin H. Johnson diff -Nuar --exclude '*~' mysql.orig/sql/mysqld.cc mysql/sql/mysqld.cc --- mysql.orig/sql/mysqld.cc 2018-02-25 19:27:16.000000000 -0800 +++ mysql/sql/mysqld.cc 2018-04-26 16:20:28.085268150 -0700 @@ -2485,7 +2485,7 @@ static inline void allow_coredumps() { #ifdef PR_SET_DUMPABLE - if (test_flags & TEST_CORE_ON_SIGNAL) + if (test_flags & TEST_DUMPABLE) { /* inform kernel that process is dumpable */ (void) prctl(PR_SET_DUMPABLE, 1); @@ -7364,6 +7364,8 @@ 0, 0, 0}, {"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"dumpable", OPT_DUMPABLE, "Force prctl(2) PR_SET_DUMPABLE", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "Built in DBUG debugger. Disabled in this build.", ¤t_dbug_option, ¤t_dbug_option, 0, GET_STR, OPT_ARG, @@ -9336,6 +9338,9 @@ opt_skip_name_resolve= 1; opt_specialflag|=SPECIAL_NO_RESOLVE; break; + case (int) OPT_DUMPABLE: + test_flags |= TEST_DUMPABLE; + break; case (int) OPT_WANT_CORE: - test_flags |= TEST_CORE_ON_SIGNAL; + test_flags |= TEST_CORE_ON_SIGNAL | TEST_DUMPABLE; break; diff -Nuar --exclude '*~' mysql.orig/sql/mysqld.h mysql/sql/mysqld.h --- mysql.orig/sql/mysqld.h 2018-02-25 19:27:16.000000000 -0800 +++ mysql/sql/mysqld.h 2018-04-26 16:21:47.516871026 -0700 @@ -59,6 +59,9 @@ #define TEST_SIGINT 1024U /**< Allow sigint on threads */ #define TEST_SYNCHRONIZATION 2048U /**< get server to do sleep in some places */ +#define TEST_DUMPABLE 4096U /**< Allow PR_SET_DUMPABLE without other + side-effects of TEST_CORE_ON_SIGNAL, + for use with KSPP & SST */ /* Keep things compatible */ #define OPT_DEFAULT SHOW_OPT_DEFAULT @@ -691,6 +694,7 @@ OPT_SSL_KEY, OPT_THREAD_CONCURRENCY, OPT_WANT_CORE, + OPT_DUMPABLE, #ifdef WITH_WSREP OPT_WSREP_CAUSAL_READS, OPT_WSREP_SYNC_WAIT,