4

Quoting the Linux Programmer's Manual (man 2 mlock):

mlock(), mlock2(), and mlockall() lock part or all of the calling process's virtual address space into RAM, preventing that memory from being paged to the swap area.

How does this work with respect to hibernation? Can a process using mlock() be hibernated at all? What are the semantics after resuming from hibernation?

jotik
  • 17,044
  • 13
  • 58
  • 123
  • 1
    See http://security.stackexchange.com/questions/29019/are-passwords-stored-in-memory-safe: **By nature, hibernation must write the whole RAM to the disk -- this includes pages which were mlocked,** – Barmar Dec 20 '16 at 09:36
  • 1
    @Barmar your comment is wrong, I explained that in the answer [below](http://stackoverflow.com/a/41524790/952234). I think that for most Linux systems mlock doesn't allow hybernation to swap locked pages, but I can't guarantee the percentage though. – Yaroslav Nikitenko Jan 07 '17 at 18:21

1 Answers1

4

It depends on your system. Linux manual for mlock says:

Be aware that the suspend mode on laptops and some desktop computers will save a copy of the system's RAM to disk, regardless of memory locks.

Some tools are really affected by mlock:

1- I hibernate the laptop with Armory opened.
2- I back from hibernate.
3- Armory doesnt syncronize. (To syncronize again I need to restart Armory).

Yaroslav Nikitenko
  • 1,695
  • 2
  • 23
  • 31