aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/check/crc32_fast.c
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2024-03-09 09:20:57 +0800
committerJia Tan <jiat0218@gmail.com>2024-03-09 09:20:57 +0800
commit82ecc538193b380a21622aea02b0ba078e7ade92 (patch)
treee7f270edf8d9f9510ab4182e896eb1f091bd0b62 /src/liblzma/check/crc32_fast.c
parentliblzma: Fix a typo in a comment in the RISC-V filter. (diff)
downloadxz-82ecc538193b380a21622aea02b0ba078e7ade92.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 '')
-rw-r--r--src/liblzma/check/crc32_fast.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/liblzma/check/crc32_fast.c b/src/liblzma/check/crc32_fast.c
index 079051f1..719d696c 100644
--- a/src/liblzma/check/crc32_fast.c
+++ b/src/liblzma/check/crc32_fast.c
@@ -135,15 +135,12 @@ typedef uint32_t (*crc32_func_type)(
// This resolver is shared between all three dispatch methods. It serves as
// the ifunc resolver if ifunc is supported, otherwise it is called as a
// regular function by the constructor or first call resolution methods.
-// The __no_profile_instrument_function__ attribute support is checked when
-// determining if ifunc can be used, so it is safe to use here.
-#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 crc32_func_type
crc32_resolve(void)
{
- return is_arch_extension_supported()
+ return is_arch_extension_supported()
? &crc32_arch_optimized : &crc32_generic;
}