commit | a87fc5e9e033fdc02713d15cd2d2afdfecd20ddc | [log] [tgz] |
---|---|---|
author | Mark Seaborn <mseaborn@google.com> | Tue Feb 28 00:11:19 2023 +0000 |
committer | CQ Bot <fuchsia-internal-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue Feb 28 00:11:19 2023 +0000 |
tree | 07afd74728db93e3dd020c668cb60036e430d3c0 | |
parent | 6c1fd41cbed2750288848c0b5e3b90f16d6e3374 [diff] |
[kernel][ktrace] Fix race condition in ktrace record creation (reland #2) This change fixes a bug in ktrace that could manifest as a failed debug assert. See https://fxbug.dev/120711 for details. Remove unused PendingCommit::observed_grpmask_ field. Replace grpmask_and_inflight_writes_ with a new field, write_state_ that encodes both the in-flight count and a writes-enabled bit. Because we emit group-less name records at trace initialization, group mask alone is insufficient to control whether writes are enabled. Move the group mask into its own dedicated atomic field that's checked by writers before attempting to increment. Change KTraceState::IncPendingWrite to only increment if writes are enabled and return false otherwise. KTraceState::Reserve will now fail with ZX_ERR_BAD_STATE if called when tracing is stopped. This is a reland. The earlier two versions were: * https://fuchsia-review.googlesource.com/c/fuchsia/+/801688 The change from that version is to fix an assertion in DecPendingWrite() (and to add a test for that). * https://fuchsia-review.googlesource.com/c/fuchsia/+/804268 The change from that version is to do IncPendingWrite() before ReserveRaw() so that we don't create trace records with zero headers when writing to the trace buffer has been disabled (and to add a test for that). Those original versions were authored by Nick Maniscalco. Bug: 120711 Bug: 122181 Change-Id: Iab89c17e06a3987e83e4fac4c0d425a4085cdf8b Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/810689 Commit-Queue: Mark Seaborn <mseaborn@google.com> Reviewed-by: John Grossman <johngro@google.com>
Fuchsia is an open source, general purpose operating system supporting modern 64-bit Intel and ARM processors.
We expect everyone interacting with our project to respect our code of conduct.
Read more about Fuchsia's principles.
See Getting Started.
See fuchsia.dev.