From patchwork Wed Aug 12 17:08:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11711055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B779913B1 for ; Wed, 12 Aug 2020 17:09:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 385BA2076C for ; Wed, 12 Aug 2020 17:09:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 385BA2076C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5uFh-0004Mg-0N for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Aug 2020 13:09:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5uFB-0003Zt-ES for qemu-devel@nongnu.org; Wed, 12 Aug 2020 13:08:53 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:49930) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5uF9-00087X-Nl for qemu-devel@nongnu.org; Wed, 12 Aug 2020 13:08:53 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-Ohzv5scsMoO6xPKv7ph-cA-1; Wed, 12 Aug 2020 13:08:46 -0400 X-MC-Unique: Ohzv5scsMoO6xPKv7ph-cA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BA6180183C; Wed, 12 Aug 2020 17:08:44 +0000 (UTC) Received: from bahia.lan (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id B71FF1014160; Wed, 12 Aug 2020 17:08:42 +0000 (UTC) Subject: [PATCH v2 0/2] spapr/nvram: Fix QEMU crash From: Greg Kurz To: Thomas Huth Date: Wed, 12 Aug 2020 19:08:41 +0200 Message-ID: <159725212173.104309.6136813383848717434.stgit@bahia.lan> User-Agent: StGit/0.21 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=207.211.30.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/12 13:08:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , qemu-devel@nongnu.org, Laurent Vivier , qemu-ppc@nongnu.org, John Snow , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This series fixes the following crash: $ qemu-system-ppc64 -M pseries $(for ((x=0;x<128;x++)); do \ echo -n " -prom-env "$(for ((y=0;y<1024;y++)); do echo -n x ; done) ; \ done) # this requires ~128 Kib malloc(): corrupted top size Aborted (core dumped) This also affects g3beige and mac99 machine types, and probably some sparc/sparc64 machine types as well, but I prefer to leave the fixing to knowledgeable people. v2: - error out instead of increasing the partition size for the sake of migration (Laurent) - Cc'ing John Snow who reported the issue --- Greg Kurz (2): nvram: Add dry_run argument to chrp_nvram_create_system_partition() spapr/nvram: Error out if NVRAM cannot contain all -prom-env data hw/nvram/chrp_nvram.c | 34 +++++++++++++++++++++++----------- hw/nvram/mac_nvram.c | 2 +- hw/nvram/spapr_nvram.c | 18 +++++++++++++++++- hw/sparc/sun4m.c | 2 +- hw/sparc64/sun4u.c | 2 +- include/hw/nvram/chrp_nvram.h | 3 ++- 6 files changed, 45 insertions(+), 16 deletions(-) -- Greg