Mariadb 10.4.14-1 and 10.5.5 crash on Odroid C2

Post Reply
trap000d
Posts: 3
Joined: Thu Aug 20, 2020 2:04 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 1 time
Contact:

Mariadb 10.4.14-1 and 10.5.5 crash on Odroid C2

Post by trap000d »

Hi,
Arch Linux user is here.
I've reported it already at Archlinuxarm forum - https://archlinuxarm.org/forum/viewtopi ... 65&t=14690.
MariaDB developers have added some assembler code, as effect since 10.4.4 it crashes on C2 kernel branch 3.16 due to insufficient privileges - calls from user space to timer registers cause "Illegal Instruction" exception.
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
A particular command which causes exception

Code: Select all

__asm __volatile("mrs   %0, CNTVCT_EL0" : "=&r" (result));
I've managed to build a simplest example which causes 100% crash on C2 (timer_test_aarch64.c):

Code: Select all

typedef unsigned long long int ulonglong;
static inline ulonglong my_timer_cycles(void)
{
  {
    ulonglong result;
    __asm __volatile("mrs       %0, CNTVCT_EL0" : "=&r" (result));
    return result;
  }
}
int main(){
  ulonglong tc;
  tc = my_timer_cycles();
  return 0;
}

Code: Select all

gcc -g -o timer_test_aarch64 timer_test_aarch64.c
./timer_test_aarch64
Illegal instruction (core dumped)

User avatar
odroid
Site Admin
Posts: 38366
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2130 times
Been thanked: 1265 times
Contact:

Re: Mariadb 10.4.14-1 and 10.5.5 crash on Odroid C2

Post by odroid »

Is it still related to "mesontimer" configuration in boot.ini file?
viewtopic.php?p=183104#p183104

trap000d
Posts: 3
Joined: Thu Aug 20, 2020 2:04 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Mariadb 10.4.14-1 and 10.5.5 crash on Odroid C2

Post by trap000d »

odroid wrote:
Thu Aug 20, 2020 3:13 pm
Is it still related to "mesontimer" configuration in boot.ini file?
viewtopic.php?p=183104#p183104
No, I don't think so.
In modern kernels you can find the following in arch/arm64/kernel/traps.c:

Code: Select all

static const struct sys64_hook sys64_hooks[] = {
..........
        {
                /* Trap read access to CNTVCT_EL0 */
                .esr_mask = ESR_ELx_SYS64_ISS_SYS_OP_MASK,
                .esr_val = ESR_ELx_SYS64_ISS_SYS_CNTVCT,
                .handler = cntvct_read_handler,
        },
.........
};
I assume this adds bridge user->kernel for reading timer register. I've not found any similar in Odroid 3.16 kernel branch. As I mentioned, this was added at 4.12
P.S. I'm not a kernel guru , so I'll try to set setenv mesontimer "0" in my boot.ini (it's 1 now). Not sure if it will resolve the problem, though.

trap000d
Posts: 3
Joined: Thu Aug 20, 2020 2:04 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Mariadb 10.4.14-1 and 10.5.5 crash on Odroid C2

Post by trap000d »

setenv mesontimer "0" resolved the issue. After reboot both test program and MariaDB 10.5.5 server work fine.
Thanks a lot :)
These users thanked the author trap000d for the post:
odroid (Fri Aug 21, 2020 4:43 pm)

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 1 guest