Skip to content

Commit

Permalink
Move Paging Audit Globals
Browse files Browse the repository at this point in the history
Description

Instead of having the globals in the driver and the app, move them
to the common file.

- [ ] Impacts functionality?
  - **Functionality** - Does the change ultimately impact how firmware functions?
  - Examples: Add a new library, publish a new PPI, update an algorithm, ...
- [ ] Impacts security?
  - **Security** - Does the change have a direct security impact on an application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
  - **Breaking change** - Will anyone consuming this change experience a break
    in build or boot behavior?
  - Examples: Add a new library class, move a module to a different repo, call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
  - **Documentation** - Does the change contain explicit documentation additions
    outside direct code modifications (and comments)?
  - Examples: Update readme file, add feature readme file, link to documentation
    on an a separate Web page, ...

How This Was Tested

Tested on Q35 and SBSA by running the paging audit with various memory protection profiles.

Integration Instructions

N/A
  • Loading branch information
TaylorBeebe committed Mar 13, 2024
1 parent c473463 commit d20b96a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// Aligns the input address down to the nearest page boundary
#define ALIGN_ADDRESS(Address) ((Address / EFI_PAGE_SIZE) * EFI_PAGE_SIZE)

// Globals required to create the memory info database
CHAR8 *mMemoryInfoDatabaseBuffer = NULL;
UINTN mMemoryInfoDatabaseSize = 0;
UINTN mMemoryInfoDatabaseAllocSize = 0;

// Globals for memory protection special regions
MEMORY_PROTECTION_SPECIAL_REGION *mSpecialRegions = NULL;
UINTN mSpecialRegionCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent

#include "../../PagingAuditCommon.h"

CHAR8 *mMemoryInfoDatabaseBuffer = NULL;
UINTN mMemoryInfoDatabaseSize = 0;
UINTN mMemoryInfoDatabaseAllocSize = 0;

/**
Event notification handler. Will dump paging information to disk.
Expand Down
15 changes: 8 additions & 7 deletions UefiTestingPkg/AuditTests/PagingAudit/UEFI/PagingAuditCommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
((EFI_MEMORY_DESCRIPTOR*)Entry)->Type = NONE_EFI_MEMORY_TYPE; \
((EFI_MEMORY_DESCRIPTOR*)Entry)->VirtualStart = 0

MEMORY_PROTECTION_DEBUG_PROTOCOL *mMemoryProtectionProtocol = NULL;
CPU_MP_DEBUG_PROTOCOL *mCpuMpDebugProtocol = NULL;
EFI_FILE *mFs_Handle = NULL;

CHAR8 *mMemoryInfoDatabaseBuffer = NULL;
UINTN mMemoryInfoDatabaseSize = 0;
UINTN mMemoryInfoDatabaseAllocSize = 0;

/**
Converts a number of EFI_PAGEs to a size in bytes.
Expand Down Expand Up @@ -84,13 +92,6 @@ OpenVolumeSFS (
OUT EFI_FILE **Fs_Handle
);

MEMORY_PROTECTION_DEBUG_PROTOCOL *mMemoryProtectionProtocol = NULL;
CPU_MP_DEBUG_PROTOCOL *mCpuMpDebugProtocol = NULL;
EFI_FILE *mFs_Handle;
extern CHAR8 *mMemoryInfoDatabaseBuffer;
extern UINTN mMemoryInfoDatabaseSize;
extern UINTN mMemoryInfoDatabaseAllocSize;

/**
Populates the heap guard protocol global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
VOID *mPiSmmCommonCommBufferAddress = NULL;
UINTN mPiSmmCommonCommBufferSize;

CHAR8 *mMemoryInfoDatabaseBuffer = NULL;
UINTN mMemoryInfoDatabaseSize = 0;
UINTN mMemoryInfoDatabaseAllocSize = 0;
// Added to satisfy gDxeMps use in PagingAuditCommon.c
DXE_MEMORY_PROTECTION_SETTINGS gDxeMps = DXE_MEMORY_PROTECTION_SETTINGS_OFF;

Expand Down

0 comments on commit d20b96a

Please sign in to comment.