[pt-br] Update translation bits.
[tails-test.git] / wiki / src / blueprint / more_efficient_memory_wipe / memtest86plus.mdwn
blob93eb844c82553f1ba1f44f58c23791f54b68f54c
1 [[!meta title="Erase memory: the memtest86+ way"]]
3 Rationale
4 =========
6 Memory erasure on shutdown is currently buggy. Sdmem and linux memtest
7 implementation are failing. But a program exist that is actually dedicated at
8 memory testing, and that has thus access to most (if tot all) available memory: 
9 [memtest86+](http://www.memtest.org/). This is a research using a modified
10 memtest86+ to erase memory.
12 Adapting memtest
13 ================
15 We started from memtest86+ version 4.20 available at
16 <http://www.memtest.org/download/4.20/memtest86+-4.20.tar.gz>.
18 Executing a single test
19 -----------------------
21 We patched memtest86+ to execute a single test, and then reboot. We choosed
22 test #1 "Address test, own address" but quicker one could probably be choosen.
24 The corresponding patchset:
26 [0001-Do-only-one-test-and-hopefully-reboot.patch](https://labs.riseup.net/code/attachments/312/0001-Do-only-one-test-and-hopefully-reboot.patch)
28 Nice display
29 ------------
31 We patched memtest86+ to only display "Memory wipe, please wait..." with a
32 progress bar, and then report success.
34 The corresponding patchset:
36 - [0002-Only-write-a-nice-title.patch](https://labs.riseup.net/code/attachments/314/0002-Only-write-a-nice-title.patch)
37 - [0003-Remove-most-colors.patch](https://labs.riseup.net/code/attachments/315/0003-Remove-most-colors.patch)
38 - [0004-Actually-writes-the-progress-bar-and-move-it-up.patch](https://labs.riseup.net/code/attachments/320/0004-Actually-writes-the-progress-bar-and-move-it-up.patch)
39 - [0005-Display-message-at-the-end.patch](https://labs.riseup.net/code/attachments/322/0005-Display-message-at-the-end.patch)
41 A screenshot:
43 <img src="https://labs.riseup.net/code/attachments/323/memwipe.png">
45 Unfortunately, this is useless as when kexec launches memtest from Tails, the
46 video mode in not native and nothing is displayed.
48 Left to do
49 ----------
51 - Actually halt the machine
52 - Choose or write a quicker test
53 - Disable keyboard shortcuts
56 Integreating into Tails
57 =======================
59 We patched tails experimental to kexec on our modified memtest86+ instead of on
60 linux on shutdown. The `memtest` binary built on Tails from upstream with our
61 patches applied is correctly recognised by kexec. Note that we didn't achive to
62 kexec on a memtest built on another OS.
64 The corresponding patchset:
66 - [0001-Test-memory-wipe-with-memtest86.patch](https://labs.riseup.net/code/attachments/313/0001-Test-memory-wipe-with-memtest86.patch)
68 Testing procedure
69 =================
71 We launched the system to test with qemu or virtualbox. We dumped the ram just
72 before shutdown, then after machine halt.
74 With qemu, one should start the system to test with `-no-shutdown`, e.g.:
76     qemu -enable-kvm -snapshot -m 2048 -no-shutdown -cdrom tails-i386-experimental-0.12.1-20120816.iso
78 We launched 4 `fillram` processes in parallel, whatching them with `top` and
79 waiting for them to be killed by oom killer. At least one terminated with
80 `MemoryError`. Fillram fills the RAM with the pattern `wipe_didnt_work\n`.
82 Then we dumped RAM with the following command in qemu console (CTRL+ALT+2). Note
83 that the end address must be adapted to the amount of RAM available in the VM:
85     pmemsave 0 0x80000000 before.dump
87 Then shutdown Tails pressing the red button, and once the machine halted, dump
88 the RAM again:
90     pmemsave 0 0x80000000 after.dump
92 Then we count the occurences of the pattern in the memory dump:
94     grep -c wipe_didnt_work before.dump
95     grep -c wipe_didnt_work after.dump
97 Testing results
98 ===============
100     Machine             RAM         Patterns                %patterns               %wipe
101                                     before wipe after wipe  before wipe after wipe
103     Tails sdmem+kexec   2147483648   1772984624    17168336 82,561%     0,799%      99,032%
105     Tails memwipe+kexec 2147483648   1755221472         240 81,734%     <0,001%     >0,999%
107     Tails sdmem+kexec   8589934592   3243648688  1128607952 37,761%     13,139%     65,206%
109     Tails memwipe+kexec 8589934592   3372274816         240 39,258%     <0,001%     >0,999%
111     Units: bytes
113     Resolution: 16 bytes accuacy
115 Memwipe erase memory better than current Tails implementation.
116 There is a remaining area of 240 bytes that does not get erased.
118 Conclusion
119 ==========
121 For the memory wipe approches we know about, this one is the most efficient we
122 experimented.
124 Pros:
126 - We have something that works better than any other methods we know about.
128 Cons:
130 - There is still a small amount of memory not wiped.
131 - We have to maintain a patchset. However there is only one memtest86+ release
132   by year since 2009.
133 - There is no output on screen, and it may be difficult to fix.