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: 673335 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sfwYl5Gx8z9t0p for ; Thu, 22 Sep 2016 22:20:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=VJd8Q/K6; dkim-atps=neutral Received: from localhost ([::1]:43040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2zH-0004WH-Hi for incoming@patchwork.ozlabs.org; Thu, 22 Sep 2016 08:20:23 -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+incoming=patchwork.ozlabs.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(-) 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); } }