Skip to content

Commit

Permalink
Do not treat RP memory as valid for access (#40)
Browse files Browse the repository at this point in the history
## Description

When accessing memory, treat read protected memory the same as
non-resident VAs. There shouldn't be a need to read or write to these
addresses and if so in the future they should be sup[ported through
physical read/write instructions.

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

## How This Was Tested

Tested in SBSA

## Integration Instructions

N/A
  • Loading branch information
cfernald authored Jun 19, 2024
1 parent 1f34621 commit 7572ec0
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions DebuggerFeaturePkg/Library/DebugAgent/DebugAgentDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,24 +459,17 @@ AccessMemory (
return FALSE;
}

if (Write && (Attributes & EFI_MEMORY_RO)) {
Status = mMemoryAttributeProtocol->ClearMemoryAttributes (
mMemoryAttributeProtocol,
Address & ~EFI_PAGE_MASK,
EFI_PAGE_SIZE,
EFI_MEMORY_RO | EFI_MEMORY_RP
);
if (EFI_ERROR (Status)) {
return FALSE;
}
if (Attributes & EFI_MEMORY_RP) {
// Treat RP memory as non-valid.
return FALSE;
}

AttributesChanged = TRUE;
} else if (Attributes & EFI_MEMORY_RP) {
if (Write && (Attributes & EFI_MEMORY_RO)) {
Status = mMemoryAttributeProtocol->ClearMemoryAttributes (
mMemoryAttributeProtocol,
Address & ~EFI_PAGE_MASK,
EFI_PAGE_SIZE,
EFI_MEMORY_RP
EFI_MEMORY_RO
);
if (EFI_ERROR (Status)) {
return FALSE;
Expand Down

0 comments on commit 7572ec0

Please sign in to comment.