]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add missing locks to isc_logconfig_get and disable thread sanitizer for isc_log_wouldlog
authorOndřej Surý <ondrej@isc.org>
Wed, 8 Jan 2020 07:57:21 +0000 (08:57 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 8 Jan 2020 10:53:04 +0000 (11:53 +0100)
lib/isc/log.c

index 3d60ca2fad6b6bc3357abc9e04f05bf7a6295137..fe560b5adff7f39f241fbf4b9aaabdaf39f0bd74 100644 (file)
@@ -397,9 +397,13 @@ isc_logconfig_t *
 isc_logconfig_get(isc_log_t *lctx) {
        REQUIRE(VALID_CONTEXT(lctx));
 
-       ENSURE(lctx->logconfig != NULL);
+       isc_logconfig_t *lcfg = NULL;
+       LOCK(&lctx->lock);
+       lcfg = lctx->logconfig;
+       UNLOCK(&lctx->lock);
 
-       return (lctx->logconfig);
+       ENSURE(lcfg != NULL);
+       return (lcfg);
 }
 
 isc_result_t
@@ -1458,7 +1462,7 @@ isc_log_open(isc_logchannel_t *channel) {
 }
 
 bool
-isc_log_wouldlog(isc_log_t *lctx, int level) {
+isc_log_wouldlog(isc_log_t *lctx, int level) ISC_NO_SANITIZE {
        /*
         * Try to avoid locking the mutex for messages which can't
         * possibly be logged to any channels -- primarily debugging