Ticket #150 (new defect)

Opened 10 months ago

Last modified 7 months ago

Cached modules should also store common fields

Reported by: hdm Assigned to: hdm
Priority: major Milestone: Metasploit 3.2
Component: framework3 Version:
Keywords: Cc:

Description

Script started on Mon Sep 24 10:02:48 2007 laptop 0 0 /tmp/b # echo 'echo exit | ruby' > a laptop 0 0 /tmp/b # /usr/bin/time -hl ./a

0.02s real 0.00s user 0.01s sys

1888 maximum resident set size

56 average shared memory size

316 average unshared data size 192 average unshared stack size 355 page reclaims

0 page faults 0 swaps 0 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 5 voluntary context switches 3 involuntary context switches

# Plain Ruby takes 0.01 kernel time, even less user-time. It takes at most # 1.8MB RAM.

laptop 0 0 /tmp/b # echo 'echo exit | msfcli' > a laptop 0 0 /tmp/b # chmod 755 a laptop 0 0 /tmp/b # /usr/bin/time -hl ./a Usage: /usr/local/bin/msfcli <exploit_name> <option=value> [mode] snipped output...

9.74s real 8.10s user 0.99s sys

36716 maximum resident set size

4 average shared memory size

22131 average unshared data size

127 average unshared stack size

8609 page reclaims

1 page faults 0 swaps

207 block input operations

0 block output operations 0 messages sent 0 messages received 0 signals received

214 voluntary context switches

1624 involuntary context switches

# msfcli takes 1sec kernel-time and 8sec user-time, and 37MB RAM. # To cancel the file-system access (207 bio), let's run again:

laptop 0 0 /tmp/b # /usr/bin/time -hl ./a Usage: /usr/local/bin/msfcli <exploit_name> <option=value> [mode] ================================================================= snipped again...

9.58s real 8.21s user 0.83s sys

36716 maximum resident set size

4 average shared memory size

22097 average unshared data size

127 average unshared stack size

8608 page reclaims

0 page faults 0 swaps 0 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 5 voluntary context switches

1660 involuntary context switches

# With almost no disk access (VFS cached the files for us), the # times are not very different. 36MB of RAM is the peak consumption.

laptop 0 0 /tmp/b # exit Script done on Mon Sep 24 10:08:54 2007

Change History

12/27/07 11:34:13 changed by hdm

  • milestone set to Metasploit 3.1 Release.

01/06/08 16:13:08 changed by hdm

Until we change the caching system to handle general accessor methods (authors, targets, desc, etc), were still going to be spend a lot of time instantiating classes we never use. I did manage to nail down the memory usage at least (7mb in Rex, 16Mb in all of MSF Core/Base).

01/06/08 16:14:10 changed by hdm

  • summary changed from Performance: Reduce memory footprint and speed up loads to Cached modules should also store common fields.

We should only actually instantiate a module when we run check() or exploit(), otherwise the cache should be used.

01/06/08 16:14:18 changed by hdm

  • milestone changed from Metasploit 3.1 Release to Metasploit 3.2 Release.