UBSan: multiple warnings about misaligned int pointers

RESOLVED FIXED in 3.28

Status

NSS
Libraries
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: ttaubert, Assigned: ttaubert)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
Created attachment 8797767 [details]
ubsan.txt

Running ssl_gtests with UBSan, we get a ton of warnings like:

load of misaligned address 0x60700000cfa1 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment

Those are all coming from optimized ChaCha20, SHA-1, MD5, 3DES, and Curve25519 implementations, and are all found in code meant for architectures that handle misaligned pointers just fine.

We should use clang attributes to make UBSan happy.
(Assignee)

Updated

2 years ago
Blocks: 1306947
(Assignee)

Comment 2

2 years ago
https://hg.mozilla.org/projects/nss/rev/80edbfda8848
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.28
Not happy here: https://bot.nss-crypto.org:8011/builders/1-osx109-x64-DBG/builds/303/steps/shell/logs/stdio

gcc -arch x86_64 -o Darwin13.3.0_64_DBG.OBJ/Darwin_SINGLE_SHLIB/sha_fast.o -c -g -fPIC  -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK  -Wall -Qunused-arguments -Wno-parentheses-equality -Werror -DXP_UNIX -DSHLIB_SUFFIX=\"dylib\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -DDEBUG -UNDEBUG -DDEBUG_mozilla -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DNSS_USE_64 -DNSS_X86_OR_X64 -DNSS_X64 -DHAVE_INT128_SUPPORT -DMP_API_COMPATIBLE -I../../../dist/Darwin13.3.0_64_DBG.OBJ/include -I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl  sha_fast.c
sha_fast.c:243:13: error: unknown attribute 'no_sanitize' ignored [-Werror,-Wattributes]
static void NO_SANITIZE_ALIGNMENT
            ^
./blapii.h:48:46: note: expanded from macro 'NO_SANITIZE_ALIGNMENT'
#define NO_SANITIZE_ALIGNMENT __attribute__((no_sanitize("alignment")))
                                             ^
1 error generated.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
It looks like this attribute isn't supported in older versions of clang.
(Assignee)

Comment 6

2 years ago
This should help with clang < 3.7:

https://hg.mozilla.org/projects/nss/rev/c282555675df
Status: REOPENED → RESOLVED
Last Resolved: 2 years ago2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.