MdeModulePkg/NvmExpressDxe: Add NVMe namespace filtering PCD#1754
MdeModulePkg/NvmExpressDxe: Add NVMe namespace filtering PCD#1754eeshanl merged 4 commits intomicrosoft:release/202511from
Conversation
4f534ff to
7ef1da1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/202511 #1754 +/- ##
=================================================
Coverage ? 1.84%
=================================================
Files ? 1151
Lines ? 376652
Branches ? 3196
=================================================
Hits ? 6936
Misses ? 369660
Partials ? 56
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
✅ QEMU Validation PassedSource Dependencies
Results
Workflow run: https://github.com/microsoft/mu_basecore/actions/runs/25009154152 This comment was automatically generated by the Mu QEMU PR Validation workflow. |
ca5e37c to
e846018
Compare
e846018 to
e929851
Compare
31a43a4 to
ba5c53f
Compare
|
Disclaimer: Readme.md is AI generated |
37e056c to
ede9f77
Compare
os-d
left a comment
There was a problem hiding this comment.
Can you take this directly to edk2 or do we have a platform need to get this into Mu now? If so, please take it to edk2 in parallel. Obviously dropping the MU_CHANGEs part of the readme.
3dfcbc3 to
57c1cd7
Compare
Add PcdNvmeNamespaceFilterId to control NVMe namespace enumeration. When != 0, only the specified NSID is discovered and enumerated. When 0 (default), all namespaces are enumerated as before. This improves security on NVMe devices with multiple namespaces. Without filtering, UEFI enumerates all namespaces and an attacker could place malicious boot media in a secondary namespace. By restricting enumeration to only the first namespace, we ensure the system boots exclusively from the intended namespace and prevents exploitation of additional namespaces as an attack vector. Changes: NvmExpress.c: Add FilteringEnabled parameter to DiscoverAllNamespaces, EnumerateNvmeDevNamespace with namespace ID check when filtering NvmExpressDxe.inf: Add PcdNvmeNamespaceFilterId to [Pcd] section MdeModulePkg.dec: Define PcdNvmeNamespaceFilterId (default 0)
57c1cd7 to
632b187
Compare
Description
Add PcdNvmeNamespaceFilterId to control NVMe namespace enumeration.
When != 0, only the specified NSID is discovered and enumerated. When 0 (default), all namespaces are enumerated as before.
This improves security on NVMe devices with multiple namespaces.
Without filtering, UEFI enumerates all namespaces and an attacker could place malicious boot media in a secondary namespace. By restricting enumeration to only the first namespace, we ensure the system boots exclusively from the intended namespace and prevents exploitation of additional namespaces as an attack vector.
Changes:
Ref: microsoft/mu_msvm@9337285
For details on how to complete these options and their meaning refer to CONTRIBUTING.md.
How This Was Tested
Tested on:
OpenVMM platform where namespace filtering is required and successfully booted to OS via DDA NVMe with Namespace filtering on & off.
Physical platform and booted to OS with physical NVMe with Namespace filtering on & off.
Qemu Q35 by booting to OS via NVMe with Namespace filtering on & off:
Modified
QemuCommandBuilder.pywith the following:With this change, we have added 2 NVMe namespaces nsid 1 & 2, and we have added 2 boot media, 1 with the real OS and 2 with an empty drive. Also, I tried to put the real boot media on nsid 2, and emptry drive in nsid 1, selected nsid 2 as the filter, and was able to successfully boot to OS.
With
PcdNvmeNamespaceFilterId == 1 || PcdNvmeNamespaceFilterId == 2we only enumerate target NSID and successfully boot to OS.With
PcdNvmeNamespaceFilterId == 0we enumerate both the namespaces as defined above and also successfully boot to OS.Integration Instructions
Set PcdNvmeNamespaceFilterId to the desired NSID when required at the platform dsc.