diff options
author | Abseil Team <absl-team@google.com> | 2024-03-12 13:50:27 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-03-12 13:51:42 -0700 |
commit | 3c1f9be71ee280539f02e57c5e461b0271f54e91 (patch) | |
tree | 8daae7de7e44c4ff1eb2495678de2c13f46ca16e /absl | |
parent | 686aae12d4766631cb2e0f9da0895f4df6db8c30 (diff) |
Disable ubsan for benign unaligned access in crc_memcpy
PiperOrigin-RevId: 615160537
Change-Id: I29070c898104c55e6563eed0eef7397441bef1d7
Diffstat (limited to 'absl')
-rw-r--r-- | absl/crc/internal/crc_memcpy_x86_arm_combined.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/absl/crc/internal/crc_memcpy_x86_arm_combined.cc b/absl/crc/internal/crc_memcpy_x86_arm_combined.cc index 5a8b4ec7..24353f2a 100644 --- a/absl/crc/internal/crc_memcpy_x86_arm_combined.cc +++ b/absl/crc/internal/crc_memcpy_x86_arm_combined.cc @@ -52,6 +52,7 @@ #include <cstring> #include <memory> +#include "absl/base/attributes.h" #include "absl/base/config.h" #include "absl/base/optimization.h" #include "absl/base/prefetch.h" @@ -88,9 +89,11 @@ inline crc32c_t ShortCrcCopy(char* dst, const char* src, std::size_t length, constexpr size_t kIntLoadsPerVec = sizeof(V128) / sizeof(uint64_t); // Common function for copying the tails of multiple large regions. +// Disable ubsan for benign unaligned access. See b/254108538. template <size_t vec_regions, size_t int_regions> -inline void LargeTailCopy(crc32c_t* crcs, char** dst, const char** src, - size_t region_size, size_t copy_rounds) { +ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED inline void LargeTailCopy( + crc32c_t* crcs, char** dst, const char** src, size_t region_size, + size_t copy_rounds) { std::array<V128, vec_regions> data; std::array<uint64_t, kIntLoadsPerVec * int_regions> int_data; @@ -155,8 +158,10 @@ class AcceleratedCrcMemcpyEngine : public CrcMemcpyEngine { std::size_t length, crc32c_t initial_crc) const override; }; +// Disable ubsan for benign unaligned access. See b/254108538. template <size_t vec_regions, size_t int_regions> -crc32c_t AcceleratedCrcMemcpyEngine<vec_regions, int_regions>::Compute( +ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED crc32c_t +AcceleratedCrcMemcpyEngine<vec_regions, int_regions>::Compute( void* __restrict dst, const void* __restrict src, std::size_t length, crc32c_t initial_crc) const { constexpr std::size_t kRegions = vec_regions + int_regions; |