From patchwork Sun Apr 15 14:39:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 152614 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DD8F3B6FFE for ; Mon, 16 Apr 2012 00:40:16 +1000 (EST) Received: from localhost ([::1]:43163 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJQcd-0007xF-3E for incoming@patchwork.ozlabs.org; Sun, 15 Apr 2012 10:40:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJQcW-0007wM-8L for qemu-devel@nongnu.org; Sun, 15 Apr 2012 10:40:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJQcU-0007E8-9o for qemu-devel@nongnu.org; Sun, 15 Apr 2012 10:40:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56318 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJQcU-0007Ba-3a for qemu-devel@nongnu.org; Sun, 15 Apr 2012 10:40:02 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 71A0A8FC92; Sun, 15 Apr 2012 16:40:00 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 15 Apr 2012 16:39:56 +0200 Message-Id: <1334500796-25306-1-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Peter Maydell , Riku Voipio , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH] linux-user: Fix exit syscall with QOM CPU 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 For QOM'ified CPUs we cannot g_free() CPUArchState, we must object_delete() the object it is embedded into. Should fix LP#982321 (invalid free() while executing pacman w/qemu-arm). Reported-by: Serge Schneider Signed-off-by: Andreas Färber Cc: Peter Maydell Reviewed-by: Peter Maydell --- linux-user/syscall.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8a92162..7128618 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5045,7 +5045,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, NULL, NULL, 0); } thread_env = NULL; +#ifdef ENV_GET_CPU + object_delete(OBJECT(ENV_GET_CPU(cpu_env))); +#else g_free(cpu_env); +#endif g_free(ts); pthread_exit(NULL); }