From nobody Mon Feb 9 23:01:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529374250152468.3166734437275; Mon, 18 Jun 2018 19:10:50 -0700 (PDT) Received: from localhost ([::1]:38515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV66b-0003WH-D9 for importer@patchew.org; Mon, 18 Jun 2018 22:10:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5he-0001EY-I4 for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5ha-00088Z-9c for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:02 -0400 Received: from mail-ot0-x22b.google.com ([2607:f8b0:4003:c0f::22b]:35248) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5ha-00088E-4P; Mon, 18 Jun 2018 21:44:58 -0400 Received: by mail-ot0-x22b.google.com with SMTP id q17-v6so20776826otg.2; Mon, 18 Jun 2018 18:44:57 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id z21-v6sm7388294otk.20.2018.06.18.18.44.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+tWXsKkgd9dwTNsOa+deYgnfMNYxKlK9ZP2XKR/YLy8=; b=Bj5Plx6htVFPVZWiE19crwLloEyngWXBNFDisnl36rO+45ooL8RrUyFAC9xHnAG/e4 muQjRt/upmWnvIYeh/09RTXO/psUgrtQRNPbVPJCRryP6m2QET3GykgSBp+N66xAJ4TB STSsmQnadBJNBeM9u6tVuHrEHZ5eJlgR21gV6SVgTw+JHJEHfDRVbMR643/5+e7ZaLWq ZuMDFZXwqkeZUPlJ7UivIwEO05L8XSZBn0QfwXrykVKYPMHkFebvgMbcnNyyAcIAfaFs Zl7ltvOcr46rh01AJ+xU6rHpCMw+UlW5AiKbtyL6zE+OLvSPKvy7weIWXupDJ3EOxRX8 /kjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+tWXsKkgd9dwTNsOa+deYgnfMNYxKlK9ZP2XKR/YLy8=; b=hq5+9dLppf2Tu4zS0aF94QaCQjH5QCmT13n8z9ITHsyq/T9a3gFUMY3OuFZjDlRJEm o/CGyP9nfiwi9R6AQ9ToolPJiRvkHtXxh/vGZf5FOZi7ZWg8sAOTRmzcgAihv7CS9I12 M5uRFKu5V8x97tl/krFB4pi0M7XeLZmhDZQg5fxdy3oLwqYGIEQ2fu9Z+0L71nsFXSRf qPHLNzz4Fuihkn6Sv4IGlBGXoRU3oSqFll+ovD96S2vmzaJOoX5mB0R/5eJu3SEU6juP 299eBLHdoLguQM64sF+Wxdud5wUCawNy072PGeC7dHMnDU090YH8cf+cihhbTM1FZcBP U4aQ== X-Gm-Message-State: APt69E0Ph+pqT0n+qBphhM0csWXSIvORvkblyXN6/YnNBalDPlB2yK0Q CLacsLGX7RQb8ZUj8aJ96JXUszG1 X-Google-Smtp-Source: ADUXVKJZ7D8QKMjvHQvCgADZAbCupArEuKmsP0HlfB1ABS7DTebD65cy0CLqwWYJE2LRhWSyLTCbWA== X-Received: by 2002:a9d:6385:: with SMTP id w5-v6mr9760231otk.233.1529372696834; Mon, 18 Jun 2018 18:44:56 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:41:51 -0500 Message-Id: <20180619014319.28272-26-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::22b Subject: [Qemu-devel] [PATCH 025/113] linux-user: fix target_mprotect/target_munmap error return values X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov , Riku Voipio , qemu-stable@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Max Filippov target_mprotect/target_munmap return value goes through get_errno at the call site, thus the functions must either set errno to host error code and return -1 or return negative guest error code. Do the latter. Cc: qemu-stable@nongnu.org Cc: Riku Voipio Cc: Laurent Vivier Signed-off-by: Max Filippov Reviewed-by: Laurent Vivier Message-Id: <20180228221609.11265-8-jcmvbkbc@gmail.com> Signed-off-by: Laurent Vivier (cherry picked from commit 78cf339039c325b336442f1d7f3ccc531b22c4a0) Signed-off-by: Michael Roth --- linux-user/mmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 33a73cd29c..e0c946eae6 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -77,11 +77,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, int= prot) #endif =20 if ((start & ~TARGET_PAGE_MASK) !=3D 0) - return -EINVAL; + return -TARGET_EINVAL; len =3D TARGET_PAGE_ALIGN(len); end =3D start + len; if (!guest_range_valid(start, len)) { - return -ENOMEM; + return -TARGET_ENOMEM; } prot &=3D PROT_READ | PROT_WRITE | PROT_EXEC; if (len =3D=3D 0) @@ -621,10 +621,10 @@ int target_munmap(abi_ulong start, abi_ulong len) start, len); #endif if (start & ~TARGET_PAGE_MASK) - return -EINVAL; + return -TARGET_EINVAL; len =3D TARGET_PAGE_ALIGN(len); if (len =3D=3D 0 || !guest_range_valid(start, len)) { - return -EINVAL; + return -TARGET_EINVAL; } =20 mmap_lock(); --=20 2.11.0