@@ -95,7 +95,8 @@ def vma_dump(
9595 cls ,
9696 context : interfaces .context .ContextInterface ,
9797 task : interfaces .objects .ObjectInterface ,
98- vma : interfaces .objects .ObjectInterface ,
98+ vm_start : int ,
99+ vm_end : int ,
99100 open_method : Type [interfaces .plugins .FileHandlerInterface ],
100101 maxsize : int = MAXSIZE_DEFAULT ,
101102 ) -> Optional [interfaces .plugins .FileHandlerInterface ]:
@@ -105,19 +106,15 @@ def vma_dump(
105106 context: The context to retrieve required elements (layers, symbol tables) from
106107 task: an task_struct instance
107108 vma: The suspected VMA to extract (ObjectInterface)
109+ vm_start: The start virtual address from the vma to dump
110+ vm_end: The end virtual address from the vma to dump
108111 open_method: class to provide context manager for opening the file
109112 maxsize: Max size of VMA section (default MAXSIZE_DEFAULT)
110113
111114 Returns:
112115 An open FileInterface object containing the complete data for the task or None in the case of failure
113116 """
114117 pid = task .pid
115- try :
116- vm_start = vma .vm_start
117- vm_end = vma .vm_end
118- except AttributeError :
119- vollog .debug (f"Unable to find the vm_start and vm_end for pid { pid } " )
120- return None
121118
122119 try :
123120 proc_layer_name = task .add_process_layer ()
@@ -200,13 +197,31 @@ def vma_filter_function(x: interfaces.objects.ObjectInterface) -> bool:
200197
201198 file_output = "Disabled"
202199 if self .config ["dump" ]:
203- file_handle = self .vma_dump (
204- self .context , task , vma , self .open , self .config ["maxsize" ]
205- )
206200 file_output = "Error outputting file"
207- if file_handle :
208- file_handle .close ()
209- file_output = file_handle .preferred_filename
201+ try :
202+ vm_start = vma .vm_start
203+ vm_end = vma .vm_end
204+ except AttributeError :
205+ vollog .debug (
206+ f"Unable to find the vm_start and vm_end for vma at { vma .vol .offset :#x} for pid { pid } "
207+ )
208+ vm_start = None
209+ vm_end = None
210+
211+ if vm_start and vm_end :
212+ # only attempt to dump the memory if we have vm_start and vm_end
213+ file_handle = self .vma_dump (
214+ self .context ,
215+ task ,
216+ vm_start ,
217+ vm_end ,
218+ self .open ,
219+ self .config ["maxsize" ],
220+ )
221+
222+ if file_handle :
223+ file_handle .close ()
224+ file_output = file_handle .preferred_filename
210225
211226 yield (
212227 0 ,
0 commit comments