Skip to content

Commit c524d8a

Browse files
authored
Merge pull request #1242 from volatilityfoundation/issues/fix-up-extension-verisioning
Remove get_vmlinux calls
2 parents 966d23e + e97abae commit c524d8a

File tree

2 files changed

+6
-45
lines changed

2 files changed

+6
-45
lines changed

volatility3/framework/constants/_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# We use the SemVer 2.0.0 versioning scheme
22
VERSION_MAJOR = 2 # Number of releases of the library with a breaking change
3-
VERSION_MINOR = 8 # Number of changes that only add to the interface
4-
VERSION_PATCH = 1 # Number of changes that do not change the interface
3+
VERSION_MINOR = 9 # Number of changes that only add to the interface
4+
VERSION_PATCH = 0 # Number of changes that do not change the interface
55
VERSION_SUFFIX = ""
66

77
PACKAGE_VERSION = (

volatility3/framework/symbols/linux/extensions/__init__.py

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,19 +1609,6 @@ def get_state(self):
16091609

16101610

16111611
class bpf_prog(objects.StructType):
1612-
def _get_vmlinux(self):
1613-
linuxutils_required_version = (2, 1, 1)
1614-
linuxutils_current_version = linux.LinuxUtilities._version
1615-
if not requirements.VersionRequirement.matches_required(
1616-
linuxutils_required_version, linuxutils_current_version
1617-
):
1618-
raise exceptions.PluginRequirementException(
1619-
f"linux.LinuxUtilities version not suitable: required {linuxutils_required_version} found {linuxutils_current_version}"
1620-
)
1621-
1622-
vmlinux = linux.LinuxUtilities.get_module_from_volobj_type(self._context, self)
1623-
return vmlinux
1624-
16251612
def get_type(self) -> Union[str, None]:
16261613
"""Returns a string with the eBPF program type"""
16271614

@@ -1645,7 +1632,7 @@ def get_tag(self) -> Union[str, None]:
16451632
if not self.has_member("tag"):
16461633
return None
16471634

1648-
vmlinux = self._get_vmlinux()
1635+
vmlinux = linux.LinuxUtilities.get_module_from_volobj_type(self._context, self)
16491636
vmlinux_layer = vmlinux.context.layers[vmlinux.layer_name]
16501637

16511638
prog_tag_addr = self.tag.vol.offset
@@ -2057,26 +2044,13 @@ def get_flags_list(self) -> List[str]:
20572044

20582045
return flags
20592046

2060-
def _get_vmlinux(self):
2061-
linuxutils_required_version = (2, 1, 1)
2062-
linuxutils_current_version = linux.LinuxUtilities._version
2063-
if not requirements.VersionRequirement.matches_required(
2064-
linuxutils_required_version, linuxutils_current_version
2065-
):
2066-
raise exceptions.PluginRequirementException(
2067-
f"linux.LinuxUtilities version not suitable: required {linuxutils_required_version} found {linuxutils_current_version}"
2068-
)
2069-
2070-
vmlinux = linux.LinuxUtilities.get_module_from_volobj_type(self._context, self)
2071-
return vmlinux
2072-
20732047
def to_paddr(self) -> int:
20742048
"""Converts a page's virtual address to its physical address using the current physical memory model.
20752049
20762050
Returns:
20772051
int: page physical address
20782052
"""
2079-
vmlinux = self._get_vmlinux()
2053+
vmlinux = linux.LinuxUtilities.get_module_from_volobj_type(self._context, self)
20802054
vmlinux_layer = vmlinux.context.layers[vmlinux.layer_name]
20812055

20822056
vmemmap_start = None
@@ -2127,7 +2101,7 @@ def get_content(self) -> Union[str, None]:
21272101
Returns:
21282102
The page content
21292103
"""
2130-
vmlinux = self._get_vmlinux()
2104+
vmlinux = linux.LinuxUtilities.get_module_from_volobj_type(self._context, self)
21312105
vmlinux_layer = vmlinux.context.layers[vmlinux.layer_name]
21322106
physical_layer = vmlinux.context.layers["memory_layer"]
21332107
page_paddr = self.to_paddr()
@@ -2145,19 +2119,6 @@ class IDR(objects.StructType):
21452119
MAX_IDR_SHIFT = INT_SIZE * 8 - 1
21462120
MAX_IDR_BIT = 1 << MAX_IDR_SHIFT
21472121

2148-
def _get_vmlinux(self):
2149-
linuxutils_required_version = (2, 1, 1)
2150-
linuxutils_current_version = linux.LinuxUtilities._version
2151-
if not requirements.VersionRequirement.matches_required(
2152-
linuxutils_required_version, linuxutils_current_version
2153-
):
2154-
raise exceptions.PluginRequirementException(
2155-
f"linux.LinuxUtilities version not suitable: required {linuxutils_required_version} found {linuxutils_current_version}"
2156-
)
2157-
2158-
vmlinux = linux.LinuxUtilities.get_module_from_volobj_type(self._context, self)
2159-
return vmlinux
2160-
21612122
def idr_max(self, num_layers: int) -> int:
21622123
"""Returns the maximum ID which can be allocated given idr::layers
21632124
@@ -2181,7 +2142,7 @@ def idr_find(self, idr_id: int) -> int:
21812142
Returns:
21822143
A pointer to the given ID element
21832144
"""
2184-
vmlinux = self._get_vmlinux()
2145+
vmlinux = linux.LinuxUtilities.get_module_from_volobj_type(self._context, self)
21852146
if not vmlinux.get_type("idr_layer").has_member("layer"):
21862147
vollog.info(
21872148
"Unsupported IDR implementation, it should be a very very old kernel, probabably < 2.6"

0 commit comments

Comments
 (0)