From: Richard Henderson Date: Wed, 13 Sep 2023 00:18:37 +0000 (-0700) Subject: accel/tcg: Validate placement of CPUNegativeOffsetState X-Git-Tag: v8.2.0-rc0~89^2~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d30bdcb1b72ec1d44397ee7047417617066d97a;p=thirdparty%2Fqemu.git accel/tcg: Validate placement of CPUNegativeOffsetState Verify that the distance between CPUNegativeOffsetState and CPUArchState is no greater than any alignment requirements. Reviewed-by: Anton Johansson Signed-off-by: Richard Henderson --- diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 230525ebf79..ed7747a5f16 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -457,6 +457,12 @@ static inline CPUState *env_cpu(CPUArchState *env) return &env_archcpu(env)->parent_obj; } +/* + * Validate placement of CPUNegativeOffsetState. + */ +QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) - offsetof(ArchCPU, neg) >= + sizeof(CPUNegativeOffsetState) + __alignof(CPUArchState)); + /** * env_neg(env) * @env: The architecture environment