Bug #79230 | Undefined Behavior Sanitizer reports misaligned store in comp_err | ||
---|---|---|---|
Submitted: | 11 Nov 2015 14:11 | Modified: | 18 Nov 2015 14:40 |
Reporter: | Laurynas Biveinis (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Compiling | Severity: | S3 (Non-critical) |
Version: | 5.7.9 | OS: | Ubuntu (15.10) |
Assigned to: | CPU Architecture: | Any | |
Tags: | comp_err, ubsan |
[11 Nov 2015 14:11]
Laurynas Biveinis
[11 Nov 2015 14:14]
Laurynas Biveinis
Compiler and sanitizer versions (stock ones of Ubuntu 15.10): $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.2.1-22ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) $ dpkg -l libubsan* Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-=============================================-===========================-===========================-=============================================================================================== ii libubsan0:amd64 5.2.1-22ubuntu2 amd64 UBSan -- undefined behaviour sanitizer (runtime) ii libubsan0-dbg:amd64 5.2.1-22ubuntu2 amd64 UBSan -- undefined behaviour sanitizer (debug symbols)
[12 Nov 2015 0:55]
MySQL Verification Team
Thank you for the bug report. [ 14%] Built target comp_err Scanning dependencies of target GenError [ 14%] Generating ../include/mysqld_error.h, ../sql/share/english/errmsg.sys /home/miguel/mysql-5.7.9/include/byte_order_generic_x86.h:37:17: runtime error: store to misaligned address 0x7ffe895d0146 for type 'uint32', which requires 4 byte alignment 0x7ffe895d0146: note: pointer points here 03 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 68 ^ /home/miguel/mysql-5.7.9/include/byte_order_generic_x86.h:37:17: runtime error: store to misaligned address 0x7ffe895d014a for type 'uint32', which requires 4 byte alignment 0x7ffe895d014a: note: pointer points here 3b 11 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 68 6f 6d 65 2f ^ [ 14%] Built target GenError Scanning dependencies of target heap
[16 Nov 2015 8:40]
Tor Didriksen
Posted by developer: Suggested fix: write suppression rules for everything in byte_order_generic_x86.h It is written specifically for intel, which handles misaligned read/write just fine. We have other implementations for other platforms where alignment *does* matter.
[18 Nov 2015 14:40]
Paul DuBois
Noted in 5.7.11, 5.8.0 changelogs. Configuring MySQL with the -DWITH_UBSAN=ON CMake option resulted in spurious runtime warnings from comp_err. These are now suppressed. Also, a CMake warning was added that undefined behavior address sanitizer support is currently experimental.