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
 
... ...
@@ -264,9 +264,14 @@ void *onas_fan_th(void *arg)
264 264
 
265 265
 		if((check = onas_fan_checkowner(fmd->pid, tharg->opts))) {
266 266
 		    scan = 0;
267
-		    if (check != CHK_SELF || !(optget(tharg->opts, "OnAccessExtraScanning")->enabled)) {
268
-			logg("*ScanOnAccess: %s skipped (excluded UID)\n", fname);
269
-                    }
267
+	/* TODO: Re-enable OnAccessExtraScanning once the thread resource consumption issue is resolved. */
268
+	#if 0
269
+			if ((check != CHK_SELF) || !(optget(tharg->opts, "OnAccessExtraScanning")->enabled)) {
270
+	#else
271
+			if (check != CHK_SELF) {
272
+	#endif
273
+				logg("*ScanOnAccess: %s skipped (excluded UID)\n", fname);
274
+			}
270 275
 		}
271 276
 
272 277
 		if(sizelimit) {
... ...
@@ -687,6 +687,8 @@ Example
687 687
 # Toggles extra scanning and notifications when a file or directory is
688 688
 # created or moved.
689 689
 # Requires the  DDD system to kick-off extra scans.
690
+# NOTE:  This feature is disabled until a thread resource leak bug
691
+#        in the OnAccessExtraScanning code can be resolved.
690 692
 # (On-access scan only)
691 693
 # Default: no
692 694
 #OnAccessExtraScanning yes