From patchwork Mon Jan 11 14:16:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 565892 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 134AC1402DE for ; Tue, 12 Jan 2016 01:20:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=YUEZMDMs; dkim-atps=neutral Received: from localhost ([::1]:54500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIdL4-0004DL-RI for incoming@patchwork.ozlabs.org; Mon, 11 Jan 2016 09:20:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIdH1-0004pz-0k for qemu-devel@nongnu.org; Mon, 11 Jan 2016 09:16:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIdGv-0002B4-4M for qemu-devel@nongnu.org; Mon, 11 Jan 2016 09:16:42 -0500 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:34203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIdGu-0002At-U7 for qemu-devel@nongnu.org; Mon, 11 Jan 2016 09:16:37 -0500 Received: by mail-lf0-x234.google.com with SMTP id 17so11993159lfz.1 for ; Mon, 11 Jan 2016 06:16:36 -0800 (PST) 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=8sas+bZV9RJkb2WtaD53qwaC1S+H8OTnGukqxlIKQpU=; b=YUEZMDMs62vVH4JNDFDNJpnwAY01r+a9O1sonELZLnxrsqW72hVe41BsBj9ZL8gs6w YVkkJ9s/vfS0s4wF7t1v5MeO8Qfq08xwXgjtSwkfn/9SK3yWpL35F3hvtJcIN8YZ/Fd0 3cQj0ucux+r5Ml7cV3pKtcOT4j5RyqAL4ZFn8= 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=8sas+bZV9RJkb2WtaD53qwaC1S+H8OTnGukqxlIKQpU=; b=glyMslBNQDuya+wwcuJ0fppHy8CLpIdJL1j3UX6iysks7uFwAtODcg/LdDXMwsBOEM 6W/Wh6Kjefh9E5Q9xwGtdmBgLEq6dAKHT8IW+40mnjc2l2M8qHp4QlNFToXfftRH0YwU 3L7V3DvmGyWEjaRQN9ouNJdATt95Odfd+ECHuRnN6Q70bZr9jMx8/OyBA9iohQzrP9ku bTGL0mgB85ir98E33Z3DZnpvmSSVmctcWvw64UGFCYeC0ZgjAZb6nD1MekB+0hITmQPV 7GjASBnqQRaafw4pv172lhuWh0W0Sw1ELcF1kUPHUFP5XgWuB1ZaPPG0/Kky+WAu2J8T iObg== X-Gm-Message-State: ALoCoQmGlfa2zJmDTKB5SBEwv/jVGw6CUCJLOWuDkygE/bCgI15I/cXXmyn8pUsZ0421h6elVU2FDfCWGOaOs7otJwoUbuuaJA== X-Received: by 10.25.83.193 with SMTP id h184mr26124685lfb.6.1452521796380; Mon, 11 Jan 2016 06:16:36 -0800 (PST) Received: from localhost.localdomain (91-157-175-207.elisa-laajakaista.fi. [91.157.175.207]) by smtp.gmail.com with ESMTPSA id 130sm16806735lff.31.2016.01.11.06.16.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 06:16:35 -0800 (PST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 11 Jan 2016 16:16:13 +0200 Message-Id: X-Mailer: git-send-email 2.6.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::234 Cc: Chen Gang Subject: [Qemu-devel] [PULL 11/17] linux-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag() 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 From: Chen Gang When mapping MAP_ANONYMOUS memory fragments, still need notice about to set it zero, or it will cause issues. Signed-off-by: Chen Gang Reviewed-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/mmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 7b459d5..c6c478e 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -186,10 +186,12 @@ static int mmap_frag(abi_ulong real_start, if (prot_new != (prot1 | PROT_WRITE)) mprotect(host_start, qemu_host_page_size, prot_new); } else { - /* just update the protection */ if (prot_new != prot1) { mprotect(host_start, qemu_host_page_size, prot_new); } + if (prot_new & PROT_WRITE) { + memset(g2h(start), 0, end - start); + } } return 0; }