Search code examples
linuxmemorykernelramdd

Wiping RAM before shutdown, How does Linux allocate memory?


I know that many people think that wiping the RAM at shutdown is fairly pointless, I've done a fair bit of research on the benefits and drawbacks (and if it is really worth it). So in the nicest politest possible way... please no comments such as "Why do you want to wipe the Ram, its pointless"

I tried to DD /dev/mem and as expected DD threw up an error and the kernel warned that DD tried to access memory between 101000 and 101200. So my question is... How is memory allocated in Linux and more precisely, would any personal information exist between addresses 101000 and 101200 or is it totally reserved/protected for the kernel?

Thanks in advance

Tom


Solution

  • Since you provided no details I am assuming you are using quite recent kernel version running on x86.

    Linux documentation provides physical memory layout after boot. You can see there that kernel is loaded at address 0x100000. That means in the region you are asking about (0x101000 - 0x101200) there is only kernel code.

    Physical memory is allocated in pages using binary buddy allocator. It is described in much more details here.

    However, wiping physical memory using anything except kernel code is impossible and may be dangerous (corruption of data on disks). If you really want to wipe RAM at shutdown I would suggest hacking the kernel.