Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 77c070b1a7b69ad29b628e90a430ad55a26fc30a
      
https://github.com/tianocore/edk2/commit/77c070b1a7b69ad29b628e90a430ad55a26fc30a
  Author: Oliver Smith-Denny <o...@microsoft.com>
  Date:   2024-10-08 (Tue, 08 Oct 2024)

  Changed paths:
    M EmulatorPkg/Win/Host/WinGopInput.c
    M EmulatorPkg/Win/Host/WinGopScreen.c

  Log Message:
  -----------
  EmulatorPkg: Add Signature to Graphics Structure

When updating MdePkg's CR macro to enforce signature checking in
all usages, it was discovered that EmulatorPkg was initializing
a structure without setting the signature for it, causing an error
to be returned when CR now checked the signature.

This commit updates the graphics stack in EmulatorPkg to set the
signature of the data structure and check the return value of
the wrapper for the CR macro.

Signed-off-by: Oliver Smith-Denny <o...@linux.microsoft.com>


  Commit: d99045f39220e2ad075ae5b93b53bbabd5923cb4
      
https://github.com/tianocore/edk2/commit/d99045f39220e2ad075ae5b93b53bbabd5923cb4
  Author: Oliver Smith-Denny <o...@microsoft.com>
  Date:   2024-10-08 (Tue, 08 Oct 2024)

  Changed paths:
    M MdePkg/Include/Library/DebugLib.h

  Log Message:
  -----------
  MdePkg: DebugLib: Check Signature in CR in Release Builds

The CR macro is used to access an enclosing structure from a
pointer within the structure. In DEBUG builds (i.e. when
MDEPKG_NDEBUG is not set and debug asserts are enabled), this
macro does signature validation checking to ensure that the
structure that has been found is the correct structure, based
on a signature passed in by the caller.

However, if MDEPKG_NDEBUG is set or debug asserts are disabled,
no signature validation is performed, meaning that CR may return
an invalid structure that the caller believes is valid and has had
signature validation on, causing undefined behavior (memory
corruption). We should where at all possible have defined behavior,
particularly in RELEASE builds, which are what typical platforms
will ship to consumers.

This patch updates CR to do the signature validation in all scenarios
to provide defined behavior from the macro. In the event of a
signature failure, CR will either 1) assert if !MDEPKG_NDEBUG and
debug asserts are enabled (existing behavior) or 2) return NULL to
indicate to the caller that signature validation failed.

There exist consumers today who already, erroneously, rely on this
behavior.

Another macro, BASE_CR, exists for callers who do not wish to perform
signature validation. Any code that wishes to avoid the signature
validation should move to this macro.

Signed-off-by: Oliver Smith-Denny <o...@linux.microsoft.com>


Compare: https://github.com/tianocore/edk2/compare/596773f5e33e...d99045f39220

To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to