From patchwork Sat Jun 29 09:41:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=BCrg_Billeter?= X-Patchwork-Id: 255739 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F2B212C0082 for ; Sun, 30 Jun 2013 00:03:17 +1000 (EST) Received: from localhost ([::1]:53128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsvkA-0003Is-Dv for incoming@patchwork.ozlabs.org; Sat, 29 Jun 2013 10:03:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Usrhn-000590-5o for qemu-devel@nongnu.org; Sat, 29 Jun 2013 05:44:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Usrhk-0001xB-8g for qemu-devel@nongnu.org; Sat, 29 Jun 2013 05:44:31 -0400 Received: from cpanel09.rubas.ch ([195.182.222.79]:43342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Usrhj-0001wo-Vh for qemu-devel@nongnu.org; Sat, 29 Jun 2013 05:44:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bitron.ch; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=4GCXfzpgNvsoHBT59Hi4OBFXjVnvrxpXi+HafKGTE2A=; b=Crhp8UtmTZ8Dgt9PTjEqpjSIyaIU4qZJRRQdOdVM/9MuHgGhqjg23qkwLzoGtP0/WADDVok96yFTJVu/4v9kCuCbgpvdW7veUrQNNZb0xZr/uJY9HRru+ptpHj8ZYHCW; Received: from 77-58-108-244.dclient.hispeed.ch ([77.58.108.244]:43696 helo=jivy.bitron.ch) by cpanel09.rubas.ch with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80.1) (envelope-from ) id 1Usrhe-002jN6-Gg; Sat, 29 Jun 2013 11:44:24 +0200 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= To: qemu-devel@nongnu.org Date: Sat, 29 Jun 2013 11:41:32 +0200 Message-Id: <1372498892-23676-1-git-send-email-j@bitron.ch> X-Mailer: git-send-email 1.8.2.3 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel09.rubas.ch X-AntiAbuse: Original Domain - nongnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - bitron.ch X-Get-Message-Sender-Via: cpanel09.rubas.ch: authenticated_id: juerg@bitron.ch X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.182.222.79 X-Mailman-Approved-At: Sat, 29 Jun 2013 10:02:36 -0400 Cc: =?UTF-8?q?J=C3=BCrg=20Billeter?= , Riku Voipio Subject: [Qemu-devel] [PATCH] linux-user: Do not ignore mmap failure from host X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org File mapping may fail with EACCES. Signed-off-by: Jürg Billeter Reviewed-by: Peter Maydell --- linux-user/mmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index b412e3f..de22197 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -483,6 +483,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, if (!(flags & MAP_ANONYMOUS)) { p = mmap(g2h(start), len, prot, flags | MAP_FIXED, fd, host_offset); + if (p == MAP_FAILED) { + munmap(g2h(start), host_len); + goto fail; + } host_start += offset - host_offset; } start = h2g(host_start);