Skip to content

Commit

Permalink
missing reserved checks for NL PTEs
Browse files Browse the repository at this point in the history
  • Loading branch information
ved-rivos committed Jul 4, 2024
1 parent db2335a commit 4672bfa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions iommu_ref_model/libiommu/src/iommu_second_stage_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ second_stage_address_translation(
// a = gpte.ppn × PAGESIZE and go to step 2.
if ( gpte->R == 1 || gpte->X == 1 ) goto step_5;

// For non-leaf PTEs, bits 62–61 are reserved for future standard use. Until
// their use is defined by a standard extension, they must be cleared by
// software for forward compatibility, or else a page-fault exception is raised.
if ( gpte->PBMT != 0 ) return GST_PAGE_FAULT;

// For non-leaf PTEs, the D, A, and U bits are reserved for future standard use.
if ( gpte->D != 0 || gpte->A != 0 || gpte->U != 0) return GST_PAGE_FAULT;

i = i - 1;
if ( i < 0 ) return GST_PAGE_FAULT;
a = gpte->PPN * PAGESIZE;
Expand Down
3 changes: 3 additions & 0 deletions iommu_ref_model/libiommu/src/iommu_two_stage_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ two_stage_address_translation(
// software for forward compatibility, or else a page-fault exception is raised.
if ( pte->PBMT != 0 ) goto page_fault;

// For non-leaf PTEs, the D, A, and U bits are reserved for future standard use.
if ( pte->D != 0 || pte->A != 0 || pte->U != 0) goto page_fault;

i = i - 1;
if ( i < 0 ) goto page_fault;
a = pte->PPN * PAGESIZE;
Expand Down

0 comments on commit 4672bfa

Please sign in to comment.