Skip to content

Add support for newer LLVM parsing for Linux - Replace "long unsigned int" with"unsigned long" #1041

@Monrava

Description

@Monrava

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Scenario: Memory acquisition and analysis of Google Kubernetes (GKE) nodes as well as any Linux based kernel image that was compiled with newer version of clang+LLVM, see commit: llvm/llvm-project@f6a561c.
And this failure occurs for when the Linux kernel (both 5.10 and 5.15) is compiled.

The problem occurs when memory acquisition is done on GKE nodes using AVML and then dwarf2json to build a symbols file using vmlinux of the current build_id of the GKE node and active COS version.
vmlinux is acquired via: curl -O https://storage.googleapis.com/cos-tools/build_id/vmlinux .e.g curl -O https://storage.googleapis.com/cos-tools/17412.101.24/vmlinux

The current version of Volatility3 uses "long unsigned int" at the following places:

init_task.files.cast("long unsigned int")

https://github.com/volatilityfoundation/volatility3/blob/d56297c4b1cf0f9f4912f4f4158e232c700acb3f/volatility3/framework/plugins/linux/kmsg.py#L71C32-L71C32

Which causes Volatility3 to fail when the command:
python3 volatility3/vol.py -s PATH_TO/dwarf2json_profile.json -f PATH_TO/memory_dump.lime linux.ANY_PLUGIN is run
Banners and isInfo still works but any other Linux plugin that uses the linux framework and related automagic fails and claims that the symbols file or memory dump file is missing.

Describe the solution you'd like
At the following lines:

init_task.files.cast("long unsigned int")

https://github.com/volatilityfoundation/volatility3/blob/d56297c4b1cf0f9f4912f4f4158e232c700acb3f/volatility3/framework/plugins/linux/kmsg.py#L71C32-L71C32

Replace: "long unsigned int"
With: "unsigned long"

When testing this locally Volatility3 runs perfectly fine but for the solution above more testing would have to be done to fix this.

Describe alternatives you've considered
This solution was originally discovered by the Google GKE team and I have no knowledge of other solutions to fix this.

Additional information
Add any other information or screenshots about the feature request here.
This issue was first raised here in the Volatility community Slack channel:
https://volatilitycommunity.slack.com/archives/CP9LZ5KD5/p1700060787864299

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions