summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin/stackcollapse-record
diff options
context:
space:
mode:
authorYounes Akhouayri <git@younes.io>2026-08-22 10:44:47 +0200
committerMiguel Ojeda <ojeda@kernel.org>2026-08-24 13:21:12 +0200
commit7dd6343fc127935425a81a8f1989907996c2868d (patch)
treeb09463ebb1194c6b687571cafed1bbcb033ddd60 /tools/perf/scripts/python/bin/stackcollapse-record
parent5febf432df1cfa5b25d99b54c32103fafbdd0eb9 (diff)
rust: num: restrict bool conversion to unsigned Bounded
From<bool> turns true into 1. A signed Bounded with N = 1 can hold only -1 and 0. The current implementation can therefore create a value that breaks Bounded's invariant. Deref relies on that invariant and calls unreachable_unchecked() when it is broken, so safe Rust can reach undefined behavior. The other primitive conversions require the source and destination to have the same signedness. Treat bool as an unsigned one-bit value and allow conversions between bool and Bounded only when the backing integer type is unsigned. Fixes: 01e345e82ec3 ("rust: num: add Bounded integer wrapping type") Closes: https://lore.kernel.org/rust-for-linux/OzuVxu0--J-9@younes.io/ Cc: stable@vger.kernel.org Suggested-by: Alexandre Courbot <acourbot@nvidia.com> Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Younes Akhouayri <git@younes.io> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Link: https://patch.msgid.link/20260822-fix-rust-bounded-from-bool-submit-v4-1-aa780bfe7f30@younes.io Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions