Skip to content

OvmfPkg/LoongArchVirt: use PlatformSecureLibNull for secure boot builds - #2

Open
20000419 wants to merge 1 commit into
masterfrom
codex/fix-secure-boot-bypass-in-loongarchvirt
Open

20000419 wants to merge 1 commit into
masterfrom
codex/fix-secure-boot-bypass-in-loongarchvirt

Conversation

@20000419

Copy link
Copy Markdown
Owner

Motivation

  • LoongArchVirt Secure Boot configuration selected OvmfPkg/Library/PlatformSecureLib, whose UserPhysicalPresent() unconditionally returns TRUE, enabling an in-guest privileged OS to bypass Secure Boot protections by setting CustomMode and replacing PK/KEK/db without signature checks.
  • The change prevents treating all callers as physically present for Secure Boot variable flows and restores a real physical-presence gate by using the null platform secure implementation that honors PcdUserPhysicalPresence.

Description

  • Update OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc to map PlatformSecureLib to SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf when SECURE_BOOT_ENABLE=TRUE instead of OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf.
  • Preserve AuthVariableLib, SecureBootVariableLib, SecureBootVariableProvisionLib, and PlatformPKProtectionLib so authenticated-variable functionality remains enabled while removing the unconditional physical-presence bypass.
  • No changes were made to AuthVariableLib logic; this is a configuration-level remediation to prevent untrusted callers from implicitly satisfying physical-presence checks.

Testing

  • Attempted a secure-boot build with SECURE_BOOT_ENABLE=TRUE via source edksetup.sh && build -a LOONGARCH64 -t GCC5 -b DEBUG -p OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc -D SECURE_BOOT_ENABLE=TRUE, which failed due to the environment lacking the GCC5 toolchain ([GCC5] not defined), so a full build could not be completed here.
  • Verified the intended configuration change with git diff and by inspecting OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc, confirming PlatformSecureLib now points to PlatformSecureLibNull.
  • Confirmed PlatformSecureLibNull uses mUserPhysicalPresence (default FALSE via PcdUserPhysicalPresence) by inspecting SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c to validate the remediation's effect on the presence check.

Codex Task

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the LoongArchVirtQemu.dsc file to use the PlatformSecureLibNull library instead of PlatformSecureLib when SECURE_BOOT_ENABLE is set to true. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant