diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2024-01-11 19:57:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-11 19:57:17 +0200 |
commit | 989c856c5bd11c5c1c42b587541858ee992a1a5b (patch) | |
tree | 9466bccdd3572dcb63584edcacd43e7b99329b82 /libnetdata | |
parent | 2165279a87314fb74e8c4de735231a78de73aa54 (diff) |
Fix sanitizer errors (#16759)
* fix sanitizer errors in logs.c
* fix sanitizer errors in rrdlabels.c
* cleanup sanitizer exceptions
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/buffer/buffer.h | 5 | ||||
-rw-r--r-- | libnetdata/dictionary/dictionary.c | 2 | ||||
-rw-r--r-- | libnetdata/log/log.c | 22 |
3 files changed, 3 insertions, 26 deletions
diff --git a/libnetdata/buffer/buffer.h b/libnetdata/buffer/buffer.h index 25889f807d..bffcf6e1e4 100644 --- a/libnetdata/buffer/buffer.h +++ b/libnetdata/buffer/buffer.h @@ -279,11 +279,6 @@ static inline void buffer_memcat(BUFFER *wb, const void *mem, size_t bytes) { buffer_overflow_check(wb); } -/* - * FIXME: Attribute added because address sanitizer reports a log-related - * issue when running the agent with `-W unittest`. -*/ -__attribute__((no_sanitize("address"))) static inline void buffer_json_strcat(BUFFER *wb, const char *txt) { if(unlikely(!txt || !*txt)) return; diff --git a/libnetdata/dictionary/dictionary.c b/libnetdata/dictionary/dictionary.c index 0f5c3027a1..87975905c5 100644 --- a/libnetdata/dictionary/dictionary.c +++ b/libnetdata/dictionary/dictionary.c @@ -3803,6 +3803,8 @@ int dictionary_unittest(size_t entries) { errors += dictionary_unittest_threads(); errors += dictionary_unittest_view_threads(); + cleanup_destroyed_dictionaries(); + fprintf(stderr, "\n%zu errors found\n", errors); return errors ? 1 : 0; } diff --git a/libnetdata/log/log.c b/libnetdata/log/log.c index f3b584d348..b93ef2cc29 100644 --- a/libnetdata/log/log.c +++ b/libnetdata/log/log.c @@ -1576,11 +1576,6 @@ static void priority_annotator(BUFFER *wb, const char *key, struct log_field *lf buffer_strcat(wb, nd_log_id2priority(pri)); } -/* - * FIXME: Attribute added because address sanitizer reports a log-related - * issue when running the agent with `-W unittest`. -*/ -__attribute__((no_sanitize("address"))) static bool needs_quotes_for_logfmt(const char *s) { static bool safe_for_logfmt[256] = { @@ -1613,11 +1608,6 @@ static bool needs_quotes_for_logfmt(const char *s) return false; } -/* - * FIXME: Attribute added because address sanitizer reports a log-related - * issue when running the agent with `-W unittest`. -*/ -__attribute__((no_sanitize("address"))) static void string_to_logfmt(BUFFER *wb, const char *s) { bool spaces = needs_quotes_for_logfmt(s); @@ -1631,11 +1621,6 @@ static void string_to_logfmt(BUFFER *wb, const char *s) buffer_fast_strcat(wb, "\"", 1); } -/* - * FIXME: Attribute added because address sanitizer reports a log-related - * issue when running the agent with `-W unittest`. -*/ -__attribute__((no_sanitize("address"))) static void nd_logger_logfmt(BUFFER *wb, struct log_field *fields, size_t fields_max) { @@ -2170,8 +2155,8 @@ static void nd_logger(const char *file, const char *function, const unsigned lon if(likely(!thread_log_fields[NDF_TID].entry.set)) thread_log_fields[NDF_TID].entry = ND_LOG_FIELD_U64(NDF_TID, gettid()); + char os_threadname[NETDATA_THREAD_NAME_MAX + 1]; if(likely(!thread_log_fields[NDF_THREAD_TAG].entry.set)) { - char os_threadname[NETDATA_THREAD_NAME_MAX + 1]; const char *thread_tag = netdata_thread_tag(); if(!netdata_thread_tag_exists()) { if (!netdata_thread_tag_exists()) { @@ -2260,11 +2245,6 @@ static ND_LOG_SOURCES nd_log_validate_source(ND_LOG_SOURCES source) { // ---------------------------------------------------------------------------- // public API for loggers -/* - * FIXME: Attribute added because address sanitizer reports a log-related - * issue when running the agent with `-W unittest`. -*/ -__attribute__((no_sanitize("address"))) void netdata_logger(ND_LOG_SOURCES source, ND_LOG_FIELD_PRIORITY priority, const char *file, const char *function, unsigned long line, const char *fmt, ... ) { int saved_errno = errno; |