From patchwork Thu Sep 22 12:13:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 76751 Delivered-To: patch@linaro.org Received: by 10.140.21.80 with SMTP id 74csp7393qgk; Thu, 22 Sep 2016 05:21:22 -0700 (PDT) X-Received: by 10.55.31.85 with SMTP id f82mr1690486qkf.213.1474546882376; Thu, 22 Sep 2016 05:21:22 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n31si923621qtd.154.2016.09.22.05.21.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:21:22 -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; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn30D-0004WH-OD for patch@linaro.org; Thu, 22 Sep 2016 08:21:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2uC-0008Jr-Vz for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn2u7-0006SY-WA for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:07 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:33155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2u7-0006S1-Os for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:03 -0400 Received: by mail-lf0-f48.google.com with SMTP id b71so38932294lfg.0 for ; Thu, 22 Sep 2016 05:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PeHgrSHpE8Uc5Rwsm1xq5Pz2DVih8DVQkxsJlDsTJYo=; b=VJd8Q/K6RMAHSxyHIyGNcttCHrSqq8HjmxB6EPNeCrx40ltW2FszQ45xvajYCCP+oO M2jbnJbdyyEPtsNWKHDzq5hcRzy4E+hlpRFY/uM4bm1O+3K8/88qm0CiYepwBIdxBD6y jg0WLt45Uk5/uvKT5+qlndMg0+m1+RCikf3sY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PeHgrSHpE8Uc5Rwsm1xq5Pz2DVih8DVQkxsJlDsTJYo=; b=by/PHjT2WHkrWCrcEsXXU7nIOB1Zfzzxk08VKwo6glzX7FqNCaMsX1xAe3uZm7ld0n RT6fyPvSVkpjVibW91UwidzPlTj2EErciAO2G/x0HcDzltOUAiQbXt7wKrq7o7hj0f1P so9kLFR2U2f5WBpN3vhK8E/bTDOpImgdygI0lyYeCYpUmkI5jjgy2cXCpFf0KsufOBLZ r2/ghGH0VfRcSp9+yX2HjzOtYlzQAizYCYKTmutplBccptXsrJxwR3TeAkFwU7+yhmva wHsrxCaoHfk0didKV+pTk49ZqTtINI7PfxWDAHc50/yJY0Sd9tFgeqPBWF9zgIvHRJyJ TPcg== X-Gm-Message-State: AE9vXwOq/fcTG8BEv3cUqjxBmm2idxJJHRXAjwZYsQWraVwva0R0kl/y191FkYE28oiMGe9M X-Received: by 10.25.23.68 with SMTP id n65mr796622lfi.150.1474546442745; Thu, 22 Sep 2016 05:14:02 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id u14sm294378lja.11.2016.09.22.05.14.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:14:01 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Thu, 22 Sep 2016 15:13:29 +0300 Message-Id: <68754b442b756e8cb5f143b00937fb7330a51a81.1474546244.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 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.48 Subject: [Qemu-devel] [PULL 09/26] linux-user: Pass missing MAP_ANONYMOUS to target_mmap() call 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: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell A target_mmap() call in load_elf_binary() was missing the MAP_ANONYMOUS flag. (Spotted by Coverity, because target_mmap() will try to use -1 as the filedescriptor in this case.) This has never been noticed because the code in question is for handling ancient SVr4 iBCS2 binaries. Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 29455e4..e9a3882 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2233,7 +2233,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) we do not have the power to recompile these, we emulate the SVr4 behavior. Sigh. */ target_mmap(0, qemu_host_page_size, PROT_READ | PROT_EXEC, - MAP_FIXED | MAP_PRIVATE, -1, 0); + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); } }