tree: 3097bb8ffd9e5dfd03736ce2d76153a9a147b599 [path history] [tgz]
  1. fake_process_manager.h
  2. main.cc
  3. process.cc
  4. process.h
  5. process_killer.cc
  6. process_killer.h
  7. process_killer_test.cc
  8. process_manager.cc
  9. process_manager.h
  10. process_manager_test.cc
  11. process_test.cc
  12. README.md
init/process_killer/README.md

Process Killer

process_killer is a utility to search for and kill processes that might hold up the tearing down and safe unmounting of stateful storage mounts/devices. On ChromeOS, the mounts/devices of interest include any encrypted storage mount/device (eg. cryptohome mounts, encrypted stateful partition's dm-crypt device) as well as the stateful filesystem.

process_killer looks for the following types of processes:

  • Processes that have files open on matching paths of interest (controlled by the CLI option --file_holders).
  • Processes that have mounts open from devices of interest in a cloned mount namespace (controlled by the CLI option --mount_holders). Such processes don't prevent clean unmounts in the init mount namespace but will still hold a reference to the mount (and by extension, the filesystem superblock/underlying block device) during end of session and shutdown.

process_killer is currently used in the following situations:

  • Session End (ui-post-stop): At end of the session, process_killer is used to first find processes that have files open into the user cryptohome. This allows cryptohome a shot into safely unmounting all encrypted user mounts. As a failsafe, cryptohome falls back to doing a lazy unmount. Finally, process_killer is called as a last resort for processes still holding user cryptohome mounts in a cloned MS_PRIVATE mount namespace.
  • System Shutdown (chromeos_shutdown): At shutdown, process_killer is used as a last resort to kill any service still accessing stateful mounts. Barring misconfigured init scripts, few processes are running at shutdown so process_killer does a final sweep of all file and mount holders before starting the teardown process for the stateful mounts.