summaryrefslogtreecommitdiff
path: root/src/include/common
diff options
context:
space:
mode:
authorJohn Naylor2024-04-06 05:14:38 +0000
committerJohn Naylor2024-04-06 05:20:40 +0000
commitdb17594ad73a871a176a9bf96e0589c2cf57052c (patch)
treec7aea52bc45f0308819b436389557d0d6a07ccd7 /src/include/common
parent4b968e2027ba46b31be0a648486f86a2cadc707d (diff)
Add macro to disable address safety instrumentation
fasthash_accum_cstring_aligned() uses a technique, found in various strlen() implementations, to detect a string's NUL terminator by reading a word at at time. That triggers failures when testing with "-fsanitize=address", at least with frontend code. To enable using this function anywhere, add a function attribute macro to disable such testing. Reviewed by Jeff Davis Discussion: https://postgr.es/m/CANWCAZbwvp7oUEkbw-xP4L0_S_WNKq-J-ucP4RCNDPJnrakUPw%40mail.gmail.com
Diffstat (limited to 'src/include/common')
-rw-r--r--src/include/common/hashfn_unstable.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/common/hashfn_unstable.h b/src/include/common/hashfn_unstable.h
index 1c782179cd6..d7ab6eeefe7 100644
--- a/src/include/common/hashfn_unstable.h
+++ b/src/include/common/hashfn_unstable.h
@@ -213,8 +213,11 @@ fasthash_accum_cstring_unaligned(fasthash_state *hs, const char *str)
*
* With an aligned pointer, we consume the string a word at a time.
* Loading the word containing the NUL terminator cannot segfault since
- * allocation boundaries are suitably aligned.
+ * allocation boundaries are suitably aligned. To keep from setting
+ * off alarms with address sanitizers, exclude this function from
+ * such testing.
*/
+pg_attribute_no_sanitize_address()
static inline size_t
fasthash_accum_cstring_aligned(fasthash_state *hs, const char *str)
{