From patchwork Wed Aug 29 07:52:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 11014 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4EE3623E29 for ; Wed, 29 Aug 2012 07:52:48 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 55911A186AD for ; Wed, 29 Aug 2012 07:52:16 +0000 (UTC) Received: by iafj25 with SMTP id j25so527504iaf.11 for ; Wed, 29 Aug 2012 00:52:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=335L/fpTUBbcqlpvciGwiu/EaEfPadUqq73CzQUnpHU=; b=OeTjfjxf5NG7iHLL0impalvZ11U8pCDRndkmqjPVYIR/y8N/gt8CDnOe0n+XCij/YE cTDY6a+LK5JnEPcCqLrrODCCkq8y4iQsAYeVx+XnqXMEoJgk0U1YQK1L3BR0GOh0Ze4o S1PPoOPBxrYKcQzzz0DXderKBAIUqfQUGCVojoEUwRpE+w17TVDmibglQkLdOT3qPzRC +lLXYb34NsG5JMsZDLJ1V1NklDl1dRH6DlfFgg6ZYs+O6NMNF6XakpqlcmnbWNXK9fO0 cf+zHNI7klm7f8QatGyHCbfPriRSukOY0UMndtbEKhBmP98Y+X7GUoJ/7j9PB8qWfPps Mfsw== Received: by 10.50.159.196 with SMTP id xe4mr16334232igb.43.1346226767294; Wed, 29 Aug 2012 00:52:47 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp71521igc; Wed, 29 Aug 2012 00:52:46 -0700 (PDT) Received: by 10.14.215.197 with SMTP id e45mr778877eep.36.1346226765403; Wed, 29 Aug 2012 00:52:45 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id f45si15663581eep.9.2012.08.29.00.52.44 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Aug 2012 00:52:45 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1T6d4n-0006V9-Fd; Wed, 29 Aug 2012 08:52:37 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Adam Lackorzynski , Stefan Weil , Anthony Liguori Subject: [PATCH for-1.2] hw/arm_gic.c: Define .class_size in arm_gic_info TypeInfo Date: Wed, 29 Aug 2012 08:52:37 +0100 Message-Id: <1346226757-24968-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQkN7tU1oJfMxzdVI7bbl4a96ZiTiHxx2k4mfzVQmoSZnJA3uNVC6BLmvvUpSBgJmDwWRSVj Add the missing .class_size definition to the arm_gic_info TypeInfo. This fixes the memory corruption and possible segfault that otherwise results when the class struct is allocated at too small a size and the class init function writes off the end of it. Reported-by: Adam Lackorzynski Signed-off-by: Peter Maydell --- Oops. I suspect this only crashes on 32 bit hosts because the class is only one field larger than its subclass, so on 64 bit systems we are probably only overwriting padding rather than anything important. For 1.2 since it fixes a segfault. hw/arm_gic.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/arm_gic.c b/hw/arm_gic.c index 186ac66..55871fa 100644 --- a/hw/arm_gic.c +++ b/hw/arm_gic.c @@ -703,6 +703,7 @@ static TypeInfo arm_gic_info = { .parent = TYPE_ARM_GIC_COMMON, .instance_size = sizeof(gic_state), .class_init = arm_gic_class_init, + .class_size = sizeof(ARMGICClass), }; static void arm_gic_register_types(void)