tree: 1fe6a47045f36bede53cae8dc591289e5b806c3c [path history] [tgz]
  1. dbus_bindings/
  2. docs/
  3. init/
  4. .project_alias
  5. android_container_manager_impl.cc
  6. android_container_manager_impl.h
  7. android_oci_wrapper.cc
  8. android_oci_wrapper.h
  9. android_oci_wrapper_unittest.cc
  10. blob_util.cc
  11. blob_util.h
  12. browser_job.cc
  13. browser_job.h
  14. browser_job_unittest.cc
  15. child_exit_handler.cc
  16. child_exit_handler.h
  17. child_exit_handler_unittest.cc
  18. child_job.cc
  19. child_job.h
  20. chrome_dev.conf
  21. chrome_setup.cc
  22. chrome_setup.h
  23. chrome_setup_unittest.cc
  24. COMMIT-QUEUE.ini
  25. container_config_parser.cc
  26. container_config_parser.h
  27. container_config_parser_unittest.cc
  28. container_manager_impl.cc
  29. container_manager_impl.h
  30. container_manager_interface.cc
  31. container_manager_interface.h
  32. crossystem.cc
  33. crossystem.h
  34. crossystem_impl.cc
  35. crossystem_impl.h
  36. cumulative_use_time_metric.cc
  37. cumulative_use_time_metric.h
  38. cumulative_use_time_metric_unittest.cc
  39. dbus_util.cc
  40. dbus_util.h
  41. default_proxy
  42. device_local_account_policy_service.cc
  43. device_local_account_policy_service.h
  44. device_local_account_policy_service_unittest.cc
  45. device_policy_service.cc
  46. device_policy_service.h
  47. device_policy_service_unittest.cc
  48. fake_browser_job.cc
  49. fake_browser_job.h
  50. fake_child_process.cc
  51. fake_child_process.h
  52. fake_container_manager.cc
  53. fake_container_manager.h
  54. fake_crossystem.cc
  55. fake_crossystem.h
  56. fake_generated_key_handler.cc
  57. fake_generated_key_handler.h
  58. fake_generator_job.cc
  59. fake_generator_job.h
  60. fake_termina_manager.cc
  61. fake_termina_manager.h
  62. file_checker.cc
  63. file_checker.h
  64. generator_job.cc
  65. generator_job.h
  66. init_daemon_controller.h
  67. job_manager.h
  68. key_generator.cc
  69. key_generator.h
  70. key_generator_unittest.cc
  71. keygen.cc
  72. keygen_worker.cc
  73. keygen_worker.h
  74. libsession_manager-client-test.pc.in
  75. libsession_manager-client.pc.in
  76. liveness_checker.h
  77. liveness_checker_impl.cc
  78. liveness_checker_impl.h
  79. liveness_checker_impl_unittest.cc
  80. login_manager.gyp
  81. login_metrics.cc
  82. login_metrics.h
  83. login_metrics_unittest.cc
  84. lsan_suppressions
  85. matchers.h
  86. mock_constructors.cc
  87. mock_device_policy_service.h
  88. mock_file_checker.h
  89. mock_init_daemon_controller.h
  90. mock_install_attributes_reader.h
  91. mock_key_generator.h
  92. mock_liveness_checker.h
  93. mock_metrics.h
  94. mock_mitigator.h
  95. mock_nss_util.cc
  96. mock_nss_util.h
  97. mock_object_proxy.h
  98. mock_policy_key.h
  99. mock_policy_service.h
  100. mock_policy_store.h
  101. mock_process_manager_service.h
  102. mock_server.key
  103. mock_server.pem
  104. mock_server_backed_state_key_generator.h
  105. mock_session_manager.h
  106. mock_system_utils.h
  107. mock_user_policy_service_factory.h
  108. mock_vpd_process.h
  109. named_platform_handle_utils.h
  110. named_platform_handle_utils_posix.cc
  111. nss_util.cc
  112. nss_util.h
  113. nss_util_unittest.cc
  114. owner_key_loss_mitigator.cc
  115. owner_key_loss_mitigator.h
  116. OWNERS
  117. policy_key.cc
  118. policy_key.h
  119. policy_key_unittest.cc
  120. policy_service.cc
  121. policy_service.h
  122. policy_service_unittest.cc
  123. policy_store.cc
  124. policy_store.h
  125. policy_store_unittest.cc
  126. PRESUBMIT.cfg
  127. process_manager_service_interface.h
  128. README.md
  129. regen_mitigator.cc
  130. regen_mitigator.h
  131. regen_mitigator_unittest.cc
  132. server_backed_state_key_generator.cc
  133. server_backed_state_key_generator.h
  134. server_backed_state_key_generator_unittest.cc
  135. session_manager-client.gyp
  136. session_manager_impl.cc
  137. session_manager_impl.h
  138. session_manager_impl_unittest.cc
  139. session_manager_interface.h
  140. session_manager_main.cc
  141. session_manager_process_unittest.cc
  142. session_manager_service.cc
  143. session_manager_service.h
  144. session_manager_setup.sh
  145. session_manager_testrunner.cc
  146. SessionManager.conf
  147. system_utils.h
  148. system_utils_impl.cc
  149. system_utils_impl.h
  150. system_utils_unittest.cc
  151. systemd_unit_starter.cc
  152. systemd_unit_starter.h
  153. termina_manager_impl.cc
  154. termina_manager_impl.h
  155. termina_manager_interface.h
  156. upstart_signal_emitter.cc
  157. upstart_signal_emitter.h
  158. user_policy_service.cc
  159. user_policy_service.h
  160. user_policy_service_factory.cc
  161. user_policy_service_factory.h
  162. user_policy_service_unittest.cc
  163. vpd_process.h
  164. vpd_process_impl.cc
  165. vpd_process_impl.h
login_manager/README.md

Chrome OS Session Manager

session_manager is responsible for managing the lifecycle of the Chrome process. It confusingly lives in the login_manager directory and is installed by the chromeos-login package.

session_manager communicates with other processes using D-Bus. It owns the service name org.chromium.SessionManager at service path /org/chromium/SessionManager and exports an interface named org.chromium.SessionManager.

This document contains an overview of what session_manager does. See the docs directory for more information.

Startup

The ui Upstart job is responsible for running session_manager. Before executing it, it runs ui-pre-start to create necessary files and directories.

session_manager constructs a command line for running Chrome and fork-execs it. The command line is built by chrome_setup.cc and libchromeos-ui‘s ChromiumCommandBuilder class. The command line’s contents are dependent on the presence of various USE flags. The libchromeos-use-flags package lists a number of USE flags in its IUSE variable; at build-time, it writes all of the set flags to /etc/ui_use_flags.txt. session_manager then reads this file at startup. (Generating ui_use_flags.txt in a tiny ancillary package rather than in chromeos-login avoids the need to build a different copy of the chromeos-login package for every board.)

Developers should take note of /etc/chrome_dev.conf, a configuration file that may be modified on-device to add or remove flags from Chrome's command line. The file contains documentation about its format.

After Chrome has displayed its login prompt, it calls session_manager's EmitLoginPromptVisible D-Bus method. session_manager writes a login-prompt-visible bootstat event, emits a LoginPromptVisible D-Bus signal on its interface, and makes an asynchronous D-Bus call to Upstart to tell it to emit a login-prompt-visible event; this latter event is used to trigger other jobs.

Login

When the user successfully logs in within Chrome, Chrome calls session_manager‘s StartSession D-Bus method. session_manager makes an asynchronous D-Bus call to Upstart’s StartUserSession method and emits a SessionStateChanged D-Bus signal on its own interface.

Additional SessionStateChanged signals are emitted if additional users are added to the session.

Screen Locking

Other processes on the system may decide to lock the screen after the user has logged in:

  • Chrome locks the screen in response to a request from the user, or just before the system suspends if the “Require password to wake from sleep” setting is enabled.
  • powerd locks the screen in response to user inactivity.

To do this, these processes call session_manager‘s LockScreen D-Bus method. session_manager records the locked state internally and calls Chrome’s LockScreen D-Bus method. Once Chrome has successfully displayed the lock screen, it calls session_manager's HandleLockScreenShown D-Bus method. session_manager then emits a ScreenIsLocked D-Bus signal.

After the user successfully types their password to unlock the screen, Chrome calls session_manager's HandleLockScreenDismissed D-Bus method. session_manager updates its internal state to record that the screen is no longer locked and emits a ScreenIsUnlocked D-Bus signal.

Logout

When the user signs out, Chrome calls session_manager's StopSession D-Bus method. session_manager sends SIGTERM to the browser process and waits (3 seconds, by default) for it to exit. If the process is still running, it sends SIGABRT. session_manager then exits.

At this point, the ui-post-stop script runs. It writes a ui-post-stop bootstat event and forcibly cleans up by sending SIGKILL to any remaining chronos processes and killing orphaned containers.

The ui-respawn Upstart job then executes the ui-respawn script, which is responsible for restarting the ui job.

Crashes

If Chrome exits unexpectedly, session_manager typically restarts it (without the --login-manager flag). If the screen was locked at the time of the crash, session_manager instead ends the session to avoid exposing a logged-in desktop on a potentially-unattended system.

If Chrome crashes repeatedly, ui-respawn reboots the system. If the crashes continue, it stops rebooting the system with the hope that it‘ll eventually be autoupdated to a new version that doesn’t crash. See the ui-respawn script for specifics.