mirror of https://gitlab.com/qemu-project/qemu
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
5311599cdc
In riscv_cpu_do_interrupt() we use the 'cause' value we got out of cs->exception as a shift value. However this value can be larger than 31, which means that "1 << cause" is undefined behaviour, because we do the shift on an 'int' type. This causes the undefined behaviour sanitizer to complain on one of the check-tcg tests: $ UBSAN_OPTIONS=print_stacktrace=1:abort_on_error=1:halt_on_error=1 ./build/clang/qemu-system-riscv64 -M virt -semihosting -display none -device loader,file=build/clang/tests/tcg/riscv64-softmmu/issue1060 ../../target/riscv/cpu_helper.c:1805:38: runtime error: shift exponent 63 is too large for 32-bit type 'int' #0 0x55f2dc026703 in riscv_cpu_do_interrupt /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/clang/../../target/riscv/cpu_helper.c:1805:38 #1 0x55f2dc3d170e in cpu_handle_exception /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/clang/../../accel/tcg/cpu-exec.c:752:9 In this case cause is RISCV_EXCP_SEMIHOST, which is 0x3f. Use 1ULL instead to ensure that the shift is in range. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Fixes: |
1 day ago | |
---|---|---|
.. | ||
insn_trans | 4 weeks ago | |
kvm | 4 weeks ago | |
tcg | 1 month ago | |
Kconfig | 2 months ago | |
XVentanaCondOps.decode | ||
arch_dump.c | 2 years ago | |
bitmanip_helper.c | ||
common-semi-target.h | ||
cpu-param.h | 3 months ago | |
cpu-qom.h | 1 month ago | |
cpu.c | 1 month ago | |
cpu.h | 1 month ago | |
cpu_bits.h | 1 month ago | |
cpu_cfg.h | 1 month ago | |
cpu_helper.c | 1 day ago | |
cpu_user.h | 1 month ago | |
cpu_vendorid.h | 2 years ago | |
crypto_helper.c | 1 year ago | |
csr.c | 1 month ago | |
debug.c | 2 months ago | |
debug.h | 2 months ago | |
fpu_helper.c | 5 months ago | |
gdbstub.c | 6 months ago | |
helper.h | 6 months ago | |
insn16.decode | 1 month ago | |
insn32.decode | 1 month ago | |
instmap.h | ||
internals.h | 1 month ago | |
m128_helper.c | 1 year ago | |
machine.c | 1 month ago | |
meson.build | 6 months ago | |
monitor.c | 2 months ago | |
op_helper.c | 1 month ago | |
pmp.c | 1 month ago | |
pmp.h | 1 month ago | |
pmu.c | 4 months ago | |
pmu.h | 5 months ago | |
riscv-qmp-cmds.c | 9 months ago | |
sbi_ecall_interface.h | 6 months ago | |
th_csr.c | 6 months ago | |
time_helper.c | 2 months ago | |
time_helper.h | 2 years ago | |
trace-events | ||
trace.h | ||
translate.c | 1 month ago | |
vcrypto_helper.c | 9 months ago | |
vector_helper.c | 4 weeks ago | |
vector_internals.c | 6 months ago | |
vector_internals.h | 9 months ago | |
xthead.decode | ||
zce_helper.c | 2 years ago |