From patchwork Sat Sep 16 21:40:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 723621 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1029171wro; Sat, 16 Sep 2023 14:46:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2PbUa6ARYznPPoqkOWWaEyZA2PI7/FuTpi37hZwUcLcYzjuVdwrn2g6PzKgwcZ3je9EIe X-Received: by 2002:ae9:c103:0:b0:770:658e:4f6b with SMTP id z3-20020ae9c103000000b00770658e4f6bmr4831190qki.39.1694900784675; Sat, 16 Sep 2023 14:46:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694900784; cv=none; d=google.com; s=arc-20160816; b=YRf2XuNAubV7CumEcBODnEJWU+7Q4xJv9ek2G56dQjMseyRkf4lH2BGrsFTkaOvoxc 3bIle3+n9xKxyGdQpbfgsXXQEiDgtqg+m8BoDIUpjR9udC3CQ3EIB3mhXbbdRYOwg0Et B85uRLEYEsqZLjaVoDuKzPEVbC4xVpwZL0j/MJBoXvGBj2KNVxN4IZABlwSQE9eP3d8s t0VBba99QBZeaoR8p3hdah4JdCyNNoxuyYsPnOXXkLWqWa0/CjKtiKx6JnANWO1rPFW9 JO61wsCYr/AqyEpIwf/0gMSPtSIffKz2pe+VImU+IqFBtcMY0/v8ZSbmj1WPqESBsnO0 RYyA== 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=MKFrEK1ybHE5W37yArUxMsWARo+/L2b8HkANYXonYTk=; fh=d3q967Ss27yOZEBNWb7WV1pwIIYORDjfLhLmomzC17w=; b=GCc6r/SvjnIf24QiSMLa5+5TViIM014TrwMfDN6ufdQSDo2sljNC/31I9Ir+H0HLR8 JWTT0Dhq05dCTTZ3ozHYatUVnH/rPnjFZtYMdArnOkK0qCArWDHadsF79ka0w1nGy22l QQuyo5KZDwUh04EPd22awAKZmz7y1WIfcv53oyJGDwjTSrKE5OUs5ciyI8c7niF3P6wB uApqQpexNSw1cjzFWY39i2pKPNvtS2tpaTsTXA6aiAwMl2btFWesaA/4YMGNZbXRG4XC Lbc/vBOT2khjxWijXg7CJRo1CbqwK6DAfblMyoyJeh/D6bdI8aTD/EgiB9TFbbKauDk0 fhvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iKtLI0pJ; 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 s28-20020a05620a081c00b00773c2896c58si866183qks.747.2023.09.16.14.46.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Sep 2023 14:46:24 -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=iKtLI0pJ; 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 1qhd2s-00057Y-Fo; Sat, 16 Sep 2023 17:41:42 -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 1qhd2j-00054W-Bd for qemu-devel@nongnu.org; Sat, 16 Sep 2023 17:41:34 -0400 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhd2h-0000Qe-ST for qemu-devel@nongnu.org; Sat, 16 Sep 2023 17:41:33 -0400 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-57656330b80so2100126eaf.3 for ; Sat, 16 Sep 2023 14:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694900491; x=1695505291; 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=MKFrEK1ybHE5W37yArUxMsWARo+/L2b8HkANYXonYTk=; b=iKtLI0pJWOnJhaEyUwWew9kRhbxPWO6N4W9PaXIa4E7d8j/ZwDKI0qTMCsiiotnzKy UqoW5shN4oFAeEkzpAiyq5Yb8Y41HBKS6QAY5u4zWz1HpVdVFGr26vrKDc+YMcYCqsH1 28bY8NfgGV6vb5OLjPsRgwXu9biqOKzxiMukB3jxOe4T00Fh7vcBqf2npiQzFmfg7SuC 2PTRFzZ/W7P4rpozW/XwBnu3pRJXmx9F3D8/gyC+IcsNeCF1eyeRcepfxiYtMH8YJsjp u5j00Kdi9iK/WQZ1pfq0uwWQJ7MEmFhmXqhsVUyEoxrgX4SS8kuM1pt3+9PwfCbXDUEr /FaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694900491; x=1695505291; 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=MKFrEK1ybHE5W37yArUxMsWARo+/L2b8HkANYXonYTk=; b=Yp1CNEFYopIaui+y7IlOBaHruBtKcDaBmCRoNvFoFeL3WX2jLWeE3lUaIQowvdnSej apoA4dKNlyhb1n3IVsH9kTBPxGaessgP6B6+cLiLQFejn3djsgEYT5ZoCTvO0lzGJov4 jRonKP4dBt6Hh9yxo4fQxyLJITc+lzK9jWUuS7TLa3V6+e6m2FMkhWQKqiCeZlW+INmL FhSLt+f5dXPK4Kst5KK2czfk4eyglRr4MCnZNejiR35TgWXxneCLamDXBIxsotO78tom ekGabcOc6bVu8u8LVBCEvghJChP8f4l8aObeO/XIFqdd+LJzDbZ9k0UeIeyoNqvZyG+m peAQ== X-Gm-Message-State: AOJu0YzJ6fTMlXX5wbFXHT7UOkZIC4flD9qx3RTwBSHbYB5hFdh80g9P rwYbmYB8t5Db61+nYcTJ6UaSZgc5mg7HHbUnzxM= X-Received: by 2002:a05:6870:462a:b0:1c8:c128:c38e with SMTP id z42-20020a056870462a00b001c8c128c38emr5936710oao.15.1694900490847; Sat, 16 Sep 2023 14:41:30 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id n21-20020aa79055000000b0068fde95aa93sm4871708pfo.135.2023.09.16.14.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 14:41:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, anjo@rev.ng Subject: [PATCH v3 06/39] accel/tcg: Validate placement of CPUNegativeOffsetState Date: Sat, 16 Sep 2023 14:40:50 -0700 Message-Id: <20230916214123.525796-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916214123.525796-1-richard.henderson@linaro.org> References: <20230916214123.525796-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2f; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2f.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 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