Skip to content

Commit

Permalink
Suppress UBSAN warning in CRC32 ARM (#6827)
Browse files Browse the repository at this point in the history
Summary:
UBSAN shows following warning:

util/crc32c_arm64.cc:111:11: runtime error: load of misaligned address 0x00001afcda86 for type 'const uint64_t', which requires 8 byte alignment
0x00001afcda86: note: pointer points here
cc c1 2d 00 01 81  40 24 30 66 39 66 30 37  30 63 2d 32 36 63 34 2d  34 62 61 61 2d 38 35 33  31 2d
^

Suppress it just as what we do in x86 CRC.
Pull Request resolved: #6827

Test Plan: Run the same UBSAN and see it to pass now.

Reviewed By: ltamasi

Differential Revision: D21471838

fbshipit-source-id: 02943dd39a7030d2b03e5d894dcb23ed72b6c9c3
  • Loading branch information
siying authored and facebook-github-bot committed May 8, 2020
1 parent e72e216 commit d9cd335
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions util/crc32c_arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ uint32_t crc32c_runtime_check(void) {
#endif
}

#ifdef ROCKSDB_UBSAN_RUN
#if defined(__clang__)
__attribute__((__no_sanitize__("alignment")))
#elif defined(__GNUC__)
__attribute__((__no_sanitize_undefined__))
#endif
#endif
uint32_t crc32c_arm64(uint32_t crc, unsigned char const *data,
unsigned len) {
const uint8_t *buf8;
Expand Down

0 comments on commit d9cd335

Please sign in to comment.