[solved] mariadb 10.5.5 and 10.4.14 segfault on odroid c2

This forum is for topics dealing with problems with software specifically in the AArch64 repo.

[solved] mariadb 10.5.5 and 10.4.14 segfault on odroid c2

Postby Chipster » Tue Aug 18, 2020 9:39 am

Hello

I have a big issue with mariadb
$this->bbcode_second_pass_code('', '
> systemctl status mariadb

août 18 11:36:46 odroidc2salon systemd[1]: mariadb.service: Main process exited, code=dumped, status=4/ILL
août 18 11:36:46 odroidc2salon systemd[1]: mariadb.service: Failed with result 'core-dump'.
août 18 11:36:46 odroidc2salon systemd[1]: Failed to start MariaDB 10.5.5 database server.
')

I try to throw it in console:
$this->bbcode_second_pass_code('', '> mysqld
Instruction not allowed (core dumped)')
Someone have an idea ?
Last edited by Chipster on Wed Aug 19, 2020 11:19 am, edited 2 times in total.
Chipster
 
Posts: 4
Joined: Tue Aug 18, 2020 9:34 am

Re: mariadb on odroid c2 segfault

Postby trap000d » Tue Aug 18, 2020 10:31 am

Same for me. Downgraded it to 10.4.13, as 10.4.14 crashes too, complaining for illegal instruction:
$this->bbcode_second_pass_code('', '
Aug 18 21:37:53 example.com systemd[1]: mariadb.service: Main process exited, code=dumped, status=4/ILL
Aug 18 21:37:53 example.com systemd[1]: mariadb.service: Failed with result 'core-dump'.
Aug 18 21:37:53 example.com systemd[1]: Failed to start MariaDB 10.5.5 database server.
Aug 18 21:37:53 example.com kernel: audit: type=1130 audit(1597743473.496:296): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=mariadb comm="systemd" exe="/usr/lib/>
Aug 18 21:37:53 example.com systemd-coredump[2642]: Process 2640 (mariadbd) of user 977 dumped core.

Stack trace of thread 2640:
#0 0x000000557a12c56c my_timer_init (mariadbd + 0xefa56c)
#1 0x00000055798a8be0 _Z11mysqld_mainiPPc (mariadbd + 0x676be0)
#2 0x0000007fa3c97d90 __libc_start_main (libc.so.6 + 0x23d90)
#3 0x000000557989c7d0 _start (mariadbd + 0x66a7d0)
#4 0x000000557989c7d0 _start (mariadbd + 0x66a7d0)
')
trap000d
 
Posts: 11
Joined: Tue Aug 18, 2020 10:24 am

Re: mariadb on odroid c2 segfault

Postby Chipster » Tue Aug 18, 2020 11:54 am

I had strictly the same problems with 2 latest version. I am reassured.
Where did you find the PKGBUILD for 10.4.13 because I couldn't find anything?
Chipster
 
Posts: 4
Joined: Tue Aug 18, 2020 9:34 am

Re: mariadb on odroid c2 segfault

Postby Chipster » Tue Aug 18, 2020 5:26 pm

If someone has the tar file, I am interested :D
Chipster
 
Posts: 4
Joined: Tue Aug 18, 2020 9:34 am

Re: mariadb on odroid c2 segfault

Postby trap000d » Tue Aug 18, 2020 9:49 pm

You have to downgrade 3 packages: mariadb, mariadb-clients and mariadb-libs

https://trap000d.hopto.org/f/db1170aece3a498688cb/?dl=1
Link will be available for 7 days.
trap000d
 
Posts: 11
Joined: Tue Aug 18, 2020 10:24 am

Re: mariadb on odroid c2 segfault

Postby trap000d » Tue Aug 18, 2020 9:56 pm

If you'd like to build it from source,
git clone https://github.com/archlinuxarm/PKGBUILDs
cd extra/mariadb
git checkout add0a9da3de015db8c10a7e06f52fc713986f623
and the best luck.
trap000d
 
Posts: 11
Joined: Tue Aug 18, 2020 10:24 am

Re: mariadb on odroid c2 segfault

Postby trap000d » Wed Aug 19, 2020 9:20 am

OK. After some digging in core dumps and sources seems this is upstream regression.
In recent versions they've added some platform-depended definitions to mysys/my_rdtsc.c
$this->bbcode_second_pass_code('', '
385,386d364
< #elif defined(__GNUC__) && defined (__aarch64__)
< mti->cycles.routine= MY_TIMER_ROUTINE_AARCH64;
')
It's defined as #29 somewhere else, so basically it means "somewhere in 500 Mb of code there is a function with number 29 contains illegal aarch64 instruction". Yet have no time to find it :)

which I suppose causes crash immediately at start:
$this->bbcode_second_pass_code('', '
Reading symbols from /mnt/sda1/src/mariadb/dist.atomic/11/usr/bin/mariadbd...
(No debugging symbols found in /mnt/sda1/src/mariadb/dist.atomic/11/usr/bin/mariadbd)
[New LWP 132777]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/usr/bin/mariadbd'.
Program terminated with signal SIGILL, Illegal instruction.
#0 0x0000005583be6524 in my_timer_init ()

(gdb) bt
#0 0x0000005583be6524 in my_timer_init ()
#1 0x000000558335ebe0 in mysqld_main(int, char**) ()
#2 0x0000007f911e2d90 in __libc_start_main () from /usr/lib/libc.so.6
#3 0x00000055833527d0 in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
')
trap000d
 
Posts: 11
Joined: Tue Aug 18, 2020 10:24 am

Re: mariadb on odroid c2 segfault

Postby trap000d » Wed Aug 19, 2020 9:46 am

A-ha! Looks like this commit has caused the problem:
https://github.com/MariaDB/server/commi ... e697468fdf

Now I'm just wondering whether it possible to report the issue? Official site has no any links to development team, whereas their github repository have issues section off. I'm not ready to submit pull request there.

P.S. Probably I'll try to fix the code in a next few days. Either exclude assembler or find out what's wrong with command
$this->bbcode_second_pass_code('', '
__asm __volatile("mrs %0, CNTVCT_EL0" : "=&r" (result));
')
trap000d
 
Posts: 11
Joined: Tue Aug 18, 2020 10:24 am

Re: mariadb on odroid c2 segfault

Postby Chipster » Wed Aug 19, 2020 11:18 am

Great. Thank you for help 8-)
Chipster
 
Posts: 4
Joined: Tue Aug 18, 2020 9:34 am

Re: [solved] mariadb 10.5.5 and 10.4.14 segfault on odroid c

Postby trap000d » Wed Aug 19, 2020 10:40 pm

Well. Some more investigations.
TL;DR - we have to update kernel eventually (neither patching mariadb sources nor sticking at 10.4.13 look good enough)
$this->bbcode_second_pass_code('', '
/* In user-mode most of the generic timer registers are inaccessible
* however modern kernels (4.12+) allow access to cntvct_el0
*/
')

A bit longer explanation. Kernels prior to 4.12 hide timer registers from user space. See, e.g. 6-years old bug:
https://bugs.launchpad.net/qemu/+bug/1344320
So all calls from user space to timer registers cause "Illegal Instruction" exception

I still have 3.16.85 kernel on my C2. So update to mainline might resolve the issue automagically, however modern kernels are not supported officially by Odroid. I've read through their forum but haven't decided yet if it works stable enough to give it a try.
https://forum.odroid.com/viewtopic.php?t=22717
trap000d
 
Posts: 11
Joined: Tue Aug 18, 2020 10:24 am

Next

Return to ARMv8

Who is online

Users browsing this forum: No registered users and 4 guests