Hello!

Currently, ole2 scanning currently very slow on complex documents, even
when mfs is used for temp disk. Below are time's of scanning ole-based
metadata file (from 1C financial software, catched in wild due to
scanning timeouts; available on request) and simple profiling results for
ole2 extracting. All done under FreeBSD 4.9, 2.66GHz P4.

As far as I see, the problem is enourmous number of read() syscalls.
Probably we should consider using mmap'ed file access, or implement some
internal buffering. Is it planned?

<cut>
$ ls -la 1Cv7.MD
-rw-rw-rw-  1 root  wheel  5163520 May  7 15:49 1Cv7.MD
$ time clamscan 1Cv7.MD
1Cv7.MD: OK

----------- SCAN SUMMARY -----------
Known viruses: 21517
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 7.67 MB
I/O buffer size: 131072 bytes
Time: 64.901 sec (1 m 4 s)

real    1m4.936s
user    0m22.463s
sys     0m42.324s
<cut>

Scanning already unpacked tree:

<cut>
$ time clamscan -r /spool1/clamav/clamav-6c86f144e0ad42b8/
[...]
----------- SCAN SUMMARY -----------
Known viruses: 21517
Scanned directories: 961
Scanned files: 2455
Infected files: 0
Data scanned: 2.75 MB
I/O buffer size: 131072 bytes
Time: 2.647 sec (0 m 2 s)

real    0m2.651s
user    0m1.525s
sys     0m0.989s
<cut>

Profiling of ole2 extracting code:
<cut>
granularity: each sample hit covers 4 byte(s) for 0.03% of 2.96 seconds

  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 36.6       1.08     1.08 24389514     0.00     0.00  ole2_read_block [15]
 19.9       1.67     0.59 24342355     0.00     0.00
ole2_get_next_bat_block [14]
 16.1       2.15     0.48 24389515     0.00     0.00  cli_readn [16]
 12.3       2.51     0.36 24342355     0.00     0.00
ole2_get_next_block_number [12]
  7.8       2.75     0.23    18569     0.01     0.13
ole2_get_sbat_data_block [13]
  3.0       2.83     0.09     8058     0.01     0.01  cli_dequeue [20]
  0.9       2.86     0.03  2291238     0.00     0.00  cli_hex2int [25]
  0.7       2.88     0.02        1    19.53  2791.01
ole2_walk_property_tree [10]
  0.6       2.90     0.02    21815     0.00     0.00  cl_hex2str [24]
  0.5       2.91     0.01    18569     0.00     0.01
ole2_get_next_sbat_block [17]
  0.3       2.92     0.01        4     2.44    18.77  cl_loaddb <cycle 1>
[22]
  0.3       2.93     0.01    21815     0.00     0.00  cli_addpatt [26]
  0.3       2.94     0.01    21815     0.00     0.00  cli_parse_add [23]
  0.2       2.95     0.01      270     0.02     0.02  __md5_process_block
[28]
  0.1       2.95     0.00     5871     0.00     0.00  get_property_name
[33]
  0.1       2.95     0.00    21517     0.00     0.00  cli_chomp [35]
  0.1       2.96     0.00     2455     0.00     1.07  handler_writefile
[11]
  0.1       2.96     0.00     3416     0.00     0.00  print_ole2_property
[27]
  0.0       2.96     0.00    81577     0.00     0.00  cli_calloc [36]
<cut>

Maxim Dounin


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Clamav-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-devel

Reply via email to