diff options
author | Jia Tan <jiat0218@gmail.com> | 2024-03-09 09:20:57 +0800 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2024-03-09 09:20:57 +0800 |
commit | 651a1545c8b6150051a0b44857136efd419afc6f (patch) | |
tree | e09b4c242d5277681c743e345d23c3d099d15134 /src/liblzma/check/crc64_fast.c | |
parent | liblzma: Fix a typo in a comment in the RISC-V filter. (diff) | |
download | xz-651a1545c8b6150051a0b44857136efd419afc6f.tar.xz |
liblzma: Fix false Valgrind error report with GCC.
With GCC and a certain combination of flags, Valgrind will falsely
trigger an invalid write. This appears to be due to the omission of
instructions to properly save, set up, and restore the frame pointer.
The IFUNC resolver is a leaf function since it only calls a function
that is inlined. So sometimes GCC omits the frame pointer instructions
in the resolver unless this optimization is explictly disabled.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=2267598.
Diffstat (limited to 'src/liblzma/check/crc64_fast.c')
-rw-r--r-- | src/liblzma/check/crc64_fast.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/liblzma/check/crc64_fast.c b/src/liblzma/check/crc64_fast.c index 5728b45e..330a5016 100644 --- a/src/liblzma/check/crc64_fast.c +++ b/src/liblzma/check/crc64_fast.c @@ -98,13 +98,12 @@ typedef uint64_t (*crc64_func_type)( # pragma GCC diagnostic ignored "-Wunused-function" #endif -#ifdef CRC_USE_IFUNC -__attribute__((__no_profile_instrument_function__)) -#endif +// The funcion attributes are needed for safe IFUNC resolver usage with GCC. +lzma_resolver_attributes static crc64_func_type crc64_resolve(void) { - return is_arch_extension_supported() + return is_arch_extension_supported() ? &crc64_arch_optimized : &crc64_generic; } |