Skip to content

Commit 1ff2d80

Browse files
committed
Documentation: Update basics - memory layer information
1 parent a9698e4 commit 1ff2d80

File tree

1 file changed

+59
-16
lines changed

1 file changed

+59
-16
lines changed

doc/source/basics.rst

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Volatility 3 Basics
22
===================
33

4-
Volatility splits memory analysis down to several components:
4+
Volatility splits memory analysis down to several components. The main ones are:
55

66
* Memory layers
77
* Templates and Objects
@@ -13,22 +13,65 @@ which acts as a container for all the various layers and tables necessary to con
1313
Memory layers
1414
-------------
1515

16-
A memory layer is a body of data that can be accessed by requesting data at a specific address. Memory is seen as
17-
sequential when accessed through sequential addresses, however, there is no obligation for the data to be stored
18-
sequentially, and modern processors tend to store the memory in a paged format. Moreover, there is no need for the data
19-
to be stored in an easily accessible format, it could be encoded or encrypted or more, it could be the combination of
20-
two other sources. These are typically handled by programs that process file formats, or the memory manager of the
21-
processor, but these are all translations (either in the geometric or linguistic sense) of the original data.
22-
23-
In Volatility 3 this is represented by a directed graph, whose end nodes are
24-
:py:class:`DataLayers <volatility3.framework.interfaces.layers.DataLayerInterface>` and whose internal nodes are
25-
specifically called a :py:class:`TranslationLayer <volatility3.framework.interfaces.layers.TranslationLayerInterface>`.
26-
In this way, a raw memory image in the LiME file format and a page file can be
27-
combined to form a single Intel virtual memory layer. When requesting addresses from the Intel layer, it will use the
28-
Intel memory mapping algorithm, along with the address of the directory table base or page table map, to translate that
16+
A memory layer is a body of data that can be accessed by requesting data at a specific address. At its lowest level
17+
this data is stored on a phyiscal medium (RAM) and very early computers addresses locations in memory directly. However,
18+
as the size of memory increased and it became more difficult to manage memory most architectures moved to a "paged" model
19+
of memory, where the available memory is cut into specific fixed-sized pages. To help further, programs can ask for any address
20+
and the processor will look up their (virtual) address in a map, to find out where the (physical) address that it lives at is,
21+
in the actual memory of the system.
22+
23+
Volatility can work with these layers as long as it knows the map (so, for example that virtual address `1` looks up at physical
24+
address `9`). The automagic that runs at the start of every volatility session often locates the kernel's memory map, and creates
25+
a kernel virtual layer, which allows for kernel addresses to be looked up and the correct data returned. There can, however, be
26+
several maps, and in general there is a different map for each process (although a portion of the operating system's memory is
27+
usually mapped to the same location across all processes). The maps may take the same address but point to a different part of
28+
physical memory. It also means that two processes could theoretically share memory, but having an virtual address mapped to the
29+
same physical address as another process. See the worked example below for more information.
30+
31+
To translate an address on a layer, call :py:meth:`layer.mapping(offset, length, ignore_errors) <volatility3.framework.interfaces.layers.TranslationLayerInterface.mapping>` and it will return a list of chunks without overlap, in order,
32+
for the requested range. If a portion cannot be mapped, an exception will be thrown unless `ignore_errors` is true. Each
33+
chunk will contain the original offset of the chunk, the translated offset, the original size and the translated size of
34+
the chunk, as well as the lower layer the chunk lives within.
35+
36+
Worked example
37+
^^^^^^^^^^^^^^
38+
39+
The operating system and two programs may all appear to have access to all of physical memory, but actually the maps they each have
40+
mean they each see something different:
41+
42+
.. code-block::
43+
:caption: Memory mapping example
44+
45+
Operating system map Physical Memory
46+
1 -> 9 1 - Free
47+
2 -> 3 2 - OS.4, Process 1.4, Process 2.4
48+
3 -> 7 3 - OS.2
49+
4 -> 2 4 - Free
50+
5 - Free
51+
Process 1 map 6 - Process 1.2, Process 2.3
52+
1 -> 12 7 - OS.3
53+
2 -> 6 8 - Process1.3
54+
3 -> 8 9 - OS.1
55+
4 -> 2 10 - Process2.1
56+
11 - Free
57+
Process 2 map 12 - Process1.1
58+
1 -> 10 13 - Free
59+
2 -> 15 14 - Free
60+
3 -> 6 15 - Process2.2
61+
4 -> 2 16 - Free
62+
63+
In this example, part of the operating system is visible across all processes (although not all processes can write to the memory, there
64+
is a permissions model for intel addressing which is not discussed further here).)
65+
66+
In Volatility 3 mappings are represented by a directed graph of layers, whose end nodes are
67+
:py:class:`DataLayers <volatility3.framework.interfaces.layers.DataLayerInterface>` and whose internal nodes are :py:class:`TranslationLayers <volatility3.framework.interfaces.layers.TranslationLayerInterface>`.
68+
In this way, a raw memory image in the LiME file format and a page file can be combined to form a single Intel virtual
69+
memory layer. When requesting addresses from the Intel layer, it will use the Intel memory mapping algorithm, along
70+
with the address of the directory table base or page table map, to translate that
2971
address into a physical address, which will then either be directed towards the swap layer or the LiME layer. Should it
30-
be directed towards the LiME layer, the LiME file format algorithm will be translated to determine where within the file
31-
the data is stored and that will be returned.
72+
be directed towards the LiME layer, the LiME file format algorithm will be translate the new address to determine where
73+
within the file the data is stored. When the :py:meth:`layer.read() <volatility3.framework.interfaces.layers.TranslationLayerInterface.read>`
74+
method is called, the translation is done automatically and the correct data gathered and combined.
3275

3376
.. note:: Volatility 2 had a similar concept, called address spaces, but these could only stack linearly one on top of another.
3477

0 commit comments

Comments
 (0)