You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-16Lines changed: 40 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# pmem
2
2
3
-
`pmem` is a small tool for loading and interacting with the [linpmem driver](). It lets you use the features of the driver in scripts and on the command line. At the same time, this repository also provides a library that can be used by other programs that want to interface with the driver. The command-line application is simply a thin wrapper around this library.
3
+
`pmem` is a small tool for loading and interacting with the [linpmem driver](https://github.com/velocidex/linpmem). It lets you use the features of the driver in scripts and on the command line. At the same time, this repository also provides a library that can be used by other programs that want to interface with the driver. The command-line application is simply a thin wrapper around this library.
4
4
5
5
## Building
6
6
@@ -30,7 +30,7 @@ cargo build --release
30
30
```
31
31
This will generate two static binaries located at `target/x86_64-unknown-linux-musl/release/`:
32
32
-`pmem`: The fully-featured command-line client.
33
-
-`loader`: A smaller program that is containing only the module loader and unloader.
33
+
-`loader`: A smaller program that contains only the functionality needed to load and unload the driver.
34
34
35
35
## Installation
36
36
@@ -40,7 +40,7 @@ cargo install --path . --locked
40
40
```
41
41
This command will install the `pmem` and `loader` binaries into Cargo's bin folder, e.g., `$HOME/.cargo/bin`.
42
42
43
-
Note: This will install the programs for the _current_ user, which is hopefully not the root user. In case you experience any troubles when running them through sudo or in a root shell, remember to add the binaries to root's PATH.
43
+
Note: This will install the programs for the _current_ user, which is hopefully not the root user. In case you experience any troubles when running them through `sudo` or in a root shell, remember to add the binaries to root's PATH.
44
44
45
45
## Uninstall
46
46
@@ -55,11 +55,14 @@ rm -rf path/to/linpmem-cli
55
55
56
56
## Usage
57
57
58
-
`pmem` is a command-line client for the `linpmem` driver. Thus, you first have to [build the driver](). Assuming that you managed to successfully build the driver, load it with the `insmod` subcommand:
58
+
`pmem` is a command-line client for the `linpmem` driver. Thus, you first have to [build the driver](https://github.com/velocidex/linpmem#building). Assuming that you managed to successfully build the driver, load it with the `insmod` subcommand:
59
59
```
60
60
pmem insmod path/to/linpmem.ko
61
61
```
62
-
_Note: We are using a custom module loader, thus the system's `insmod` or `modprobe` binaries will not work._
62
+
or the stand-alone loader
63
+
```
64
+
loader path/to/linpmem.ko
65
+
```
63
66
64
67
Now, you can use `pmem` to interact with the driver:
65
68
```
@@ -76,7 +79,7 @@ Commands:
76
79
77
80
Options:
78
81
-a, --address <ADDRESS>
79
-
Address for physical read/write operations
82
+
Address for physical read operations
80
83
81
84
-v, --virt-address <VIRT_ADDRESS>
82
85
Translate address in target process' address space (default: current process)
@@ -85,29 +88,48 @@ Options:
85
88
Size of buffer read operations
86
89
87
90
-m, --mode <MODE>
88
-
Access mode for read and write operations
91
+
Access mode for read operations
89
92
90
93
[possible values: byte, word, dword, qword, buffer]
91
94
92
-
-w, --write <WRITE>
93
-
Write the hex-encoded byte sequence
94
-
95
95
-p, --pid <PID>
96
96
Target process for cr3 info and virtual-to-physical translations
97
97
98
98
--cr3
99
99
Query cr3 value of target process (default: current process)
100
100
101
+
--verbose
102
+
Display debug output
103
+
101
104
-h, --help
102
105
Print help (see a summary with '-h')
103
106
104
107
-V, --version
105
108
Print version
109
+
106
110
```
107
111
By default, memory contents are written to stdout as raw bytes. Thus, you might want to use `xxd` to make them more human-friendly:
@@ -118,10 +140,12 @@ The normal build process also generates a static C library `libpmem.a` as well a
118
140
119
141
## Troubleshooting
120
142
121
-
At this point, a word of caution may be in order. Reading and writing arbitrary physical memory is considered dangerous. If you do not know what you are doing, DO NOT USE THIS TOOL.
143
+
At this point, a word of caution may be in order. Reading arbitrary physical memory is considered dangerous. If you do not know what you are doing, DO NOT USE THIS TOOL.
122
144
123
-
For all the others, a good point to start may be the driver logs, simply:
145
+
For all the others, a good point to start debugging may be taking a look at the driver logs, simply:
124
146
```
125
-
cat /proc/kmsg | grep linpmem
147
+
sudo journalctl --since today -g linpmem
126
148
```
127
-
They can be made more verbose by building the driver with `DEBUG` defined. If you come to the conclusion that the problem is with the `pmem` tool and not the driver, please open an issue.
149
+
They can be made more verbose by building the driver with `DEBUG` defined. The user-space tools will also display debug output when being run with the `--verbose` flag.
150
+
151
+
If you come to the conclusion that the problem is with the `pmem` tool and not the driver, please open an issue.
0 commit comments