UBSAN misaligned address errors #49

Closed
opened 2026-01-29 20:30:00 +00:00 by claunia · 5 comments
Owner

Originally created by @jeroen on GitHub (Oct 4, 2015).

See http://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-UBSAN/brotli-Ex.Rout

Originally created by @jeroen on GitHub (Oct 4, 2015). See http://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-UBSAN/brotli-Ex.Rout
Author
Owner

@eustas commented on GitHub (Oct 4, 2015):

Try to compile with -DBROTLI_BUILD_PORTABLE option

@eustas commented on GitHub (Oct 4, 2015): Try to compile with -DBROTLI_BUILD_PORTABLE option
Author
Owner

@jeroen commented on GitHub (Oct 4, 2015):

Thanks. Not sure if that justifies undefined behavior in the default build though.

@jeroen commented on GitHub (Oct 4, 2015): Thanks. Not sure if that justifies undefined behavior in the default build though.
Author
Owner

@eustas commented on GitHub (Oct 4, 2015):

We focused mostly on x64 and ARMv7 where unaligned read doesn't cause undefined behaviour (except for atomicity, but it's not the case).
We will consider to turn this optimisation only when compiler detects compatible CPU architecture.

@eustas commented on GitHub (Oct 4, 2015): We focused mostly on x64 and ARMv7 where unaligned read doesn't cause undefined behaviour (except for atomicity, but it's not the case). We will consider to turn this optimisation only when compiler detects compatible CPU architecture.
Author
Owner

@jeroen commented on GitHub (Oct 4, 2015):

I think you are mistaken, these UBSAN errors appear on linux on x86_64.

@jeroen commented on GitHub (Oct 4, 2015): I think you are mistaken, these UBSAN errors appear on linux on `x86_64`.
Author
Owner

@eustas commented on GitHub (Oct 4, 2015):

Yes, ubsan reports errors on x86_64 and we used it to check "portable" version.
But reporting unaligned reads by ubsan on x86_64 is done intentionally, so developers could verify their product without compiling for / running on specific hardware that can't to unaligned reads.

@eustas commented on GitHub (Oct 4, 2015): Yes, ubsan reports errors on x86_64 and we used it to check "portable" version. But reporting unaligned reads by ubsan on x86_64 is done intentionally, so developers could verify their product without compiling for / running on specific hardware that can't to unaligned reads.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#49