Skip to content

Commit 18a9f89

Browse files
committed
update logic for checking if a vma should be saved to disk in linux.proc plugin
1 parent 560569e commit 18a9f89

File tree

1 file changed

+10
-2
lines changed
  • volatility3/framework/plugins/linux

1 file changed

+10
-2
lines changed

volatility3/framework/plugins/linux/proc.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def vma_dump(
105105
Args:
106106
context: The context to retrieve required elements (layers, symbol tables) from
107107
task: an task_struct instance
108-
vma: The suspected VMA to extract (ObjectInterface)
109108
vm_start: The start virtual address from the vma to dump
110109
vm_end: The end virtual address from the vma to dump
111110
open_method: class to provide context manager for opening the file
@@ -127,7 +126,16 @@ def vma_dump(
127126
return None
128127

129128
vm_size = vm_end - vm_start
130-
if 0 < maxsize < vm_size:
129+
130+
# check if vm_size is negative, this should never happen.
131+
if vm_size < 0:
132+
vollog.warning(
133+
f"Skip virtual memory dump for pid {pid} between {vm_start:#x}-{vm_end:#x} as {vm_size} is negative."
134+
)
135+
return None
136+
137+
# check if vm_size is larger than the maxsize limit, and therefore is not saved out.
138+
if maxsize <= vm_size:
131139
vollog.warning(
132140
f"Skip virtual memory dump for pid {pid} between {vm_start:#x}-{vm_end:#x} as {vm_size} is larger than maxsize limit of {maxsize}"
133141
)

0 commit comments

Comments
 (0)