MapboxCoreMaps 11.32.0+ crashes with EXC_BAD_INSTRUCTION on A10 and older devices (unguarded LSE ldadd in Highway aligned allocator)

オープン
#2,455 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
15/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, ios, swift

調査の方向性

The faulting instruction is an unguarded LSE ldadd inside Highway's AllocateAlignedBytes in vendor/highway/.../aligned_allocator.cc, shipped in the iOS arm64 slice of MapboxCoreMaps. Start with the iOS arm64 build settings for Highway and check whether -moutline-atomics or an armv8-a target is applied there. Done means the iOS device slice has no LSE-only atomics, and the app runs on an A10 device under iPadOS 18.

索引モデルが issue の本文から書いたものです。

説明

auto-triaged bug :beetle: p1

Environment

  • Xcode version: 26.4, 27.2
  • iOS version: iPadOS 18.7.11 (22H384)
  • Devices affected: Apple A10 and older (ARMv8.0, no LSE). Reproduced on an iPad (7th generation, 2019, A10 Fusion). A11 and newer are fine.
  • Maps SDK Version: 11.32.x, 11.33.x, 11.34.x and 11.35.0-rc.1 are affected. 11.31.1 is fine. Crash below is from 11.33.1. We use them through @rnmapbox/maps 10.3.17, with both CocoaPods and SPM.

Observed behavior and steps to reproduce

  1. Build an app (Release) against MapboxMaps 11.32.0 or later.
  2. Run it on an A10 device.
  3. Display a map.
  4. The app crashes with EXC_BAD_INSTRUCTION (SIGILL) on a Mapbox worker thread while the main thread is rendering the map (MapboxMaps → MetalKit → MapboxCoreMaps → AGXMetalA10).

The exception subcode in the crash report (4163436808 = 0xF8290008) is the faulting instruction itself: ldadd x9, x8, [x0], an ARMv8.1 LSE atomic add, with x9 = 1 (an atomic increment). Disassembling in lldb at the faulting PC confirms the trap is inside Highway's AllocateAlignedBytes (vendor/highway/.../aligned_allocator.cc).

Symbolication points the top frames at StyleManager::isStyleLoadingFinished, mbgl::emptyWorldview and mapbox::common::platform::processTask. MapboxCoreMaps ships without dSYMs, though, so those names are just the nearest exported symbols.

Crash report (redacted, idle threads omitted)
OS Version: iOS 18.7.11 (22H384)
Report Version: 104

OS Version: iOS 18.7.11 (22H384)
Report Version: 104

Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: ILL_NOOP at 0x000000010569f004
Crashed Thread: 29

Application Specific Information:
Exception 2, Code 1, Subcode 4163436808

Thread 29 Crashed:
0   MapboxCoreMaps                  0x10569f004         0x105688000 + 4385796100
1   MapboxCoreMaps                  0x1059505b0         0x105688000 + 4388619696
2   MapboxCoreMaps                  0x1060967c8         0x105688000 + 4396246984
3   MapboxCommon                    0x10505afe8         0x104ea0000 + 4379226088
4   libdispatch.dylib               0x32c79382c         0x32c738000 + 7020107820
5   libdispatch.dylib               0x32c794a64         0x32c738000 + 7020112484
6   libdispatch.dylib               0x32c73e308         0x32c738000 + 7019758344
7   libdispatch.dylib               0x32c73daec         0x32c738000 + 7019756268
8   libdispatch.dylib               0x32c74a17c         0x32c738000 + 7019807100
9   libdispatch.dylib               0x32c74a900         0x32c738000 + 7019809024
10  libsystem_pthread.dylib         0x3dae209d0         0x3dae20000 + 8482974160

Thread 0
0   libsystem_kernel.dylib          0x3b4bacbf4         0x3b4bac000 + 8162921460
1   IOKit                           0x32ddcef3c         0x32ddce000 + 7031578428
2   IOKit                           0x32ddcf200         0x32ddce000 + 7031579136
3   IOGPU                           0x441139aec         0x441136000 + 9340242668
4   IOGPU                           0x441138f98         0x441136000 + 9340239768
5   IOGPU                           0x441139484         0x441136000 + 9340241028
6   AGXMetalA10                     0x4832ef5c4         0x4832ea000 + 9894790596
7   AGXMetalA10                     0x4832ef3f4         0x4832ea000 + 9894790132
8   AGXMetalA10                     0x4832ef3c0         0x4832ea000 + 9894790080
9   AGXMetalA10                     0x4832eef30         0x4832ea000 + 9894788912
10  AGXMetalA10                     0x483333820         0x4832ea000 + 9895069728
11  MapboxCoreMaps                  0x105b95388         0x105688000 + 4390998920
12  MapboxCoreMaps                  0x105ba0a64         0x105688000 + 4391045732
13  MapboxCoreMaps                  0x105c5ffc4         0x105688000 + 4391829444
14  MapboxCoreMaps                  0x1060bd8b4         0x105688000 + 4396406964
15  MapboxCoreMaps                  0x105e070dc         0x105688000 + 4393562332
16  MapboxCoreMaps                  0x105e4e40c         0x105688000 + 4393853964
17  MapboxCoreMaps                  0x105e16ff0         0x105688000 + 4393627632
18  MapboxCoreMaps                  0x105e0ca40         0x105688000 + 4393585216
19  MapboxCoreMaps                  0x1059f04fc         0x105688000 + 4389274876
20  MapboxCoreMaps                  0x1059e33c0         0x105688000 + 4389221312
21  MapboxMaps                      0x1066efcd4         0x106570000 + 4402904276
22  MapboxMaps                      0x1066efcd4         0x106570000 + 4402904276
23  MetalKit                        0x43455363c         0x43454e000 + 9233344060
24  MapboxMaps                      0x1066dee08         0x106570000 + 4402834952
25  MapboxMaps                      0x1066df588         0x106570000 + 4402836872
26  MapboxMaps                      0x10663d390         0x106570000 + 4402172816
27  MapboxMaps                      0x10663d390         0x106570000 + 4402172816
28  QuartzCore                      0x320c61714         0x320c52000 + 6921807636
29  QuartzCore                      0x320c61320         0x320c52000 + 6921806624
30  QuartzCore                      0x320c618b0         0x320c52000 + 6921808048
31  UIKitCore                       0x322519214         0x322510000 + 6934753812
32  UIKitCore                       0x322518848         0x322510000 + 6934751304
33  UIKitCore                       0x322513ebc         0x322510000 + 6934732476
34  CoreFoundation                  0x31d713b94         0x31d704000 + 6893861780
...
43  App                             0x202e9d9d8         0x202ccc000 + 4343847384
46  dyld                            0x367495968         0x367460000 + 7513389416

Thread 27
0   MapboxCoreMaps                  0x105b4ccf4         0x105688000 + 4390702324
1   MapboxCoreMaps                  0x105b489b4         0x105688000 + 4390685108
2   MapboxCoreMaps                  0x105b37cf4         0x105688000 + 4390616308
3   MapboxCoreMaps                  0x1060ce870         0x105688000 + 4396476528
4   MapboxCoreMaps                  0x1060cd358         0x105688000 + 4396471128
5   MapboxCoreMaps                  0x1060cdac0         0x105688000 + 4396473024
6   MapboxCommon                    0x1050c0e54         0x104ea0000 + 4379643476
7   MapboxCommon                    0x10505afe8         0x104ea0000 + 4379226088
8   libdispatch.dylib               0x32c79382c         0x32c738000 + 7020107820
...
14  libsystem_pthread.dylib         0x3dae209d0         0x3dae20000 + 8482974160

(other threads idle, omitted)

Thread 29 crashed with ARM Thread State (64-bit):
    x0: 0x00000000000001b0   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x00000003015e3a00
    x4: 0x0000000000000000   x5: 0x00000000dc20a09f   x6: 0xffffffff42270b8d   x7: 0x0000000000000000
    x8: 0x00000001064bf150   x9: 0x0000000000000001  x10: 0x000000000000006c  x11: 0x0000000302faf3e0
   x12: 0x00000000000007fd  x13: 0x00000003022f61f8  x14: 0x00000000dc40a8e8  x15: 0x00000000dc20a09f
   x16: 0x0000000000000000  x17: 0x00000000000000e8  x18: 0x0000000000000000  x19: 0x00000000000001b0
   x20: 0x00000003015e3a00  x21: 0x00000000000001b0  x22: 0x00000003022f6180  x23: 0x000000000000006c
   x24: 0x00000003015e39c0  x25: 0x00000003015e39c0  x26: 0x00000003015e39c0  x27: 0x0000000302faf42c

Binary Images:
0x202ccc000 - 0x2045e7fff App arm64  <redacted> <redacted>/App.app/App
0x104ea0000 - 0x1055a3fff MapboxCommon arm64  <1f0a2490a2f63f6cb5e70f9085be1516> <redacted>/App.app/Frameworks/MapboxCommon.framework/MapboxCommon
0x105688000 - 0x10645bfff MapboxCoreMaps arm64  <570ed0ab77e53a4980c3d376c9f9854c> <redacted>/App.app/Frameworks/MapboxCoreMaps.framework/MapboxCoreMaps
0x106570000 - 0x1068e3fff MapboxMaps arm64  <2eff174ac49b3f238cf7534f968a92c3> <redacted>/App.app/Frameworks/MapboxMaps.framework/MapboxMaps
0x32c738000 - 0x32c7b619f libdispatch.dylib arm64  <164c031dbfe33165a1281036168aea62> /usr/lib/system/libdispatch.dylib
0x43454e000 - 0x43456963f MetalKit arm64  <c8cf106997723e5a9415b434b416a852> /System/Library/Frameworks/MetalKit.framework/MetalKit
0x4832ea000 - 0x48348fc5f AGXMetalA10 arm64  <1e373aa01ed63e0ab36225610c862847> /System/Library/Extensions/AGXMetalA10.bundle/AGXMetalA10

Expected behavior

No crash. The iPad 7th generation (A10) runs iPadOS 18, and 11.31.1 runs on it without problems.

Notes / preliminary analysis

Since 11.32.0, MapboxCoreMaps includes Google Highway. In the iOS arm64 slice, Highway's aligned allocator compiles to an ARMv8.1 LSE atomic (ldadd) with no runtime check that the CPU supports it. A10 and older chips are ARMv8.0 and don't have LSE, so the instruction traps.

We checked the iOS device slices of each release:

Version Highway present Unguarded ldadd
11.23.1, 11.28.0, 11.31.0, 11.31.1 No No
11.32.x, 11.33.x, 11.34.x, 11.35.0-rc.1 Yes 1

The CocoaPods and SPM builds use the same xcframework-dynamic.zip, so they're equally affected.

Android isn't affected. In 11.34.1's libmapbox-maps.so, all 6 ldadd sites use outline atomics (a runtime LSE check with an LL/SC fallback), and there's no Highway.

Suggested fix: build Highway (or at least aligned_allocator.cc) for the iOS arm64 slice targeting plain armv8-a, or with -moutline-atomics, so it runs on ARMv8.0.

Workaround: pin MapboxMaps to 11.31.1 on iOS, at the cost of later fixes.

Additional links and references

主要言語
Swift
スター
601
フォーク
198
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mapbox/mapbox-maps-ios のほかの issue

mapbox/mapbox-maps-ios の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。