Skip to content

Commit 90da629

Browse files
committed
Added further details to the kernel_cap_struct::cap comments
1 parent 9ba3d9b commit 90da629

File tree

1 file changed

+7
-3
lines changed
  • volatility3/framework/symbols/linux/extensions

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,11 +1523,15 @@ def get_capabilities(self) -> int:
15231523
"""
15241524

15251525
if isinstance(self.cap, objects.Array):
1526-
# In 2.6.25.x <= kernels < 6.3 kernel_cap_struct::cap is an array
1527-
# to become a 64bit bitfield
1526+
# In 2.6.25.x <= kernels < 6.3 kernel_cap_struct::cap is a two
1527+
# elements __u32 array that constitutes a 64bit bitfield.
1528+
# Technically, it can also be an array of 1 element if
1529+
# _KERNEL_CAPABILITY_U32S = _LINUX_CAPABILITY_U32S_1
1530+
# However, in the source code, that never happens.
1531+
# From 2.6.24 to 2.6.25 cap became an array of 2 elements.
15281532
cap_value = (self.cap[1] << 32) | self.cap[0]
15291533
else:
1530-
# In kernels < 2.6.25.x kernel_cap_struct::cap was a u32
1534+
# In kernels < 2.6.25.x kernel_cap_struct::cap was a __u32
15311535
# In kernels >= 6.3 kernel_cap_struct::cap is a u64
15321536
cap_value = self.cap
15331537

0 commit comments

Comments
 (0)