mysqld doesn't dump core after setuid

Bug #1313020 reported by Raghavendra D Prabhu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
Won't Fix
Medium
Unassigned
5.5
Triaged
Medium
Unassigned
5.6
Triaged
Medium
Unassigned
5.7
Triaged
Medium
Unassigned

Bug Description

This is related to http://bugs.mysql.com/21723 but over there it
is classified as a feature request. (which doesn't make sense
since setuid/setguid is usually how people run mysqld).

Basically, unless you do "echo 2 > /proc/sys/fs/suid_dumpable" and "
echo “1″ > /proc/sys/kernel/core_uses_pid" (optional), you will
not get core (both require root).

Noticed this during:
/tmp/bld/sql/mysqld.cc:1713:7: warning: will never be executed
[-Wunreachable-code]
  if (test_flags & TEST_CORE_ON_SIGNAL)
      ^~~~~~~~~~

(The code is unreachable because of "unireg_abort(1);" above).

It seems fixed in mariadb codebase:

 allow_coredumps(); is called in the tail of
set_user/set_effective_user:

static inline void allow_coredumps()
{
#ifdef PR_SET_DUMPABLE
  if (test_flags & TEST_CORE_ON_SIGNAL)
  {
    /* inform kernel that process is dumpable */
    (void) prctl(PR_SET_DUMPABLE, 1);
  }
#endif
}

(the core_uses_pid is required since without it mysqld won't
overwrite a bare corefile if already exists -
http://www.linuxinsight.com/proc_sys_fs_suid_dumpable.html)

What's more is that core-file can even be made dynamic (but
outside scope of current bug) since all it is does is do a prctl.

Tags: upstream
tags: added: upstream
summary: - mysqld doesn't dump core
+ mysqld doesn't dump core after setuid
Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

This has not been a problem on jenkins for instance since over there we don't use setuid (jenkins user runs mysqld as same user unlike in centos etc. where init scripts are used).

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1496

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.