Bug #114471 Core dump file will generate faile when the dir is not in /tmp or no dir setting
Submitted: 25 Mar 2024 6:44 Modified: 26 Mar 2024 13:11
Reporter: bingo yang Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.31 OS:Ubuntu
Assigned to: CPU Architecture:Any

[25 Mar 2024 6:44] bingo yang
Description:
If I do not configure the core file dir in core_pattern, the core dump file will generate success in /var/lib/mysql/;

If I configure the core file dir in /tmp, the core dump file will generate success too;

But if I configure the core file dir in other dir(which wil be 777), the core dump file will generate fail;

How to repeat:
1. install mysql server 8.0.31 in ubantu;

2. configure the core paremater in mysqld.cnf

[mysqld]
core-file
innodb_buffer_pool_in_core_file=OFF

3. restart mysql server:
service mysql stop
service mysql start

4. configure the os core dump parameter:
mkdir /home/corefiletest
chmod 777 /home/corefiletest
echo "/home/corefiletest/core-%e-%s-%u-%g-%p-%s-%t" > /proc/sys/kernel/core_pattern
ulimit -c 100000  #in fact, this is not needded

5. kill the mysql server and look at the corefile:
ps -ef |grep mysqld
kill -SEGV xxx
ll /home/corefiletest  # the core dump file won't generate

ps:
1. I write another test application, and make it crash ,the core file will be generate success in /home/corefiletest;
2. If configure the core_pattern: "core-%e-%s-%u-%g-%p-%s-%t", will generate core dump file success;
3. If make "corefiletest" dir in /tmp and chmod 777 and configure the core_pattern: "/tmp/corefiletest/core-%e-%s-%u-%g-%p-%s-%t", will generate core dump file success;
[26 Mar 2024 10:34] bingo yang
when I  configure the dir in appmor , it generate success;
but when I change the core dumpfile dir to /mnt, it failed again
[26 Mar 2024 13:11] MySQL Verification Team
Hi Mr. yang,

Thank you for your bug report.

However, this is not a bug.

This is a simple case of Unix file privilege system.  The user ID, under which MySQL daemon process runs, either  has or has not the file privileges to create and write a core file.

Not a bug.