]> git.ipfire.org Git - thirdparty/qemu.git/commit
accel/tcg: re-factor plugin_inject_cb so we can assert insn_idx is valid
authorAlex Bennée <alex.bennee@linaro.org>
Fri, 17 Sep 2021 16:23:32 +0000 (17:23 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Tue, 12 Oct 2021 07:38:10 +0000 (08:38 +0100)
commit453d50ce75b16d1b00a0783279779471e079f489
tree3da9a5ba85370b0505b971da6db68d4d07d5e0d8
parent5d23d530235eaf352b1067854ad22681b1ab5584
accel/tcg: re-factor plugin_inject_cb so we can assert insn_idx is valid

Coverity doesn't know enough about how we have arranged our plugin TCG
ops to know we will always have incremented insn_idx before injecting
the callback. Let us assert it for the benefit of Coverity and protect
ourselves from accidentally breaking the assumption and triggering
harder to grok errors deeper in the code if we attempt a negative
indexed array lookup.

However to get to this point we re-factor the code and remove the
second hand instruction boundary detection in favour of scanning the
full set of ops and using the existing INDEX_op_insn_start to cleanly
detect when the instruction has started. As we no longer need the
plugin specific list of ops we delete that.

My initial benchmarks shows no discernible impact of dropping the
plugin specific ops list.

Fixes: Coverity 1459509
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20210917162332.3511179-12-alex.bennee@linaro.org>
accel/tcg/plugin-gen.c
include/tcg/tcg.h