diff options
| author | Ritesh Harjani (IBM) <ritesh.list@gmail.com> | 2026-11-01 20:58:07 +0530 |
|---|---|---|
| committer | Madhavan Srinivasan <maddy@linux.ibm.com> | 2026-11-20 13:25:18 +0530 |
| commit | 3aa91029dedaa00780f5aa15763e88d31c43eac5 (patch) | |
| tree | 3f6f4a74b41fdce48f0eb946ecce51dc5e492877 /tools/perf/scripts/python | |
| parent | b282541b555b9ddc64b85fbe00bbc39522aaa911 (diff) | |
KVM: PPC: Book3S: Don't call __ffs() on an empty pending_exceptions bitmap
This problem was caught when running KVM PPC selftests on big-endian.
__ffs() doc clearly says:
"Undefined if no bit exists, so code should check against 0 first"
This cause KVM to deliever an arbitary interrupt to the guest and was
causing guest to hang up while running these selftests.
On checking further - GCC was emitting 0 in this case, which caused
System Reset in guest while running kvm selftests.
Use find_first_bit() instead, which reads the word once and returns the
bitmap size when no bit is set, instead of reading *pending twice
thereby causing TOCTOU as pointed by Sashiko.
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/aa74d5ca5ad53a2fa03a7224126f28899ca9b308.1793546707.git.ritesh.list@gmail.com
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
