From: Nick Porter Date: Tue, 3 Sep 2024 09:51:05 +0000 (+0100) Subject: Pacify UBSAN X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3d3029d1dafa4e516a19c3a5b5fbe86a5f28f9f;p=thirdparty%2Ffreeradius-server.git Pacify UBSAN --- diff --git a/src/lib/util/hash.c b/src/lib/util/hash.c index 6ceeaa4f74..73719d8609 100644 --- a/src/lib/util/hash.c +++ b/src/lib/util/hash.c @@ -425,6 +425,7 @@ static inline CC_HINT(always_inline) fr_hash_entry_t *hash_table_find(fr_hash_ta * - The user data we found. * - NULL if we couldn't find any matching data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ void *fr_hash_table_find(fr_hash_table_t *ht, void const *data) { fr_hash_entry_t *node; @@ -463,6 +464,7 @@ void *fr_hash_table_find_by_key(fr_hash_table_t *ht, uint32_t key, void const *d * - true if data was inserted. * - false if data already existed and was not inserted. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ bool fr_hash_table_insert(fr_hash_table_t *ht, void const *data) { uint32_t key; @@ -522,6 +524,7 @@ bool fr_hash_table_insert(fr_hash_table_t *ht, void const *data) * - 0 if data was inserted. * - -1 if we failed to replace data */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ int fr_hash_table_replace(void **old, fr_hash_table_t *ht, void const *data) { fr_hash_entry_t *node; @@ -552,6 +555,7 @@ int fr_hash_table_replace(void **old, fr_hash_table_t *ht, void const *data) * - The user data we removed. * - NULL if we couldn't find any matching data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ void *fr_hash_table_remove(fr_hash_table_t *ht, void const *data) { uint32_t key; @@ -586,6 +590,7 @@ void *fr_hash_table_remove(fr_hash_table_t *ht, void const *data) * - true if we removed data. * - false if we couldn't find any matching data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ bool fr_hash_table_delete(fr_hash_table_t *ht, void const *data) { void *old; @@ -601,6 +606,7 @@ bool fr_hash_table_delete(fr_hash_table_t *ht, void const *data) /* * Count number of elements */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ uint32_t fr_hash_table_num_elements(fr_hash_table_t *ht) { return ht->num_elements; diff --git a/src/lib/util/rb.c b/src/lib/util/rb.c index a94d2f630d..79af315abc 100644 --- a/src/lib/util/rb.c +++ b/src/lib/util/rb.c @@ -573,6 +573,7 @@ static inline CC_HINT(always_inline) fr_rb_node_t *find_node(fr_rb_tree_t const * * @hidecallergraph */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ void *fr_rb_find(fr_rb_tree_t const *tree, void const *data) { fr_rb_node_t *x; @@ -621,6 +622,7 @@ int fr_rb_find_or_insert(void **found, fr_rb_tree_t *tree, void const *data) * - true if data was inserted. * - false if data already existed and was not inserted. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ bool fr_rb_insert(fr_rb_tree_t *tree, void const *data) { if (insert_node(NULL, tree, UNCONST(void *, data)) == 0) return true; @@ -641,6 +643,7 @@ bool fr_rb_insert(fr_rb_tree_t *tree, void const *data) * - 0 if data was inserted. * - -1 if we failed to replace data */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ int fr_rb_replace(void **old, fr_rb_tree_t *tree, void const *data) { fr_rb_node_t *node; @@ -688,6 +691,7 @@ int fr_rb_replace(void **old, fr_rb_tree_t *tree, void const *data) * - The user data we removed. * - NULL if we couldn't find any matching data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ void *fr_rb_remove(fr_rb_tree_t *tree, void const *data) { fr_rb_node_t *node; @@ -733,6 +737,7 @@ void *fr_rb_remove_by_inline_node(fr_rb_tree_t *tree, fr_rb_node_t *node) * - true if we removed data. * - false if we couldn't find any matching data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ bool fr_rb_delete(fr_rb_tree_t *tree, void const *data) { fr_rb_node_t *node; @@ -772,6 +777,7 @@ bool fr_rb_delete_by_inline_node(fr_rb_tree_t *tree, fr_rb_node_t *node) * * @param[in] tree to return node count for. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ uint32_t fr_rb_num_elements(fr_rb_tree_t *tree) { return tree->num_elements; diff --git a/src/lib/util/trie.c b/src/lib/util/trie.c index afb8a6342c..344a245645 100644 --- a/src/lib/util/trie.c +++ b/src/lib/util/trie.c @@ -2638,6 +2638,7 @@ int fr_trie_walk(fr_trie_t *ft, void *ctx, fr_trie_walk_t callback) * - User data matching the data passed in. * - NULL if nothing matched passed data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ void *fr_trie_find(fr_trie_t *ft, void const *data) { fr_trie_user_t *user = (fr_trie_user_t *) ft; @@ -2663,6 +2664,7 @@ void *fr_trie_find(fr_trie_t *ft, void const *data) * - User data matching the data passed in. * - NULL if nothing matched passed data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ void *fr_trie_match(fr_trie_t *ft, void const *data) { fr_trie_user_t *user = (fr_trie_user_t *) ft; @@ -2688,6 +2690,7 @@ void *fr_trie_match(fr_trie_t *ft, void const *data) * - true if data was inserted. * - false if data already existed and was not inserted. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ bool fr_trie_insert(fr_trie_t *ft, void const *data) { fr_trie_user_t *user = (fr_trie_user_t *) ft; @@ -2720,6 +2723,7 @@ bool fr_trie_insert(fr_trie_t *ft, void const *data) * - 0 if data was inserted. * - -1 if we failed to replace data */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ int fr_trie_replace(void **old, fr_trie_t *ft, void const *data) { fr_trie_user_t *user = (fr_trie_user_t *) ft; @@ -2759,6 +2763,7 @@ int fr_trie_replace(void **old, fr_trie_t *ft, void const *data) * - The user data we removed. * - NULL if we couldn't find any matching data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ void *fr_trie_remove(fr_trie_t *ft, void const *data) { fr_trie_user_t *user = (fr_trie_user_t *) ft; @@ -2784,6 +2789,7 @@ void *fr_trie_remove(fr_trie_t *ft, void const *data) * - true if we removed data. * - false if we couldn't find any matching data. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ bool fr_trie_delete(fr_trie_t *ft, void const *data) { fr_trie_user_t *user = (fr_trie_user_t *) ft; @@ -2812,6 +2818,7 @@ bool fr_trie_delete(fr_trie_t *ft, void const *data) * * @param[in] ft to return node count for. */ +CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */ unsigned int fr_trie_num_elements(UNUSED fr_trie_t *ft) { return 0;