Skip to content

Commit 3b3331a

Browse files
committed
Add smear checks and missing absolute flag to walk_internal_list
1 parent 1f983ac commit 3b3331a

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

volatility3/framework/symbols/linux/__init__.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,13 +430,36 @@ def lookup_module_address(
430430

431431
@classmethod
432432
def walk_internal_list(cls, vmlinux, struct_name, list_member, list_start):
433+
count = 0
434+
seen = set()
435+
433436
while list_start:
437+
if list_start.vol.offset in seen:
438+
vollog.debug(
439+
"walk_internal_list: Repeat entry found. Stopping enumeration"
440+
)
441+
break
442+
seen.add(list_start.vol.offset)
443+
444+
if not (list_start and list_start.is_readable()):
445+
break
446+
434447
list_struct = vmlinux.object(
435-
object_type=struct_name, offset=list_start.vol.offset
448+
object_type=struct_name, offset=list_start.vol.offset, absolute=True
436449
)
450+
437451
yield list_struct
452+
438453
list_start = getattr(list_struct, list_member)
439454

455+
if count == 4096:
456+
vollog.debug(
457+
f"walk_internal_list: Breaking list enumeration at {count}"
458+
)
459+
break
460+
461+
count += 1
462+
440463
@classmethod
441464
def container_of(
442465
cls,

0 commit comments

Comments
 (0)