From nobody Tue Nov 26 08:55:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709152010781490.82087960303613; Wed, 28 Feb 2024 12:26:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfQUc-0007zu-UP; Wed, 28 Feb 2024 15:25:30 -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 1rfQUb-0007zK-E7 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:25:29 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfQUW-0007Lz-9f for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:25:29 -0500 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-29ab78237d2so67946a91.1 for ; Wed, 28 Feb 2024 12:25:23 -0800 (PST) Received: from stoup.. (098-147-055-211.res.spectrum.com. [98.147.55.211]) by smtp.gmail.com with ESMTPSA id oh5-20020a17090b3a4500b0029ab712f648sm2118499pjb.38.2024.02.28.12.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 12:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709151923; x=1709756723; 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=FeF7fzEyCne6DT9i0AjI3AaZvbjspKahuYDo6eT9HQw=; b=djshCp09lGMTHPRQQcwLiau1Qa3WG+Ao+Hk5wINjaQRphv8GGz6sSLssGtH8Ibeetz JCQvpno+ODI25AmCRgyQNcvxyCIKNtB/tqHl9RtR98e32lMTHbru00cBbyIQoBpdixcz XdzdexUOFwGRI86rfJ8sX9eT4Lg/yXDSRiLB4vfQh/596BhLBeNml1WPgw0Bxm76dUYY sU2TWP7jfvFbXjjsAE6fyWARsr6h6w48n6KkkaRwKW7j9iq0Kt1NtQAEBYW2jj+Q+KGz IEeRnlz9/XQ8r/9ECc5fM9C8NhEK6sLB0BidoWKuUzOezDSXXYXQp0dg9Mu2txkYGNR4 znJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709151923; x=1709756723; 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=FeF7fzEyCne6DT9i0AjI3AaZvbjspKahuYDo6eT9HQw=; b=IY/xJnOftuJHpMAWiUHgcE27JeC+h5vmkPGHPyFHk6W80ngtpe3U3J1LGkOYyueTVW 30AqCp7we6XrLaN328dpjrY+ur1yha8MK9mP6D2h2LhtN/HlROBwb868BNZbnH7ytUKP RnwAWArhZfpCfofzHTcJbpE1C83TdnyDqHrpRD5+dCiahthUZktQI7CazutgYncld6g7 TYekPPH/InC8GOHrUokWzntzwgn3rRnOAnc2KScVkPISi7wI/Yfq2Ndwpt9q2Bf8KH7O qCRli3GxO8AtVN29mgdNHVMWZnpLRBdbcrR23pV3y/j4UiBg5zVgFH2P0Hj+aNKAZ+Yd LtEA== X-Gm-Message-State: AOJu0YzlwYXgI8yvwu0aWc8en0bubEBBPkuqOxHNsosXLDHZuVc59aB7 8lksixizHkWIQWoLAQ9BB4Cv2+e3R1cM43PLrDPqSvrJlE2o28MAXEQdRO3osixOHFf2/RQfuOJ z X-Google-Smtp-Source: AGHT+IE5XRJrqoVYo7frj9BME26umkgmV05D9tvxvaRCOJcPoPZVG8hS/uHc7cW7L8R37iOnq87MQQ== X-Received: by 2002:a17:90b:3791:b0:29a:a436:4dda with SMTP id mz17-20020a17090b379100b0029aa4364ddamr332457pjb.0.1709151922839; Wed, 28 Feb 2024 12:25:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, richard.purdie@linuxfoundation.org, mjt@tls.msk.ru, iii@linux.ibm.com Subject: [PATCH v2 1/5] linux-user/x86_64: Handle the vsyscall page in open_self_maps_{2, 4} Date: Wed, 28 Feb 2024 10:25:14 -1000 Message-Id: <20240228202518.33180-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228202518.33180-1-richard.henderson@linaro.org> References: <20240228202518.33180-1-richard.henderson@linaro.org> 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::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1709152011922100003 Content-Type: text/plain; charset="utf-8" This is the only case in which we expect to have no host memory backing for a guest memory page, because in general linux user processes cannot map any pages in the top half of the 64-bit address space. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2170 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/syscall.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e384e14248..bc8c06522f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7994,6 +7994,10 @@ static void open_self_maps_4(const struct open_self_= maps_data *d, path =3D "[heap]"; } else if (start =3D=3D info->vdso) { path =3D "[vdso]"; +#ifdef TARGET_X86_64 + } else if (start =3D=3D TARGET_VSYSCALL_PAGE) { + path =3D "[vsyscall]"; +#endif } =20 /* Except null device (MAP_ANON), adjust offset for this fragment. */ @@ -8082,6 +8086,18 @@ static int open_self_maps_2(void *opaque, target_ulo= ng guest_start, uintptr_t host_start =3D (uintptr_t)g2h_untagged(guest_start); uintptr_t host_last =3D (uintptr_t)g2h_untagged(guest_end - 1); =20 +#ifdef TARGET_X86_64 + /* + * Because of the extremely high position of the page within the guest + * virtual address space, this is not backed by host memory at all. + * Therefore the loop below would fail. This is the only instance + * of not having host backing memory. + */ + if (guest_start =3D=3D TARGET_VSYSCALL_PAGE) { + return open_self_maps_3(opaque, guest_start, guest_end, flags); + } +#endif + while (1) { IntervalTreeNode *n =3D interval_tree_iter_first(d->host_maps, host_start, host_start); --=20 2.34.1