Skip to content

[Mobile] Android armeabi-v7a 32 bit bus error due to misaligned address #27311

@n-v-k

Description

@n-v-k

Describe the issue

With some (rare) models ONNXRuntime built for Android armeabi-v7a 32 bit architecture crashes with bus error. After re-compiling ORT with enabled sanitizers
-fsanitize=alignment -fno-omit-frame-pointer
I was able to find exact place:

/src/onnxruntime/core/optimizer/common_subexpression_elimination.cc:254:20: runtime error: reference binding to misaligned address 0xe022a091 for type 'const int64_t' (aka 'const long long'), which requires 8 byte alignment
0xe022a091: note: pointer points here
 00 00 00  10 01 00 00 00 00 00 00  00 00 00 00 00 00 00 00  01 81 00 00 00 00 4e b5  00 00 00 00 00
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /src/onnxruntime/core/optimizer/common_subexpression_elimination.cc:254:20 

Raw data buffers for tensor attributes of type char* has no proper alignment guarantees while reading values from them.

Platform

Android

OS Version

14

ONNX Runtime Installation

Built from Source

Compiler Version (if 'Built from Source')

NDK r28c

Package Name (if 'Released Package')

None

ONNX Runtime Version or Commit ID

4295524

ONNX Runtime API

C++/C

Architecture

ARM32

Execution Provider

Default CPU

Execution Provider Library Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform:mobileissues related to ONNX Runtime mobile; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions