Browse code

Disabled OnAccessExtraScanning and provided a warning when starting clamd if it's enabled as well as a note in the sample clamd.conf.

Micah Snyder (micasnyd) authored on 2018/09/19 09:40:25
Showing 4 changed files
... ...
@@ -370,6 +370,15 @@ int main(int argc, char **argv)
370 370
             break;
371 371
         }
372 372
 
373
+        /* TODO: Re-enable OnAccessExtraScanning once the thread resource consumption issue is resolved. */
374
+        if(optget(opts, "OnAccessExtraScanning")->enabled) {
375
+            logg("^ScanOnAccess: OnAccessExtraScanning was requested, but has "
376
+                 "been disabled due to a known issue with thread resource "
377
+                 "cleanup. The OnAccessExtraScanning feature will be "
378
+                 "re-enabled in a future release when the issue is resolved. "
379
+                 "For details, see: https://bugzilla.clamav.net/show_bug.cgi?id=12048\n");
380
+        }
381
+
373 382
         if(!(engine = cl_engine_new())) {
374 383
             logg("!Can't initialize antivirus engine\n");
375 384
             ret = 1;
... ...
@@ -385,9 +385,12 @@ void *onas_ddd_th(void *arg) {
385 385
 		}
386 386
 	}
387 387
 
388
+	/* TODO: Re-enable OnAccessExtraScanning once the thread resource consumption issue is resolved. */
389
+#if 0
388 390
 	if(optget(tharg->opts, "OnAccessExtraScanning")->enabled) {
389 391
 		logg("ScanOnAccess: Extra scanning and notifications enabled.\n");
390
-	}
392
+}
393
+	#endif
391 394
 
392 395
 
393 396
 	FD_ZERO(&rfds);
... ...
@@ -476,6 +479,9 @@ static void onas_ddd_handle_in_create(struct ddd_thrarg *tharg,
476 476
 		const char *path, const char *child_path, const struct inotify_event *event, int wd, uint64_t in_mask) {
477 477
 
478 478
 	struct stat s;
479
+
480
+	/* TODO: Re-enable OnAccessExtraScanning once the thread resource consumption issue is resolved. */
481
+#if 0
479 482
 	if (optget(tharg->opts, "OnAccessExtraScanning")->enabled) {
480 483
 		if(stat(child_path, &s) == 0 && S_ISREG(s.st_mode)) {
481 484
 			onas_ddd_handle_extra_scanning(tharg, child_path, ONAS_SCTH_ISFILE);
... ...
@@ -487,8 +493,10 @@ static void onas_ddd_handle_in_create(struct ddd_thrarg *tharg,
487 487
 
488 488
 			onas_ddd_handle_extra_scanning(tharg, child_path, ONAS_SCTH_ISDIR);
489 489
 		}
490
-	} else {
491
-
490
+	}
491
+	else
492
+#endif
493
+	{
492 494
 		if(stat(child_path, &s) == 0 && S_ISREG(s.st_mode)) return;
493 495
 		if(!(event->mask & IN_ISDIR)) return;
494 496
 
... ...
@@ -504,6 +512,8 @@ static void onas_ddd_handle_in_moved_to(struct ddd_thrarg *tharg,
504 504
 		const char *path, const char *child_path, const struct inotify_event *event, int wd, uint64_t in_mask) {
505 505
 
506 506
 	struct stat s;
507
+	/* TODO: Re-enable OnAccessExtraScanning once the thread resource consumption issue is resolved. */
508
+#if 0
507 509
 	if (optget(tharg->opts, "OnAccessExtraScanning")->enabled) {
508 510
 		if(stat(child_path, &s) == 0 && S_ISREG(s.st_mode)) {
509 511
 			onas_ddd_handle_extra_scanning(tharg, child_path, ONAS_SCTH_ISFILE);
... ...
@@ -515,7 +525,10 @@ static void onas_ddd_handle_in_moved_to(struct ddd_thrarg *tharg,
515 515
 
516 516
 			onas_ddd_handle_extra_scanning(tharg, child_path, ONAS_SCTH_ISDIR);
517 517
 		}
518
-	} else {
518
+	}
519
+	else
520
+#endif
521
+	{
519 522
 		if(stat(child_path, &s) == 0 && S_ISREG(s.st_mode)) return;
520 523
 		if(!(event->mask & IN_ISDIR)) return;
521 524
 
... ...
@@ -252,9 +252,14 @@ void *onas_fan_th(void *arg)
252 252
 
253 253
 		if((check = onas_fan_checkowner(fmd->pid, tharg->opts))) {
254 254
 		    scan = 0;
255
-		    if (check != CHK_SELF || !(optget(tharg->opts, "OnAccessExtraScanning")->enabled)) {
256
-			logg("*ScanOnAccess: %s skipped (excluded UID)\n", fname);
257
-                    }
255
+	/* TODO: Re-enable OnAccessExtraScanning once the thread resource consumption issue is resolved. */
256
+	#if 0
257
+			if ((check != CHK_SELF) || !(optget(tharg->opts, "OnAccessExtraScanning")->enabled)) {
258
+	#else
259
+			if (check != CHK_SELF) {
260
+	#endif
261
+				logg("*ScanOnAccess: %s skipped (excluded UID)\n", fname);
262
+			}
258 263
 		}
259 264
 
260 265
 		if(sizelimit) {
... ...
@@ -672,6 +672,8 @@ Example
672 672
 # Toggles extra scanning and notifications when a file or directory is
673 673
 # created or moved.
674 674
 # Requires the  DDD system to kick-off extra scans.
675
+# NOTE:  This feature is disabled until a thread resource leak bug
676
+#        in the OnAccessExtraScanning code can be resolved.
675 677
 # (On-access scan only)
676 678
 # Default: no
677 679
 #OnAccessExtraScanning yes