From patchwork Tue Jun 19 07:58:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang Zheng X-Patchwork-Id: 10473667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A864601D7 for ; Tue, 19 Jun 2018 08:00:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2754422A68 for ; Tue, 19 Jun 2018 08:00:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C02128B26; Tue, 19 Jun 2018 08:00:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B633722A68 for ; Tue, 19 Jun 2018 08:00:30 +0000 (UTC) Received: from localhost ([::1]:39903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVBYz-0000JZ-7P for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jun 2018 04:00:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVBY3-00086q-GJ for qemu-devel@nongnu.org; Tue, 19 Jun 2018 03:59:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVBY2-0008Jv-QG for qemu-devel@nongnu.org; Tue, 19 Jun 2018 03:59:31 -0400 Received: from [45.249.212.35] (port=43844 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVBXw-0008GH-Gp; Tue, 19 Jun 2018 03:59:24 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 73B90CEECB070; Tue, 19 Jun 2018 15:59:15 +0800 (CST) Received: from HGHY1z004218071.china.huawei.com (10.177.29.32) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.382.0; Tue, 19 Jun 2018 15:59:09 +0800 From: Zheng Xiang To: , Date: Tue, 19 Jun 2018 15:58:21 +0800 Message-ID: <20180619075821.9884-1-zhengxiang9@huawei.com> X-Mailer: git-send-email 2.15.1.windows.2 MIME-Version: 1.0 X-Originating-IP: [10.177.29.32] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 45.249.212.35 Subject: [Qemu-devel] [PATCH] target-arm: fix a segmentation fault due to illegal memory access 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@linaro.org, Zheng Xiang , zhaoshenglong@huawei.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zheng Xiang The elements of kvm_devices_head list are freed in kvm_arm_machine_init_done(), but we still access these illegal memory in kvm_arm_devlistener_del(). This will cause segment fault when booting guest with MALLOC_PERTURB_=1. Signed-off-by: Zheng Xiang --- target/arm/kvm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 98f5006..5bf41e1 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -256,6 +256,7 @@ static void kvm_arm_machine_init_done(Notifier *notifier, void *data) kvm_arm_set_device_addr(kd); } memory_region_unref(kd->mr); + QSLIST_REMOVE_HEAD(&kvm_devices_head, entries); g_free(kd); } memory_listener_unregister(&devlistener);