From patchwork Tue Oct 3 17:30:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 728743 Delivered-To: patch@linaro.org Received: by 2002:a5d:60c8:0:b0:31d:da82:a3b4 with SMTP id x8csp2259950wrt; Tue, 3 Oct 2023 10:31:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFs0/zs7X7t4EuYg0GjJZvtx20ZLnoLFfpJKk5YIrNVlOj65kqKKxOpPHaK1Nr2QB9fIQi1 X-Received: by 2002:ac8:59cc:0:b0:419:5b6c:be62 with SMTP id f12-20020ac859cc000000b004195b6cbe62mr170275qtf.4.1696354311619; Tue, 03 Oct 2023 10:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696354311; cv=none; d=google.com; s=arc-20160816; b=YwjzM/YevHB8EyOuZhbKzYesOog9/sECvQ/dxWi3Qh2jH58zu+8Wn0isQgIwN6EtEm yL49Wq72O6/x6R2kwWgnXukcJ+TOUw3muzXovki4PygYLd09GU4w4xJwhivqF6Rc0uUF KtXcvpHZ37yc4GcDq4ej/TsuDM5QA/oQ9IKXWp40NU7638mf0spUaN0UoJbsMUhfk+nn ttDj1Zbrfs8t4f9tv4bgVnEC+EwriaqmzrYnbhJwzossF4G/IYqhteZ5yJzrnxqyluQw zQmOgbcjW0b7h+Pgj0UbMrG15IrXHLBm+5qya4rawb8deHjY87zkv3Twfc8qB7cFDw6Q bRvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iB4lO9c+clWCbJCjPqJ6aktwgO1wOrbuIWD3fNaxM9A=; fh=l3rThTWYtfg9kQ3pwkdseR7wGfUMT6wsJF5cqMswxYY=; b=ZuQT2Yk4z8ThZIUPNfRRA3yb3Vhx2kDqXkryGJ++9/7GRzUu5V5vXFxCZ4SqleXP5Q eL9gWIuMTN7DxXcuW3u0hw+05jku2m7hq95E502bjkDdI6NgAhXmep4MmjUDLmZtwK/K wcgt1t2bhQyE+DEs75/DPSmP2Mem0YFsfE1F0grNgwA6PMntKQSwm9y3WZXStcaLiOmT nvEWi68LfTYrqDe5D0MoETrs134PRg7Cb0RMptVzE/PVS+kui2cmiLEUU+Ka3Agr2Z+n u+Ga+h0fttHwkZiAvPT/KnDvVJGJ/KgaZ02OkDXcgxcEZiRUfF+JMOfjvO/sCV7pDhMI o3SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X+WVzLkm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f21-20020ac859d5000000b00403c3fb27d8si713830qtf.678.2023.10.03.10.31.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Oct 2023 10:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X+WVzLkm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnjF9-0008Vs-UT; Tue, 03 Oct 2023 13:31:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnjEm-0008GB-5X for qemu-devel@nongnu.org; Tue, 03 Oct 2023 13:31:18 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qnjEk-0007TZ-NP for qemu-devel@nongnu.org; Tue, 03 Oct 2023 13:31:11 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6907e44665bso927466b3a.1 for ; Tue, 03 Oct 2023 10:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696354268; x=1696959068; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iB4lO9c+clWCbJCjPqJ6aktwgO1wOrbuIWD3fNaxM9A=; b=X+WVzLkmJBt1gcUzmeEKIvL2EfBsK8uRccKPKR0XCRReyPpMxcOuVKQnF4JRr9o/CY w1vf0QNfkNI7dLcgVPeUUQu7keRQMInKeQG8xcbtrK/xwGjj2fuU6HvEddnUuvqwchSw Da3FIqzjh2qNw64r412YULpfXFvmdFO4gTJmaQ1DsQeT/low5CL6TgGFVIjTie00WB0U hNtQs4dX80AMWCo83dg5jQAcQtMyANmb+XsTT/8rzeTn/+4c9IOEyLOqk5F6nRBSzZGu 7TYDCfliS/GbvfhdeftzD9JKXgqwCiyXESeiGTboqoFRTKoMyMN1H3pL7K+/4dYNI95L PK6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696354268; x=1696959068; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iB4lO9c+clWCbJCjPqJ6aktwgO1wOrbuIWD3fNaxM9A=; b=MAriGlf2jx+EQUTRnWG41ihi0lJwP88/X9CiYO+HSnqta+sStgpxagdROdSUaSSnqp LdNdxKXEvnhuO73NYEn0TD01XN5hMWEvJWYBlkk6WyUo56bazyJ6jRd9ea05ebQSXOSk Xqq+wEqchs87LDWFB3FP22D5v6BJgI7KmvaqG7HrbS9hx5RYz4rTG/3EJnpTWPG5iQrz a2IIVEmJUFm1NSGrPF24Ssh+Di/tKJ/MO4mQivfBlKJGtCBuVgn4EjliH6YrIOTidlVp OlnnjwKvGQD6kCOFeyAhePk7414Ak+f0PQp2qJt36KhKE7CfHX5PmHdfTbA47sxS5wNk hbyg== X-Gm-Message-State: AOJu0YxQjmbLnAn+khgsdcHq76KlqXxtWW63UZEDQCEhfeBLLBh0+pb4 l+z/n86t5Hshpx6+FV3dJCkYjXYHiE1LGGGK2pI= X-Received: by 2002:aa7:8884:0:b0:68a:5773:6319 with SMTP id z4-20020aa78884000000b0068a57736319mr287195pfe.11.1696354268282; Tue, 03 Oct 2023 10:31:08 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020aa78a47000000b00692c5b1a731sm1620195pfa.186.2023.10.03.10.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 10:31:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Anton Johansson Subject: [PULL 13/47] accel/tcg: Validate placement of CPUNegativeOffsetState Date: Tue, 3 Oct 2023 10:30:18 -0700 Message-Id: <20231003173052.1601813-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003173052.1601813-1-richard.henderson@linaro.org> References: <20231003173052.1601813-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Verify that the distance between CPUNegativeOffsetState and CPUArchState is no greater than any alignment requirements. Reviewed-by: Anton Johansson Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 230525ebf7..ed7747a5f1 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