Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not treat RP memory as valid for access #40

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading