From patchwork Thu Sep 14 02:44: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: 722513 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp168612wro; Wed, 13 Sep 2023 19:46:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWFOmwy4em9Ekd7FtSRUDl3uyiR+F6MIXwLTdBN+uUOkPRDEw6CE/JKjzqojLFpK12ksFA X-Received: by 2002:a0c:fc51:0:b0:651:65f4:31fa with SMTP id w17-20020a0cfc51000000b0065165f431famr5334568qvp.39.1694659571166; Wed, 13 Sep 2023 19:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694659571; cv=none; d=google.com; s=arc-20160816; b=CxznfYTbqWsa15aX152NNOiZAXkBLurH1Q1J+k+HPNGDSVdyqzaNpG2RUK9UZE/Ipf HnPJPEgrEXUc0HCC1sH0OlMnpVHDar2iSSNNQHGRUBkl5iIFv6ihsd6woqIiJsrCZDV8 SLpcy3fd22XFTraqeiqW6U/z8SL4WbhTRF1X6vjF1lcgNfE+DiFnC8N5Fq+lPA8szFU2 QJJfq3Bwu3Bvol8jIm+plCDpxEFoU4VQ2JlogCuJSNaYOrNfsb278tZNdIkdiv9nV4Uz TziHOGiG9qPkBiuKFp12eI7jROLMVBK0NLF/UoCbEy+CuyozI5tKpuTHX+Vvnct+AZis 1fzw== 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=oj3ja2p6t6YlQeSetVdrsmS/5dm/IsdRtlVuWzZbHeY=; fh=hDn/fDAvdH8as8KUfuhQfhp9TjOOsPx8dCoE4FbO+Y4=; b=VLJTcRR7cew3oyaQywy+M1ht+JBz4lGnxOJ8k3SKewE31BdYQ1p23uzCBVb01d7FkS q0N0OqJ12OMWgZWflu1vWoHh/DRn+uda5OsRsrx9qhA+XXNOxRDHBy0tD0h0vKtG9zsX RUsbh2MDCrHvj0GYdi5aDc4BTdsn/5P2tq2FKEOM2DmQyV8boSB9ILPvKjOJOMJwMZFh Kx8QL6xf9en/ttsjfX+LrmuYHq7J3esXALMgL4Wt6yB6ZuYMpr88SNUutuxXbsqRqoBZ EYE1SxhivxtNw9FQwEKVxOJE6MTOh4HPXTCPmL+/LClWiR4+qn3Bg0rM8T0w4X8MQ/Zc EwkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d0bX9k0X; 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 de40-20020a05620a372800b0076d81529fc4si344087qkb.460.2023.09.13.19.46.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Sep 2023 19:46:11 -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=d0bX9k0X; 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 1qgcLY-0000cS-2p; Wed, 13 Sep 2023 22:44:48 -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 1qgcLW-0000bk-6e for qemu-devel@nongnu.org; Wed, 13 Sep 2023 22:44:46 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgcLU-0000g2-M0 for qemu-devel@nongnu.org; Wed, 13 Sep 2023 22:44:45 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1bf7a6509deso3459415ad.3 for ; Wed, 13 Sep 2023 19:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694659483; x=1695264283; 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=oj3ja2p6t6YlQeSetVdrsmS/5dm/IsdRtlVuWzZbHeY=; b=d0bX9k0XIxK/QlC0N7O/j4/iE0sxt9zgYZ5R3aRJn5qs4O9kX1v/9DH5fGYCitNEwJ /nCJPLeO4rmd8GRASHv3VCQ7EQSI1boFKZeG7HV2SuHYSrBqIzOlg8TES9jYflaRK7H5 O3MUWFMIDo1m/OJQlLp5tHBiD0RU/DdHr3yc9y3e0PHHdzZcYDzAdsNZhEbjGWUivsDR M4BockDdKlynVH7l+eAGOfdJXA6/hRwxj5F15H6yl1QEuK6IxHh0aD9MQoNWeNAxNj4H EblRoGcQVJxz4fFyG+W5Mql4EytmGaVnxtyqR31J6dfNIRrrMs2Ma5BaNS89Y+U3zD9y k6vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694659483; x=1695264283; 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=oj3ja2p6t6YlQeSetVdrsmS/5dm/IsdRtlVuWzZbHeY=; b=bYYHvJ1DvMRqi37buek1DP/o7guXn+5F21s4RA6aG49+SxEabSpCN0Oxbap4bLGrSq nXRaZUK+yjyc8dSdXXBrfGoorEVkcgYwPRWR3tmo4VWf44Uww5y/MmzOaTYeA6I96BRv 806jZno9+Ip8svK7G5TTUpkyK532qK7rluwr3pCRNRUyGVR0tEGgqcCk1pZHA02OxtiT GTbVRFf2JXRXeyyO3989BSsTWS7uiOzFldVIDAQGkGg7Sj0NO657qxudr+sOOZF8zMn0 RjQAsRXn5Y3yPXnft0eIZxIXIxFQBUhuEOWZKzdxLOids9acgln3rQA1aST1z6u5GjQE 4yEg== X-Gm-Message-State: AOJu0YyGq+hkyEtMN9kmLnWvs0qMo34/A2fiZlvr3cVXrJuFb1sBbtKV h219kyy1X64cabPsmjT6QqfR2evF39GorNsI+cA= X-Received: by 2002:a17:903:496:b0:1bf:39d8:48f3 with SMTP id jj22-20020a170903049600b001bf39d848f3mr4222439plb.16.1694659483229; Wed, 13 Sep 2023 19:44:43 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id x24-20020a170902b41800b001bbdf32f011sm304336plr.269.2023.09.13.19.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 19:44:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: anjo@rev.ng, ale@rev.ng, philmd@linaro.org Subject: [PATCH v2 07/24] accel/tcg: Validate placement of CPUNegativeOffsetState Date: Wed, 13 Sep 2023 19:44:18 -0700 Message-Id: <20230914024435.1381329-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914024435.1381329-1-richard.henderson@linaro.org> References: <20230914024435.1381329-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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. Signed-off-by: Richard Henderson Reviewed-by: Anton Johansson --- 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 c2c62160c6..86a7452b0d 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -459,6 +459,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