mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Bug#21723: Should be able to dump core after setuid() under Linux
In many cases, binaries can no longer dump core after calling setuid(). Where the PR_SET_DUMPABLE macro is set, use the prctl() system call to tell the kernel that it's allowed to dump the core of the server. configure.in: Test system for "sys/prctl.h", to get access to prctl(). sql/mysqld.cc: Add a process-control operation that tells the Linux kernel that it is allowed to dump core after setuid().
This commit is contained in:
parent
6f742c9053
commit
4a009817ab
2 changed files with 13 additions and 0 deletions
|
|
@ -776,6 +776,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
|
|||
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
|
||||
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
|
||||
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
|
||||
sys/prctl.h \
|
||||
sys/resource.h sys/param.h)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
#include "ha_ndbcluster.h"
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PRCTL_H
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#define OPT_INNODB_DEFAULT 1
|
||||
|
|
@ -1365,6 +1368,15 @@ static struct passwd *check_user(const char *user)
|
|||
err:
|
||||
sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
|
||||
unireg_abort(1);
|
||||
|
||||
#ifdef PR_SET_DUMPABLE
|
||||
if (test_flags & TEST_CORE_ON_SIGNAL)
|
||||
{
|
||||
/* inform kernel that process is dumpable */
|
||||
(void) prctl(PR_SET_DUMPABLE, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue