Bug 1222395 - mariadbd crashes with Illegal Instruction
Summary: mariadbd crashes with Illegal Instruction
Status: RESOLVED UPSTREAM
: 1219684 (view as bug list)
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other (show other bugs)
Version: Current
Hardware: RISC-V Linux
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Jan Engelhardt
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-06 10:36 UTC by Jan Engelhardt
Modified: 2024-07-18 13:53 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Engelhardt 2024-04-06 10:36:07 UTC
# /usr/sbin/mariadbd --lc-messages=en_US --bootstrap --silent-startup --basedir=/usr --datadir=/var/lib/mysql --log-warnings=0 --enforce-storage-engine= --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysql/mysqld.log --max_allowed_packet=8M --net_buffer_length=16K
Illegal instruction (core dumped)

# cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20240404"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20240404"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
# CPE 2.3 format, boo#1217921
CPE_NAME="cpe:2.3:o:opensuse:tumbleweed:20240404:*:*:*:*:*:*:*"
#CPE 2.2 format
#CPE_NAME="cpe:/o:opensuse:tumbleweed:20240404"
BUG_REPORT_URL="https://bugzilla.opensuse.org"
SUPPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"

# uname -r
6.9.0-rc2-89-default

(gdb) bt
#0  0x0000002ad529bed4 in my_timer_init ()
#1  0x0000002ad4bfa35e in mysqld_main(int, char**) ()
#2  0x0000003fa682a668 in __libc_start_call_main () from /lib64/lp64d/libc.so.6
#3  0x0000003fa682a710 in __libc_start_main_impl () from /lib64/lp64d/libc.so.6
#4  0x0000002ad4bc1538 in _start ()
(gdb) disas
Dump of assembler code for function my_timer_init:
   0x0000002ad529bea0 <+0>:     add     sp,sp,-176
   0x0000002ad529bea2 <+2>:     sd      s0,160(sp)
   0x0000002ad529bea4 <+4>:     sd      s1,152(sp)
   0x0000002ad529bea6 <+6>:     sd      ra,168(sp)
   0x0000002ad529bea8 <+8>:     sd      s2,144(sp)
   0x0000002ad529beaa <+10>:    sd      s3,136(sp)
   0x0000002ad529beac <+12>:    sd      s4,128(sp)
   0x0000002ad529beae <+14>:    sd      s5,120(sp)
   0x0000002ad529beb0 <+16>:    sd      s6,112(sp)
   0x0000002ad529beb2 <+18>:    sd      s7,104(sp)
   0x0000002ad529beb4 <+20>:    sd      s8,96(sp)
   0x0000002ad529beb6 <+22>:    add     s0,sp,176
   0x0000002ad529beb8 <+24>:    lui     a5,0x3b9ad
   0x0000002ad529bebc <+28>:    add     a5,a5,-1536 # 0x3b9aca00
   0x0000002ad529bec0 <+32>:    auipc   a3,0x97b
   0x0000002ad529bec4 <+36>:    ld      a3,960(a3) # 0x2ad5c17280
   0x0000002ad529bec8 <+40>:    mv      s1,a0
   0x0000002ad529beca <+42>:    ld      a4,0(a3)
   0x0000002ad529becc <+44>:    sd      a4,-120(s0)
   0x0000002ad529bed0 <+48>:    li      a4,0
   0x0000002ad529bed2 <+50>:    sd      a5,16(a0)
=> 0x0000002ad529bed4 <+52>:    rdcycle a5
   0x0000002ad529bed8 <+56>:    beqz    a5,0x2ad529c182 <my_timer_init+738>

objdump -d:
  d23ed4:       c00027f3                rdcycle a5
Comment 1 Jan Engelhardt 2024-04-07 13:39:31 UTC
The machine in question is a VisionFive 2 (JH7110).
/proc/cpuinfo identifies the CPU as

isa: rv64imafdc_zicntr_zicsr_zifencei_zihpm_zba_zbb

But there are indications it does not actually support Zicntr in hardware, and instead, let firmware (OpenSBI) emulate it. https://libera.irclog.whitequark.org/riscv/2023-03-31

Whether my opensbi is recent enough (2023-11-29) is currently unclear.

Or, it's something much more trivial: The instruction is now privileged, https://github.com/MariaDB/server/commit/656f8867720efc1b4dd0969319f35a3e1a2a005e . I'll try that mariadb patch once I get the chance.
Comment 2 Jan Engelhardt 2024-05-08 11:40:08 UTC
Firmware update to VisionFive2 Software v5.11.3 didn't fix it.
I give up and declare this as defective hardware.
Comment 3 Matthias Brugger 2024-07-18 12:50:10 UTC
*** Bug 1219684 has been marked as a duplicate of this bug. ***
Comment 4 Matthias Brugger 2024-07-18 12:53:42 UTC
Seems to be fixed with latest Tumblweed. Please feel free to retest.

# cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20240709"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20240709"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
# CPE 2.3 format, boo#1217921
CPE_NAME="cpe:2.3:o:opensuse:tumbleweed:20240709:*:*:*:*:*:*:*"
#CPE 2.2 format
#CPE_NAME="cpe:/o:opensuse:tumbleweed:20240709"
BUG_REPORT_URL="https://bugzilla.opensuse.org"
SUPPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"

# systemctl start mariadb
# systemctl status mariadb
● mariadb.service - MariaDB database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; preset: disabled)
     Active: active (running) since Thu 2024-07-18 11:15:23 UTC; 1h 32min ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 10331 ExecStartPre=/usr/libexec/mysql/mysql-systemd-helper install (code=exited, status=0/SUCCESS)
    Process: 10381 ExecStartPre=/usr/libexec/mysql/mysql-systemd-helper upgrade (code=exited, status=0/SUCCESS)
   Main PID: 10388 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 8 (limit: 4624)
        CPU: 18.359s
     CGroup: /system.slice/mariadb.service
             └─10388 /usr/sbin/mysqld --defaults-file=/etc/my.cnf --user=mysql --socket=/run/mysql/mysql.sock

Jul 18 11:15:08 localhost.localdomain mysql-systemd-helper[10388]: 2024-07-18 11:15:08 0 [Note] InnoDB: log sequence >
Jul 18 11:15:08 localhost.localdomain mysql-systemd-helper[10388]: 2024-07-18 11:15:08 0 [Note] InnoDB: Loading buffe>
Jul 18 11:15:08 localhost.localdomain mysql-systemd-helper[10388]: 2024-07-18 11:15:08 0 [Note] Plugin 'FEEDBACK' is >
Jul 18 11:15:08 localhost.localdomain mysql-systemd-helper[10388]: 2024-07-18 11:15:08 0 [Note] Plugin 'wsrep-provide>
Jul 18 11:15:08 localhost.localdomain mysql-systemd-helper[10388]: 2024-07-18 11:15:08 0 [Note] InnoDB: Buffer pool(s>
Jul 18 11:15:23 localhost.localdomain mysql-systemd-helper[10388]: 2024-07-18 11:15:23 0 [Note] Server socket created>
Jul 18 11:15:23 localhost.localdomain mysql-systemd-helper[10388]: 2024-07-18 11:15:23 0 [Note] mysqld: Event Schedul>
Jul 18 11:15:23 localhost.localdomain mysql-systemd-helper[10388]: 2024-07-18 11:15:23 0 [Note] /usr/sbin/mysqld: rea>
Jul 18 11:15:23 localhost.localdomain mysql-systemd-helper[10388]: Version: '11.4.2-MariaDB'  socket: '/run/mysql/mys>
Jul 18 11:15:23 localhost.localdomain systemd[1]: Started MariaDB database server.
Comment 5 Andreas Schwab 2024-07-18 13:53:45 UTC
It's the mariadb commit from #c1 which landed in Tumbleweed on 2024-06-20.