From nobody Wed May 15 04:09:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672858928; cv=none; d=zohomail.com; s=zohoarc; b=M20rxBmAQMsX+hSuWRRAMkKDbdnOeVUdKo9oBYxvaW19D4EkK6iHOiT8o8c/oY/l3NNOzv36ie+Hxl/M+yBWA79H5Q09MdtnD1rg1bV2hHruT3X4qEFoZTfqzK3NyTwD/9nlrcUGnao1MI9hdEOJs5Y+sLcRvD34P9/8hPWcYug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672858928; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=YvZMPcOUxmObQLWYm+QiH6r1q3TcpfTIRIDtyxjsal0=; b=Bjv3PUUkeUKgN5goVKtGWh4jd7qUGEDT3oqewI9TGk2Sm4dw7n8FOsSmiJmPrj9OBZrx8G3EsltAJyU9BVFSMoYYogW+kvpy499loiQxNQ3Lb2mL88B7pPPt7g6Io1bO6wCEOzNI9DSqevHk3+KMc43qg0+jJg2EuMUdPaNqLaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1672858928197675.915391006738; Wed, 4 Jan 2023 11:02:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD90e-0005lq-IU; Wed, 04 Jan 2023 14:01:08 -0500 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 1pD90X-0005lF-Dl for qemu-devel@nongnu.org; Wed, 04 Jan 2023 14:01:01 -0500 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 1pD90V-0003Q6-Lz for qemu-devel@nongnu.org; Wed, 04 Jan 2023 14:01:01 -0500 Received: by mail-pf1-x435.google.com with SMTP id b145so19441234pfb.2 for ; Wed, 04 Jan 2023 11:00:59 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:92be:ce91:1417:6686]) by smtp.gmail.com with ESMTPSA id w10-20020aa7954a000000b00581e6a72abfsm11066472pfq.5.2023.01.04.11.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 11:00:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YvZMPcOUxmObQLWYm+QiH6r1q3TcpfTIRIDtyxjsal0=; b=R1BVcRgQu65KrZGiPHDWrroBQJANQWHEuyw5bXDKqImTnHuDPEPuwECLqh6UitFgJA BmTtk706nicPvwsqV9M9nzfcw+GvCuXAgg9Pgw+W31IGTC1JzGIQd+UdGwwizjvEkGfG abaxKSrqeGnKfBNU6eHw/C7T1yxYK1lUcc8aJhIYrETupUGxWA+K6oV3qpRIwPabS8DM bgG66lAqTIzilrTw0l0/5nK3gdBOXBn2eVEERu0zbhNPfKI36nEElo96c9GPcUWq5i0B xQA3svruFFjhKNZWKDtSBxBHXK4kbRy2EFtK6F4C2I722knoPoIW0n+B9u82BaOWRPIB +ivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YvZMPcOUxmObQLWYm+QiH6r1q3TcpfTIRIDtyxjsal0=; b=qYMHESzAjIGjXlv7h4IBFB7CQW6fcYn1jxLRoYx6YmuwEas4KPYEVnH8Qg/aKvoP1h Qe069M9GSwyof1L2+rW8rxklANB92hu8409+C/BqJnG6/Ea6p/HJY0dN+Oe2mBT/oVTM 01UJpbsKXtEPhXFCyyzFR1imVlHgf1bnpkwYgnekx/JBwK+PAs/EDxDUfDTUH8WHy/Lg oWMKNcv2OaV5R5Py9u9SYQSn9RJfBZkAKA+kf3F9xCXON1kS3zt4Yk4Cg+bjidbtevji JYNoGapdFzbzL62hID7OcAu1HlSxu9YXrZCGM6enSFvm5KKsojkdfTS2gGZkuv6dlMmb 1xww== X-Gm-Message-State: AFqh2koW4ZW3rRsmUPJ0UcYqkh1hEPxqk1Qq7YHiI0exV0SDMumwkeRL hdWULWhohjp9IE4I7n9/esetY11hsGifLPBK X-Google-Smtp-Source: AMrXdXsB+NFHFqeWUaccd5YD4YWIasn3gcWbCUuBeO2K1Yj/I+YK0liIO6AIllZ0Gt5Kr3S2gLaVgw== X-Received: by 2002:aa7:955d:0:b0:582:d5e3:12a7 with SMTP id w29-20020aa7955d000000b00582d5e312a7mr5340627pfq.6.1672858858153; Wed, 04 Jan 2023 11:00:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, idan.horowitz@gmail.com, qemu-stable@nongnu.org Subject: [PATCH] target/arm: Fix sve_probe_page Date: Wed, 4 Jan 2023 11:00:56 -0800 Message-Id: <20230104190056.305143-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672858928944100001 Content-Type: text/plain; charset="utf-8" Don't dereference CPUTLBEntryFull until we verify that the page is valid. Move the other user-only info field updates after the valid check to match. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1412 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/sve_helper.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 1afeadf9c8..521fc9b969 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -5354,15 +5354,10 @@ bool sve_probe_page(SVEHostPage *info, bool nofault= , CPUARMState *env, #ifdef CONFIG_USER_ONLY flags =3D probe_access_flags(env, addr, access_type, mmu_idx, nofault, &info->host, retaddr); - memset(&info->attrs, 0, sizeof(info->attrs)); - /* Require both ANON and MTE; see allocation_tag_mem(). */ - info->tagged =3D (flags & PAGE_ANON) && (flags & PAGE_MTE); #else CPUTLBEntryFull *full; flags =3D probe_access_full(env, addr, access_type, mmu_idx, nofault, &info->host, &full, retaddr); - info->attrs =3D full->attrs; - info->tagged =3D full->pte_attrs =3D=3D 0xf0; #endif info->flags =3D flags; =20 @@ -5371,6 +5366,15 @@ bool sve_probe_page(SVEHostPage *info, bool nofault,= CPUARMState *env, return false; } =20 +#ifdef CONFIG_USER_ONLY + memset(&info->attrs, 0, sizeof(info->attrs)); + /* Require both ANON and MTE; see allocation_tag_mem(). */ + info->tagged =3D (flags & PAGE_ANON) && (flags & PAGE_MTE); +#else + info->attrs =3D full->attrs; + info->tagged =3D full->pte_attrs =3D=3D 0xf0; +#endif + /* Ensure that info->host[] is relative to addr, not addr + mem_off. */ info->host -=3D mem_off; return true; --=20 2.34.1