GrapheneOS / hardened_malloc

Hardened allocator designed for modern systems. It has integration into Android's Bionic libc and can be used externally with musl and glibc as a dynamic library for use on other Linux-based platforms. It will gain more portability / integration over time.
https://grapheneos.org/
MIT License
1.26k stars 96 forks source link

Build broken with `-Wall -ffat-lto-objects` #200

Closed rusty-snake closed 2 years ago

rusty-snake commented 2 years ago

I build an rpm package (source) for hardened_malloc to installed it via dnf so dependencies/uninstalling are less likely to make trouble.

However after I upgraded to Fedora 36 hardened_malloc fails to build with

chacha.c: In function 'chacha_keystream_bytes':
chacha.c:73:9: error: 'ctarget' may be used uninitialized [-Werror=maybe-uninitialized]
   73 |     u8 *ctarget;
      |

This happens because rpmbuild adds it's own compiler flags (=it does not happen with an plain make). I could narrow it down to CFLAGS="-ffat-lto-objects -Wall" make. However IDK if this is a bug in hardened_malloc or gcc or if this is cause by newer gcc or rpmbuild version.

OS: Fedora Linux 36 gcc: 12.1.1 20220507 (Red Hat 12.1.1-1) hardened_malloc: 0d6d63c / 11

thestinger commented 2 years ago

It's not a bug. It's a false positive warning. This code comes from the ChaCha reference implementation and we don't want to change it much to avoid introducing any bugs.