commit | 39a9977505fdd8b3781755dc8d11905caf822639 | [log] [tgz] |
---|---|---|
author | Noah Gold <nkgold@google.com> | Mon Jul 11 23:36:23 2022 |
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Jul 14 02:37:03 2022 |
tree | 31d99e4504267aa388d179e24d5fe59825e70cb6 | |
parent | 6952be0328ce3509b38b8724d5a2919ce9ee1cf9 [diff] |
base: syslog panics on double-init. We've had multiple silent bugs stemming from the current double-init behavior of the logging system. To prevent that from happening for the fourth time, this CL makes all subsequent logging inits panic. This way, it will be much harder to commit code that won't work. Details: * Current behavior: only the first init applies logging configuration. The subsequent inits will silently do nothing, and discard the supplied settings. These settings could be important things like setting the log file, whether to echo to stderr, etc. * New behavior: after the first call to init, any subseqent call will panic. NOTE: If this CL breaks a downstream project, there is very likely a bug in that project which may be causing logs from crosvm to be lost. Please fix that bug, or revert this CL in the downstream project temporarily. In this CL, we discovered that openlog_and_get_socket (used in linux syslog) mutates global state. In tests, this manifested as a failure. For this CL, we've chosen to preserve the behavior of only re-creating State (and by extension, PlatformSyslog) when there is no STATE currently set. (This behavior is nice for other reasons since it keeps us from performing unnecessary operations when a no-op is possible.) BUG=b:238680255 TEST=presubmit & tested downstream by verifying log files were written. Also ran example_simple & verified it didn't panic. Change-Id: Iad64c1b52b917e63d14a42cbbd1739ef94107fae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3756274 Commit-Queue: Noah Gold <nkgold@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Vikram Auradkar <auradkar@google.com>
crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the Chrome OS platform. Compared to QEMU, crosvm doesn’t emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.
crosvm is currently used to run Linux/Android guests on Chrome OS devices.