|author||Noah Gold <email@example.com>||Mon Jul 11 23:36:23 2022|
|committer||Chromeos LUCI <firstname.lastname@example.org>||Thu Jul 14 02:37:03 2022|
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 <email@example.com> Tested-by: kokoro <firstname.lastname@example.org> Reviewed-by: Daniel Verkamp <email@example.com> Reviewed-by: Vikram Auradkar <firstname.lastname@example.org>
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.