Skip to content

Commit

Permalink
core: mm: strip the tag of VA when check_pa_matches_va
Browse files Browse the repository at this point in the history
When CFG_TEE_CORE_DEBUG=y and CFG_MEMTAG=y, core will crash, if there are
some modules call virt_to_phys() or core_vbuf_is() and so on.
Because the MM can not find map by the tagged VA, so strip the tag of
VA when check_pa_matches_va().

Suggested-by: Jens Wiklander <[email protected]>
Signed-off-by: wentao.sun <[email protected]>
Acked-by: Jerome Forissier <[email protected]>
  • Loading branch information
wentao.sun authored and jforissier committed Jul 10, 2024
1 parent dcf343a commit ac5bf9b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/mm/core_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <kernel/user_mode_ctx.h>
#include <kernel/virtualization.h>
#include <libfdt.h>
#include <memtag.h>
#include <mm/core_memprot.h>
#include <mm/core_mmu.h>
#include <mm/mobj.h>
Expand Down Expand Up @@ -2339,7 +2340,7 @@ paddr_t virt_to_phys(void *va)

if (!arch_va2pa_helper(va, &pa))
pa = 0;
check_pa_matches_va(va, pa);
check_pa_matches_va(memtag_strip_tag(va), pa);
return pa;
}

Expand Down

0 comments on commit ac5bf9b

Please sign in to comment.