Article View: linux.debian.bugs.dist
Article #4749Bug#1154178: ovmf: x86 strictnx variant does not apply NX restrictions
From: Andrew Cooper
Date: Mon, 16 Nov 2026 17:00
Date: Mon, 16 Nov 2026 17:00
108 lines
6377 bytes
6377 bytes
This is a multi-part MIME message sent by reportbug. --===============0744503217643999021== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline Package: ovmf Version: 2025.02-8+deb13u1 Severity: normal Tags: patch X-Debbugs-Cc: andrew.cooper3@citrix.com Dear Maintainer, The OVMF package starting with Trixie contains a .strictnx variant to enforce permission restrictions that are being applied to firmware across the ecosystem. Unfortunately the .strictnx variant does not actually enforce the restrictions it claims to, which lead to a false negative in upstream Xen's CI testing. (A regression which ought to have been caught by .strictnx ended up passing.) To complicate matters, AIUI the PcdDxeNxMemoryProtectionPolicy default differs between x86 and ARM, with x86 defaulting into "bug compatibility mode" while ARM defaults into strict mode. So, I suspect the ARM strictnx variant probably is strict. https://fedoraproject.org/wiki/Changes/Edk2Security contains the list of all settings required to enforce strictnx in OVMF builds. The attached patch wires all of these settings up for the strictnx variant, including the protection for NULL pointer dereferences which seems like a good move at the same time. I have tested that the resulting OVMF_CODE_4M.secboot.strictnx.fd does enforce restrictions, and now fails with the bad build of Xen in CI. I'm afraid that I'm not in a position to test the ARM side. -- no debconf information --===============0744503217643999021== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-strictnx-build-to-really-be-strictnx.patch" From 878c994280c9bfc43cd13d75b032aa1105c2a4e0 Mon Sep 17 00:00:00 2001 From: Andrew Cooper <andrew.cooper3@citrix.com> Date: Mon, 16 Nov 2026 13:39:35 +0000 Subject: [PATCH] Fix strictnx build to really be strictnx Removing `PcdUninstallMemAttrProtocol=TRUE` in order to create strictnx is insufficient for x86 targets. PcdDxeNxMemoryProtectionPolicy needs changing from it's default in order to stop mapping EfiLoaderData as RWX. Apply all settings from https://fedoraproject.org/wiki/Changes/Edk2Security, which Fedora have rolled out generally across all OVMF binaries. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- debian/rules | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 13f245b1a8f9..ebdc6366c155 100755 --- a/debian/rules +++ b/debian/rules @@ -40,6 +40,12 @@ COMMON_FLAGS += $(PCD_FLAGS) NO_STRICTNX_COMMON_FLAGS = --pcd PcdUninstallMemAttrProtocol=TRUE +STRICTNX_COMMON_FLAGS = --pcd PcdUninstallMemAttrProtocol=FALSE +STRICTNX_COMMON_FLAGS += --pcd PcdDxeNxMemoryProtectionPolicy=0xC000000000007FD5 +STRICTNX_COMMON_FLAGS += --pcd PcdSetNxForStack=TRUE +STRICTNX_COMMON_FLAGS += --pcd PcdImageProtectionPolicy=0x03 +STRICTNX_COMMON_FLAGS += --pcd PcdNullPointerDetectionPropertyMask=0x03 + OVMF_COMMON_FLAGS = $(COMMON_FLAGS) OVMF_COMMON_FLAGS += -DTPM2_ENABLE=TRUE # Uncomment for in-band debug messages @@ -50,7 +56,7 @@ OVMF_4M_LEGACY_FLAGS = $(OVMF_4M_COMMON_FLAGS) $(NO_STRICTNX_COMMON_FLAGS) -DPVS OVMF_4M_SECBOOT_FLAGS = $(OVMF_4M_COMMON_FLAGS) $(NO_STRICTNX_COMMON_FLAGS) -DBUILD_SHELL=FALSE -DSECURE_BOOT_ENABLE=TRUE -DSMM_REQUIRE=TRUE OVMF_4M_SECBOOT_CC_FLAGS = $(OVMF_4M_COMMON_FLAGS) $(NO_STRICTNX_COMMON_FLAGS) -DBUILD_SHELL=FALSE -DSECURE_BOOT_ENABLE=TRUE -DSMM_REQUIRE=FALSE OVMF_AMDSEV_FLAGS = $(OVMF_COMMON_FLAGS) -OVMF_4M_SECBOOT_STRICTNX_FLAGS = $(OVMF_4M_COMMON_FLAGS) -DBUILD_SHELL=FALSE -DSECURE_BOOT_ENABLE=TRUE -DSMM_REQUIRE=TRUE +OVMF_4M_SECBOOT_STRICTNX_FLAGS = $(OVMF_4M_COMMON_FLAGS) $(STRICTNX_COMMON_FLAGS) -DBUILD_SHELL=FALSE -DSECURE_BOOT_ENABLE=TRUE -DSMM_REQUIRE=TRUE AAVMF_COMMON_FLAGS = $(COMMON_FLAGS) AAVMF_COMMON_FLAGS += -DTPM2_ENABLE=TRUE @@ -58,7 +64,7 @@ AAVMF_COMMON_FLAGS += -DTPM2_CONFIG_ENABLE=TRUE AAVMF_COMMON_FLAGS += -DCAVIUM_ERRATUM_27456=TRUE AAVMF_NO_SECBOOT_FLAGS = $(COMMON_FLAGS) $(NO_STRICTNX_COMMON_FLAGS) AAVMF_SECBOOT_FLAGS = $(AAVMF_COMMON_FLAGS) $(NO_STRICTNX_COMMON_FLAGS) -DBUILD_SHELL=FALSE -DSECURE_BOOT_ENABLE=TRUE -AAVMF_SECBOOT_STRICTNX_FLAGS = $(AAVMF_COMMON_FLAGS) -DBUILD_SHELL=FALSE -DSECURE_BOOT_ENABLE=TRUE +AAVMF_SECBOOT_STRICTNX_FLAGS = $(AAVMF_COMMON_FLAGS) $(STRICTNX_COMMON_FLAGS) -DBUILD_SHELL=FALSE -DSECURE_BOOT_ENABLE=TRUE RISCV64_FLAGS = $(COMMON_FLAGS) LOONGARCH64_FLAGS = $(COMMON_FLAGS) base-commit: 713ba575906801d6b025b3cf3b8d843d8e1dfc8d -- 2.39.5 --===============0744503217643999021==--
Technical Details
Message-ID:
<O08dH-chPl-5@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod From: Andrew Cooper <andrew.cooper3@citrix.com> Newsgroups: linux.debian.bugs.dist Subject: Bug#1154178: ovmf: x86 strictnx variant does not apply NX restrictions Date: Mon, 16 Nov 2026 18:00:01 +0100 Message-ID: <O08dH-chPl-5@gated-at.bofh.it> X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org> X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Mon Nov 16 16:57:08 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -1.651 Reply-To: Andrew Cooper <andrew.cooper3@citrix.com>, 1154178@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: andrew.cooper3@citrix.com, pkg-qemu-devel@lists.alioth.debian.org X-Debian-Pr-Message: report 1154178 X-Debian-Pr-Package: ovmf X-Debian-Pr-Keywords: patch X-Debian-Pr-Source: edk2 Content-Type: multipart/mixed; boundary="===============0744503217643999021==" MIME-Version: 1.0 X-Mailer: reportbug 12.0.0 X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2003012 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 108 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Mon, 16 Nov 2026 16:55:44 +0000 X-Original-Message-ID: <179484814461.3684506.7311352331615322903.reportbug@andrewcoop>