mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-12 12:47:39 +02:00
Make the paged exceptions more useful at knowing how big an area is unavailable.
This commit is contained in:
@@ -22,6 +22,17 @@ class InvalidAddressException(VolatilityException):
|
||||
self.layer_name = layer_name
|
||||
|
||||
|
||||
class PagedInvalidAddressException(InvalidAddressException):
|
||||
"""Thrown when an address is not valid in the paged space in which it was request
|
||||
|
||||
Includes the invalid address and the number of bits of the address that are invalid
|
||||
"""
|
||||
|
||||
def __init__(self, layer_name, invalid_address, invalid_bits, *args, **kwargs):
|
||||
super().__init__(layer_name, invalid_address, *args, **kwargs)
|
||||
self.invalid_bits = invalid_bits
|
||||
|
||||
|
||||
class SymbolSpaceError(VolatilityException):
|
||||
"""Thrown when an error occurs dealing with Symbols and Symbolspaces"""
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ class Intel(interfaces.layers.TranslationLayerInterface):
|
||||
for (name, size, large_page) in self._structure:
|
||||
# Check we're valid
|
||||
if not self._page_is_valid(entry):
|
||||
raise exceptions.InvalidAddressException(self.name, offset,
|
||||
"Page Fault at entry " + hex(entry) + " in table " + name)
|
||||
raise exceptions.PagedInvalidAddressException(self.name, offset, position + 1,
|
||||
"Page Fault at entry " + hex(entry) + " in table " + name)
|
||||
# Check if we're a large page
|
||||
if large_page and (entry & (1 << 7)):
|
||||
# We're a large page, the rest is finished below
|
||||
@@ -94,8 +94,8 @@ class Intel(interfaces.layers.TranslationLayerInterface):
|
||||
|
||||
# Now we're done
|
||||
if not self._page_is_valid(entry):
|
||||
raise exceptions.InvalidAddressException(self.name, offset,
|
||||
"Page Fault at entry " + hex(entry) + " in page entry")
|
||||
raise exceptions.PagedInvalidAddressException(self.name, offset, position + 1,
|
||||
"Page Fault at entry {} in page entry".format(hex(entry)))
|
||||
page = self._mask(entry, self._maxphyaddr - 1, position + 1) | self._mask(offset, position, 0)
|
||||
return page, 1 << (position + 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user