riscv: check type of cap before checking if mapped
In decodeRISCVMMUInvocation, in the asid_pool_cap case, the first extra cap is supplied by the user. Before asking whether the page table cap is mapped, we should check it is a page table cap. Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
This commit is contained in:
parent
869dc4a4c0
commit
7ad699e4fb
1 changed files with 3 additions and 1 deletions
|
|
@ -1002,7 +1002,9 @@ exception_t decodeRISCVMMUInvocation(word_t label, word_t length, cptr_t cptr,
|
|||
vspaceCapSlot = extraCaps.excaprefs[0];
|
||||
vspaceCap = vspaceCapSlot->cap;
|
||||
|
||||
if (cap_page_table_cap_get_capPTIsMapped(vspaceCap)) {
|
||||
if (unlikely(
|
||||
cap_get_capType(vspaceCap) != cap_page_table_cap ||
|
||||
cap_page_table_cap_get_capPTIsMapped(vspaceCap))) {
|
||||
userError("RISCVASIDPool: Invalid vspace root.");
|
||||
current_syscall_error.type = seL4_InvalidCapability;
|
||||
current_syscall_error.invalidCapNumber = 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue