From patchwork Wed Feb 28 20:25:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 776491 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp481172wrn; Wed, 28 Feb 2024 12:26:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW9qZiwLF1I83MwSejz/YafWQmtOm9fD+OdXMZJ6Gd+NlCE7u4LysPalbcPElLMBJMLyPk4uCgHK+ndpC24QHD7 X-Google-Smtp-Source: AGHT+IF19o6FoUpWpczgQN6MKDpM1/s+Q4P9rCvImZiSh1/ORbiaMLPHNww7YQEG2Adoloihs14r X-Received: by 2002:a05:620a:13e6:b0:785:ce02:4f82 with SMTP id h6-20020a05620a13e600b00785ce024f82mr140819qkl.17.1709152010470; Wed, 28 Feb 2024 12:26:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709152010; cv=none; d=google.com; s=arc-20160816; b=UCMbv+QA2+dcsaBgr7b1C1ioOtIfj2DjzLNHL8LQpX/2L8pG90W/WfOd1mXyiwE3qU 2YQHNlkLaxzUqwszE7nykAx/IvfKXGrIw2w2GIkmf3n6Ng3/PMy8PszDYUHppkhc+s4n H0og5Rw2FMt2miwxHZOB/96fySlo/ScS2jh6NDg5iAtMmmofWrn1nA7NQ1dLz+u+9OSZ nlvtfyYY1mdXbKkilX/Xv4hTyIGVpRCWoNctMUlAJVaQJL78wor+EwwRpDk3cpsOTtVj jFY/2afKh1QgEFdmja7EPlJ0+EA/6TJve0YEZll11EAgPZ7RM2k358IBqe+0YnWGmZvl F+2g== 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=FeF7fzEyCne6DT9i0AjI3AaZvbjspKahuYDo6eT9HQw=; fh=16xvu/nuDu3VA0kZpWD6rpcj0RibzZaN46r2pO+qqiM=; b=VmoyLS/LI3m5zGapqa+1lEZXJgA2TqeVqP9ZuuWTZlEvqCHm9reyt/T0TuSWtRCkyO 8HviyT1kqU+nCHVmwYcUAJXQRO9w8/LkpPl4hsCsHoHg2XeHLBH76ekzCRusjEzV+4O9 y82IeMc7r8uE7h5JLaZEMvgh0eBKFTzBmXPxy/ylggOLRLyWtbNs+y6VnNUaPYyRlDEn JTpn0wOISK0ii7HJQnQuqXLkRp1JWT48yDNYbDvvWfv5+ADf4wnSLdtMFNqC2YSFtYSv Kdf3j5Z3xZ+w00D3iUm5I1lESLxxuBIZGgG6lDZU2FUawMigLc/FzlD9oUz7C6qjhRhV Tntg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=djshCp09; 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=fail (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 b4-20020a05620a0cc400b00785d68e7bdcsi291700qkj.205.2024.02.28.12.26.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2024 12:26:50 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=djshCp09; 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=fail (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 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 = "[heap]"; } else if (start == info->vdso) { path = "[vdso]"; +#ifdef TARGET_X86_64 + } else if (start == TARGET_VSYSCALL_PAGE) { + path = "[vsyscall]"; +#endif } /* Except null device (MAP_ANON), adjust offset for this fragment. */ @@ -8082,6 +8086,18 @@ static int open_self_maps_2(void *opaque, target_ulong guest_start, uintptr_t host_start = (uintptr_t)g2h_untagged(guest_start); uintptr_t host_last = (uintptr_t)g2h_untagged(guest_end - 1); +#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 == TARGET_VSYSCALL_PAGE) { + return open_self_maps_3(opaque, guest_start, guest_end, flags); + } +#endif + while (1) { IntervalTreeNode *n = interval_tree_iter_first(d->host_maps, host_start, host_start);