When creating a new page table, the table should be filled with zeroes to prevent decoding invalid entries as valid in the future. Given that in the inmate memory space no assumptions can be made on the contents of unallocated heapspace, zeroing needs to be done explicitly.
Signed-off-by: Bram Hooimeijer <[email protected]> --- inmates/lib/x86/mem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inmates/lib/x86/mem.c b/inmates/lib/x86/mem.c index 7e1c8b83..45424ea1 100644 --- a/inmates/lib/x86/mem.c +++ b/inmates/lib/x86/mem.c @@ -58,6 +58,7 @@ void map_range(void *start, unsigned long size, enum map_type map_type) pt = (unsigned long *)(*pt_entry & PAGE_MASK); } else { pt = alloc(PAGE_SIZE, PAGE_SIZE); + memset(pt, 0, PAGE_SIZE); *pt_entry = (unsigned long)pt | PAGE_DEFAULT_FLAGS; } @@ -66,6 +67,7 @@ void map_range(void *start, unsigned long size, enum map_type map_type) pt = (unsigned long *)(*pt_entry & PAGE_MASK); } else { pt = alloc(PAGE_SIZE, PAGE_SIZE); + memset(pt, 0, PAGE_SIZE); *pt_entry = (unsigned long)pt | PAGE_DEFAULT_FLAGS; } -- 2.25.1 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/AS8PR02MB6663B55522C63851C338E6A8B6499%40AS8PR02MB6663.eurprd02.prod.outlook.com.
