Skip to content

Linux: keep file-backed VMAs whose inode fails validation - #2096

Closed
ricardojrdez wants to merge 1 commit into
volatilityfoundation:developfrom
reverseame:fix/linux-vma-null-inode
Closed

ricardojrdez wants to merge 1 commit into
volatilityfoundation:developfrom
reverseame:fix/linux-vma-null-inode

Conversation

@ricardojrdez

Copy link
Copy Markdown
Contributor

Guard the file-backed VMA page-offset/size check when struct_file.get_inode() returns None.

A valid System V shared-memory segment can have inode number 0: Linux sets the shm file's inode number to its segment identifier, and the first segment in an IPC namespace has identifier 0. The inode smear heuristic rejects that inode, after which vm_area_struct.is_valid() currently dereferences None and aborts every plugin using VMA iteration.

The change keeps a VMA that has passed the existing address-range, page-alignment, and protection checks, and skips only the inode-size/page-offset check when no validated inode is available. The size check is unchanged for validated inodes. Returning False in this case would avoid the exception but would also drop a known-valid shared-memory mapping.

Affected plugins observed in the reproduction image:

  • linux.proc.Maps
  • linux.elfs.Elfs
  • linux.library_list.LibraryList
  • linux.malware.malfind.Malfind

Testing

Added test/test_linux_vma.py, which exercises a structurally valid file-backed VMA whose inode cannot be resolved. It verifies that validation succeeds and that the page-offset calculation is not attempted without an inode.

Commands:

uv run --with pytest --with ruff pytest -q --volatility=vol.py test/test_linux_vma.py
uv run --with pytest --with ruff ruff format --check volatility3/framework/symbols/linux/extensions/__init__.py test/test_linux_vma.py
uv run --with pytest --with ruff ruff check volatility3/framework/symbols/linux/extensions/__init__.py test/test_linux_vma.py
git diff --check

Results:

1 passed
2 files already formatted
All checks passed!

Integration check on a Linux 6.18.59 x86-64 memory image containing an attached SysV segment with shmid=0:

Plugin Before After
linux.proc.Maps exception 1,973 rows (25 for the seed process, including the shm VMA)
linux.elfs.Elfs --pid <pid> exception 5 rows
linux.library_list.LibraryList exception 136 rows
linux.malware.malfind.Malfind exception 0 rows, successful completion

Scope

The shm VMA path still renders as <invalid dentry inode> 0x...; this PR intentionally does not relax inode.is_valid() globally. That is a separate cosmetic issue and changing it would affect the smear heuristic for every inode consumer.

Fixes #2094.

vm_area_struct.is_valid() dereferenced the result of get_inode() without a
None check. get_inode() returns None when inode.is_valid() rejects the
inode, which happens for the first System V shared-memory segment: its
inode number is the shmid, 0. One such mapping aborted linux.proc.Maps,
linux.elfs, linux.library_list and linux.malware.malfind runs. Skip only
the page-offset size check in that case.
@eve-mem

eve-mem commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Is this similar to #2083?

@ricardojrdez

Copy link
Copy Markdown
Contributor Author

Closing in favour of #2083, which fixes the same crash and also restores the SysV segment path. Thanks!

@ricardojrdez
ricardojrdez deleted the fix/linux-vma-null-inode branch November 14, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux: SysV shared-memory segment 0 aborts VMA-based plugins

2 participants