Skip to content

Commit 36a9200

Browse files
gaojiaqi7jyao1
authored andcommitted
td-payload: check the size for init_shared_memory
The size needs to be aligned with 4KiB, panic if not. Signed-off-by: Jiaqi Gao <[email protected]>
1 parent dec6f6b commit 36a9200

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

td-payload/src/mm/shared.rs

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ use crate::arch::shared::decrypt;
1111
static SHARED_MEMORY_ALLOCATOR: LockedHeap = LockedHeap::empty();
1212

1313
pub fn init_shared_memory(start: u64, size: usize) {
14+
if size % SIZE_4K != 0 {
15+
panic!("Failed to initialize shared memory: size needs to be aligned with 0x1000");
16+
}
17+
1418
// Set the shared memory region to be shared
1519
decrypt(start, size);
1620
// Initialize the shared memory allocator

0 commit comments

Comments
 (0)