mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
liblzma: Fix -fsanitize=address failure with crc_clmul functions.
After forcing crc_simd_body() to always be inlined it caused -fsanitize=address to fail for lzma_crc32_clmul() and lzma_crc64_clmul(). The __no_sanitize_address__ attribute was added to lzma_crc32_clmul() and lzma_crc64_clmul(), but not removed from crc_simd_body(). ASAN and inline functions behavior has changed over the years for GCC specifically, so while strictly required we will keep __attribute__((__no_sanitize_address__)) on crc_simd_body() in case this becomes a requirement in the future. Older GCC versions refuse to inline a function with ASAN if the caller and callee do not agree on sanitization flags (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89124#c3). If the function was forced to be inlined, it will not compile if the callee function has __no_sanitize_address__ but the caller doesn't.
This commit is contained in:
parent
9a78971261
commit
c60b25569d
1 changed files with 6 additions and 0 deletions
|
@ -227,6 +227,9 @@ calc_hi(uint64_t p, uint64_t a, int n)
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
||||||
__attribute__((__target__("ssse3,sse4.1,pclmul")))
|
__attribute__((__target__("ssse3,sse4.1,pclmul")))
|
||||||
#endif
|
#endif
|
||||||
|
#if lzma_has_attribute(__no_sanitize_address__)
|
||||||
|
__attribute__((__no_sanitize_address__))
|
||||||
|
#endif
|
||||||
extern uint32_t
|
extern uint32_t
|
||||||
lzma_crc32_clmul(const uint8_t *buf, size_t size, uint32_t crc)
|
lzma_crc32_clmul(const uint8_t *buf, size_t size, uint32_t crc)
|
||||||
{
|
{
|
||||||
|
@ -317,6 +320,9 @@ calc_hi(uint64_t poly, uint64_t a)
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
||||||
__attribute__((__target__("ssse3,sse4.1,pclmul")))
|
__attribute__((__target__("ssse3,sse4.1,pclmul")))
|
||||||
#endif
|
#endif
|
||||||
|
#if lzma_has_attribute(__no_sanitize_address__)
|
||||||
|
__attribute__((__no_sanitize_address__))
|
||||||
|
#endif
|
||||||
extern uint64_t
|
extern uint64_t
|
||||||
lzma_crc64_clmul(const uint8_t *buf, size_t size, uint64_t crc)
|
lzma_crc64_clmul(const uint8_t *buf, size_t size, uint64_t crc)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue