-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vm Crash caused by unaligned float64 read on ARM #23953
Comments
If the typed data API is meant to support arbitrarily aligned accesses to ByteData buffers, then we'll have to emulate this on ARM, probably both in the functions generated by the TYPED_GETTER_SETTER macro in the ExternalTypedData class defined in //runtime/vm/object.h, and in {Load,Store}IndexedInstr. Since 32 and 64 bit integer accesses will be fixed up by either hardware or the kernel, we can probably just cast to/from an int type before the access. John, WDYT? |
@zanderso I don't think we can guarantee alignment of the loads / stores. We will need some fallback for unaligned I/O. |
Another duplicate: #22151 |
I was able to work around the crash using this: dart-archive/sdk@cad1d1f (Note to people attempting to copy my work around: be aware that it assumes that offset is a multiple of 8). |
As a side question: Does anyone know what big of a performance drop it is if we rely on the kernel to fix it? [I would naively assume it's quite big -- in which case a programmer might be very surprised if he adds e.g. one more byte in front of a messages and suddenly everything gets much slower.] |
@mkustermann I'd guess that doing something to prevent kernel handling of unaligned accesses would entail a big penalty to aligned accesses. I'll see if it's easy to convenient to get some numbers as I'm working on a fix. |
My CL fixed the discrepancy in class member offsets between the host- and the target-toolchain. So I don't think it will help here. The ALIGN8 macro just aligns offset of the member - so there would still be unaligned access if the object start is misaligned. |
@sortie Not sure if the slow down you experience is related to this, but sometimes the kernel traps unaligned access and emulates them which is significantly slower. |
We saw a Flutter customer hitting this in the wild in flutter/flutter#10701. |
Closing in favor of #22151. |
It looks like the DartVM makes unaligned memory access for doubles in certain cases.
We were recently seeing a VM crash with exit code SIGEMT ("Emulator trap; this results from certain unimplemented instructions which might be emulated in software, or the operating system's failure to properly emulate them."). Looking at it with gdb:
The instruction which caused the
SIGEMT
signal isvldr
which tries to load from0xb5611a5d
which is not aligned.The causing dart code called most likely this function:
There seems to be a linux kernel option named
CONFIG_ALIGNMENT_TRAP
which, when enabled, will cause a software emulation of the unaligned access, thereby not causing any issues. The option is apparently enabled by default in newer kernels. See here.=> Therefore I'm not sure if our buildbots would catch the issue.
Might be related to #23810 and #12868 .
cc possibly interested people: @zanderso, @johnmccutchan, @iposva
The text was updated successfully, but these errors were encountered: