unikraft/lib-newlib

include/limits.h: wrong size for `LONG_MAX` causes crash on `AArch64` apps

mariasfiraiala opened this issue · 1 comments

Describe the bug

Default size of the data model for AArch64 is 8 (64 bits) for long types, however newlibc ends up defining LONG_MAX as 32 bits.

This issue causes extremely optimized functions, such as memchr (which parses DTB for apps like SQLite or redis), to crash when compiled for AArch64.

Steps to reproduce

Build and run SQLite on AArch64 using newlib support.

Expected behavior

Run the SQLite app without any errors.

Which architectures were you using or does this bug affect?

AArch64

Which platforms were you using or does this bug affect?

KVM

Relevant log output

When I run the SQLite app this is the error I get:

[    0.000000] ERR:  [libkvmpl031] <pl031.c @  187> Failed to find RTC IRQ from DTB

Most likely it is caused by the behaviour of memchr when parsing DTB.

Hi, @mariasfiraiala . Thanks for this. It's indeed an issue with any aarch64 app. Attached (arm-helloworld.zip) is an archive to quickly build and run a helloworld app on aarch64, both with and without newlib, highlighting the issue