From patchwork Fri Oct 2 13:01:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 54436 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 03AFF23009 for ; Fri, 2 Oct 2015 13:50:52 +0000 (UTC) Received: by lbbti1 with SMTP id ti1sf16827317lbb.3 for ; Fri, 02 Oct 2015 06:50:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Wmmp9V36E/sSDiK7hEuuxLAHlevg1DgHEuOeEjP2E2o=; b=COhsAiM1JuBvw/n2FOkXVT1QV5lVhSnf8RmkQsAC6GnysZoCLSPqPCVmAppbSdwvSw ZG7GwWlYuV0zQdfXX5H09XrfmwdgrMvDzA7Hs2UsFQmdg3pJumcTN1ApWb6t071D0ctC XVDXpI/0OQflu1jESE2msiQphOdi7iJtg0WADPEe6evfwVPJAQKCgNaZe+TKvd+zH4Aw Qte+Msv+5/ykYzPBuzYa3g0ywWqBEuEsROZimm6hp/Uqyxt+TFwJqiV7P6k8KXi9iSUL F9dtUdteVNm01uLGB79ndgThg7tHENdysf9Jzm5tLmpZ+qUOc0kU+1dDbjAPMr0qprNC uuNg== X-Gm-Message-State: ALoCoQkBm9Si5OIDXS0QBUqwCOPOSoWnYVS/3RYFMwwdFbgl4is6N6qFpLwRtHlOyK4613QKVrou X-Received: by 10.180.188.211 with SMTP id gc19mr976612wic.6.1443793850833; Fri, 02 Oct 2015 06:50:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.21.96 with SMTP id l93ls236947lfi.20.gmail; Fri, 02 Oct 2015 06:50:50 -0700 (PDT) X-Received: by 10.112.77.197 with SMTP id u5mr4505621lbw.120.1443793850677; Fri, 02 Oct 2015 06:50:50 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id sm5si6296094lbb.88.2015.10.02.06.50.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 06:50:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by laclj5 with SMTP id lj5so92865304lac.3 for ; Fri, 02 Oct 2015 06:50:50 -0700 (PDT) X-Received: by 10.25.86.213 with SMTP id k204mr3742867lfb.36.1443793850560; Fri, 02 Oct 2015 06:50:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1258282lbq; Fri, 2 Oct 2015 06:50:47 -0700 (PDT) X-Received: by 10.140.135.202 with SMTP id 193mr21390589qhh.3.1443793847635; Fri, 02 Oct 2015 06:50:47 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k197si10353034qhk.19.2015.10.02.06.50.47 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 02 Oct 2015 06:50:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:59952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi0jX-00037E-6G for patch@linaro.org; Fri, 02 Oct 2015 09:50:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhzxo-0005Vh-MU for qemu-devel@nongnu.org; Fri, 02 Oct 2015 09:01:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zhzxk-0000h2-4H for qemu-devel@nongnu.org; Fri, 02 Oct 2015 09:01:28 -0400 Received: from mail-la0-f46.google.com ([209.85.215.46]:36545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhzxj-0000gm-Tm for qemu-devel@nongnu.org; Fri, 02 Oct 2015 09:01:24 -0400 Received: by laclj5 with SMTP id lj5so92038772lac.3 for ; Fri, 02 Oct 2015 06:01:23 -0700 (PDT) X-Received: by 10.112.150.201 with SMTP id uk9mr5511964lbb.102.1443790883202; Fri, 02 Oct 2015 06:01:23 -0700 (PDT) Received: from localhost.localdomain (91-157-196-38.elisa-laajakaista.fi. [91.157.196.38]) by smtp.gmail.com with ESMTPSA id w143sm1514751lfd.2.2015.10.02.06.01.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Oct 2015 06:01:22 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 2 Oct 2015 16:01:05 +0300 Message-Id: <86abac06c142d20772b3f2e04c9bf02b7936a0b3.1443790691.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.5.3 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.46 Cc: Paolo Bonzini Subject: [Qemu-devel] [PULL 13/13] linux-user: assert that target_mprotect cannot fail 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Paolo Bonzini All error conditions that target_mprotect checks are also checked by target_mmap. EACCESS cannot happen because we are just removing PROT_WRITE. ENOMEM should not happen because we are modifying a whole VMA (and we have bigger problems anyway if it happens). Fixes a Coverity false positive, where Coverity complains about target_mprotect's return value being passed to tb_invalidate_phys_range. Signed-off-by: Paolo Bonzini Signed-off-by: Riku Voipio --- linux-user/mmap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index b2126c7..5606bcd 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -514,10 +514,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, goto fail; if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); - if (ret != 0) { - start = ret; - goto the_end; - } + assert(ret == 0); } goto the_end; }