-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
core: fix panic with TEE_SDP_TEST_MEM #7273
Conversation
@@ -2776,7 +2782,7 @@ void core_mmu_init_phys_mem(void) | |||
/* Carve out test SDP memory */ | |||
#ifdef TEE_SDP_TEST_MEM_BASE | |||
if (TEE_SDP_TEST_MEM_SIZE) { | |||
pa = vaddr_to_phys(TEE_SDP_TEST_MEM_BASE); | |||
pa = TEE_SDP_TEST_MEM_BASE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix rather relates to commit 1c1f8b6 that falsely considered SDP_TEST_MEM could be relocated whereas is it not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I'll update the commit message.
* cover all secure memory, even if it's special. | ||
*/ | ||
if (mem_map->map[n].type == MEM_AREA_SEC_RAM_OVERALL) | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is applicable when SDP_TEST_MEM that is inside the SEC_RAM_OVERALL. But not if the SDP memory is defined with CFG_TEE_SDP_MEM_BASE/_SIZE
. Maybe specifically test here if mem->start == TEE_SDP_TEST_MEM_BASE && mem->size == TEE_SDP_TEST_MEM_SIZE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it's getting a bit ugly. We should perhaps remove TEE_SDP_TEST_MEM
someday.
Minor comment: prefix commit message header line with |
e41d922
to
a8dd5d1
Compare
Comments addressed and commit message updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Etienne Carriere <[email protected]>
The commit 2f2f69d ("core: mm: replace MEM_AREA_TA_RAM") uses MEM_AREA_SEC_RAM_OVERALL to map practically all secure memory. This conflicts with TEE_SDP_TEST_MEM where MEM_AREA_SEC_RAM_OVERALL covers TEE_SDP_TEST_MEM and triggers a panic in verify_special_mem_areas(). The commit 1c1f8b6 ("core: mm: unify secure core and TA memory") changed to use vaddr_to_phys() to find the physical address for TEE_SDP_TEST_MEM_BASE. This isn't right since it refers to physical memory only. So fix these problems. Fixes: 2f2f69d ("core: mm: replace MEM_AREA_TA_RAM") Fixes: 1c1f8b6 ("core: mm: unify secure core and TA memory") Signed-off-by: Jens Wiklander <[email protected]> Reviewed-by: Etienne Carriere <[email protected]>
a8dd5d1
to
775fb5a
Compare
Tag applied. |
The commit 2f2f69d ("core: mm: replace MEM_AREA_TA_RAM") uses MEM_AREA_SEC_RAM_OVERALL to map practically all secure memory. This conflicts with TEE_SDP_TEST_MEM:
So fix these problems.
Fixes: 2f2f69d ("core: mm: replace MEM_AREA_TA_RAM")