functools caching and doc.

This commit is contained in:
Abyss Watcher
2025-01-18 13:45:30 +01:00
parent bb6556dbc0
commit 0b82f73137
@@ -1,3 +1,5 @@
import functools
from volatility3 import framework
from volatility3.framework import interfaces
from volatility3.framework.constants import linux as linux_constants
@@ -18,11 +20,18 @@ class Tainting(interfaces.configuration.VersionableInterface):
framework.require_interface_version(*_required_framework_version)
@classmethod
@functools.lru_cache
def _get_kernel_taint_flags_list(
cls,
context: interfaces.context.ContextInterface,
kernel_module_name: str,
) -> Optional[List[interfaces.objects.ObjectInterface]]:
"""Determine whether the kernel embeds taint flags definition
in-memory or not.
Returns:
A list of "taint_flag" kernel objects if taint_flags symbok exists
"""
kernel = context.modules[kernel_module_name]
if kernel.has_symbol("taint_flags"):
return list(kernel.object_from_symbol("taint_flags"))