From patchwork Fri Sep 1 02:23:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 719480 Delivered-To: patch@linaro.org Received: by 2002:ab3:1981:0:b0:23f:8cfb:5ad7 with SMTP id 1csp17120lti; Thu, 31 Aug 2023 19:25:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYPAQMVJok8CLlXObCsrfNcvvPKtfZzniYPmbJ8tfh2M2qg2NXJ+fsPSw0KJLgPBt4lhVQ X-Received: by 2002:a05:620a:28d0:b0:76e:f7f3:723e with SMTP id l16-20020a05620a28d000b0076ef7f3723emr5493658qkp.38.1693535143534; Thu, 31 Aug 2023 19:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693535143; cv=none; d=google.com; s=arc-20160816; b=I4p8p6keG8epCZXTCOH3E/e41fI1IUBGtKaUliJ/SXJva8flpkf1VY0WfiHKtToh1c 5G++suYsspIplI5qrBGc7fNvHzzhiIeubBmB6edI7Uk7Zb50JvP4LZFqBL1qIDZMoUyp 4HoRIDjd6eoqCKe6oEulRyKNmtPMaRyVxFtQWySZuhKuhXXp4CCsCg1Xh+QzS9Et4dPG m9w4JpMkLghy8LTaG0kwoxfnfgNhl9AgukkPjZU2i8UeVNwHvmiAcn+Xh1HiqtgbDuBA rmzz7CBVDALZG7b4hC5isPm9hf70maxuw0iEgT1guZhJYYvbGFVey8bR9I6IVftjXKXm 6MZw== 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=5Yj/XvFLoTKPoAfaLaRz8qbNSbPbOFb4IFK3vAL5tQg=; fh=r1cPj2GlTGSV4V8jQu3jfCKsZwpJ5ktYEUy+P7GD/+s=; b=F9svPWaBJdyAJFcyeJn7VbiRI8N2gXhbn7cNt51WKvWSqVrakBDjiPZPKsV8XQffSK kEC8uDTxLm2JgdXT+Czl7pAGeBOutkzFllYXuRIyrzrFjhIEtPJUV5KQOn1dtuIavfcu aNIUtCJt4GCGnow8rG2GZcHcEzCD20JbweqLqpGojqR37uZAHMJ7v+1mAIVW3vqbXp3v GdIfsKTnhIzyrLbQTk3Zf0L8JKwkU+J6ia14ZJMBgjBIWAGveshxblrvxtKxCgckTpaI iVDRQXKYFehjLm8POSZ0BrcP9PCr4oZzZc7Ygjvin2twoGP9nDBJR36Y1fUWGOOZqFvb OlEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XABPTiZ9; 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 w1-20020a05622a134100b0040fd98ecce5si1615978qtk.716.2023.08.31.19.25.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Aug 2023 19:25:43 -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=XABPTiZ9; 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 1qbtpA-0006Zb-Hu; Thu, 31 Aug 2023 22:23:52 -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 1qbtp9-0006Yn-7M for qemu-devel@nongnu.org; Thu, 31 Aug 2023 22:23:51 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbtp7-0001R3-0f for qemu-devel@nongnu.org; Thu, 31 Aug 2023 22:23:50 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-68a3082c771so989200b3a.0 for ; Thu, 31 Aug 2023 19:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693535027; x=1694139827; 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=5Yj/XvFLoTKPoAfaLaRz8qbNSbPbOFb4IFK3vAL5tQg=; b=XABPTiZ9amEnC07HAYUgC9z/MKERp6xwPFWTxjDg63bNaxUuUpS0BK/CXZlqqQE1hL V4loRxxi5UfALemjcj9gUrNubFE2HwhHTa+epL8SWhFffqlgPTbCoWwQgfBR9iyBpLpU rw3m6/QZhVfeaYLrxc3q5pmOM2etpj4iidhxejJybtBAjnfS0C97j17zDT3cJqpHocSj +AtN5LvHDjXDPKj5xXRS5kM7jcymsH7+8ZgEUa4bhBr8s1Ult6wyLbPHJevDGcuEngzY pMfp5oaF3R1Gi3SJkOyjICDO1/zG9XIUXtSAnGVmZuYDJKgZImMdrr8YzTyZBEoDxhWe +xbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693535027; x=1694139827; 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=5Yj/XvFLoTKPoAfaLaRz8qbNSbPbOFb4IFK3vAL5tQg=; b=Sj5FpyQVV/+Ss62EbaDjkKV/GJOo1zJmb9SOBH+GU55n/PX/E9eBx0oGn80xyS3We6 HZb5mc8bxclo5YGavj17WyQbXp4/E6I0coqkl1TH9BfJooYZykUCJyHbjyDLjVokbfwN k3dfwnYKYdO2zvrFiELkjM0FBggnGhQ63afnUyoClkei7o42RCpaTwoD4biOk5CHnMga Eg/Y2Iz6UNke0F8+LsASe0Re0hie7bdvWbcA6TlE5XzY8wsm0Eb80uTvoppcppDQUM6g r8D9moSQac0ylo7pVmK+0lwf8XsgK9nUihaa6K4ao/XvhDP+pchdRenxFr0HTJO9RKp1 BFqg== X-Gm-Message-State: AOJu0Yz2Lzgo/tvZ/INIu6jaFQNxnmUxZsRoiYCjKF8eR82QjtKcziBc KVJx3mo7GvM2ZLiv6o7TiCC8d0jvCSPh9K/Mawc= X-Received: by 2002:a05:6a00:21c5:b0:68a:6734:b018 with SMTP id t5-20020a056a0021c500b0068a6734b018mr1750624pfj.15.1693535027597; Thu, 31 Aug 2023 19:23:47 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id c25-20020aa781d9000000b0068a54866ca8sm1906977pfn.134.2023.08.31.19.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 19:23:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, alex.bennee@linaro.org Subject: [PATCH v2 18/33] linux-user: Fix sub-host-page mmap Date: Thu, 31 Aug 2023 19:23:16 -0700 Message-Id: <20230901022331.115247-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901022331.115247-1-richard.henderson@linaro.org> References: <20230901022331.115247-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 We cannot skip over the_end1 to the_end, because we fail to record the validity of the guest page with the interval tree. Remove "the_end" and rename "the_end1" to "the_end". Signed-off-by: Richard Henderson --- linux-user/mmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 85d16a29c1..e905b1b8f2 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -599,7 +599,7 @@ static abi_long target_mmap__locked(abi_ulong start, abi_ulong len, target_prot, flags, fd, offset)) { return -1; } - goto the_end1; + goto the_end; } if (!mmap_frag(real_start, start, real_start + host_page_size - 1, @@ -646,7 +646,7 @@ static abi_long target_mmap__locked(abi_ulong start, abi_ulong len, passthrough_last = real_last; } } - the_end1: + the_end: if (flags & MAP_ANONYMOUS) { page_flags |= PAGE_ANON; } @@ -663,7 +663,6 @@ static abi_long target_mmap__locked(abi_ulong start, abi_ulong len, page_set_flags(passthrough_last + 1, last, page_flags); } } - the_end: trace_target_mmap_complete(start); if (qemu_loglevel_mask(CPU_LOG_PAGE)) { FILE *f = qemu_log_trylock();