From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.groups.io (mail04.groups.io [45.79.224.9]) by spool.mail.gandi.net (Postfix) with ESMTPS id B86717803D7 for ; Mon, 15 Apr 2024 19:47:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=qlOpnwCol/JzqeWKohUwWTH/NsxMS9Rp/wd7QS/D/XU=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20240206; t=1713210429; v=1; b=5ZiG3UgXAC4AO/UiYOh/JtpIQwC5khLwhuF6YzRdSCLNeLiYAbWssJsMv1mEH2l1MWSSTDKe s6di4ubsnr3rZmFcb5tKu1wFKrE0FmTP1iZ5WP8MeOk0qpRW+LwHPpGzpo+m6+AxTYNmm7GFAAB DHdlKGeCejA8R9U3gjEzD8PXOyMeVOIr3gs2w+Dgz2wxnOQ/4g67RBgLkB78hRrk1dukaUZyb+n PT09wWDN/FHXzhm5kd6mp/VL+72jarMp/d7m+414RQSyIUHv/8LC6OW22v7f4CTkz5LxuKrQZL5 DnxszTflPGhvSnUS0O6sbprtLUj0m29E42sfq+1Fo2VXQ== X-Received: by 127.0.0.2 with SMTP id 4GHAYY7687511xKpAYwbkoCO; Mon, 15 Apr 2024 12:47:09 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.2423.1713210428527527817 for ; Mon, 15 Apr 2024 12:47:08 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-232-EWi81L-8Mb2qIjWnQkuxNw-1; Mon, 15 Apr 2024 15:47:04 -0400 X-MC-Unique: EWi81L-8Mb2qIjWnQkuxNw-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DF53A1887314; Mon, 15 Apr 2024 19:47:03 +0000 (UTC) X-Received: from osteffen-laptop.redhat.com (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BFBA40C6CC0; Mon, 15 Apr 2024 19:46:59 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: Oliver Steffen , Bob Feng , Gerd Hoffmann , Jiewen Yao , Laszlo Ersek , Liming Gao , Rahul Kumar , Rebecca Cran , Yuwei Chen Subject: [edk2-devel] [PATCH v2 0/1] MdeModulePkg: Warn if out of space when writing variables Date: Mon, 15 Apr 2024 21:46:36 +0200 Message-ID: <20240415194637.276959-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 15 Apr 2024 12:47:08 -0700 Resent-From: osteffen@redhat.com Reply-To: devel@edk2.groups.io,osteffen@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 8WRRonO1hI8y8qk9sBAArAezx7686176AA= Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=5ZiG3UgX; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.9 as permitted sender) smtp.mailfrom=bounce@groups.io Emit a DEBUG_ERROR message if there is not enough space left to write/update a variable. This condition is currently not logged appropriately in all cases, given that full variable store can easily render the system unbootable. This new message helps identifying this condition quickly. Background: We had the case where an OVMF based VM ran out of flash space after a large number of reboots and hardware configuration changes. The MAC address of the NIC was changing a lot over the life time of the VM. The variable store was consumed entirely by networking related non-volatile variables, written for each network card/MAC address present during boot. Almost all of those were obsolete, of course, but the error that presented itself at first was a VM that failed to boot the firmware and ended up in an rather cryptic ASSERT message. The hope is that this new message makes it easier for non-experts to diagnose the situation. The root cause is of course not addressed by this, but it might also be hard to solve. One would have to identify obsolete network/hardware settings somehow, but there is no way to tell if a certain NIC/MAC might come back at a later point or not. Launching OVMF with a full variable store then looks like this (Debug Output): [...] CommonVariableSpace = 0x3FF9C - CommonVariableTotalSize = 0x3FF60 UpdateVariable failed: Out of variable space Select Item: 0xE Select Item: 0x19 RecordVarErrorFlag (0xEF) Timeout:8BE4DF61-93CA-11D2-AA0D-00E098032B8C - 0x00000007 - 0x4E CommonVariableSpace = 0x3FF9C - CommonVariableTotalSize = 0x3FF60 UpdateVariable failed: Out of variable space PlatformBootManagerBeforeConsole: SetVariable(Timeout, 3): Out of Resources RecordVarErrorFlag (0xEF) BootOrder:8BE4DF61-93CA-11D2-AA0D-00E098032B8C - 0x00000007 - 0x52 CommonVariableSpace = 0x3FF9C - CommonVariableTotalSize = 0x3FF60 UpdateVariable failed: Out of variable space ASSERT_EFI_ERROR (Status = Out of Resources) ASSERT OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c(361): !(((INTN)(RETURN_STATUS)(Status)) < 0) PR: https://github.com/tianocore/edk2/pull/5435 Changes since v1: - Mention "variable space" instead of "flash space" - Emit DEBUG_ERROR instead of DEBUG_WARN Cc: Bob Feng Cc: Gerd Hoffmann Cc: Jiewen Yao Cc: Laszlo Ersek Cc: Liming Gao Cc: Rahul Kumar Cc: Rebecca Cran Cc: Yuwei Chen Oliver Steffen (1): MdeModulePkg: Warn if out of space when writing variables MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.44.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117803): https://edk2.groups.io/g/devel/message/117803 Mute This Topic: https://groups.io/mt/105543778/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-