keystone-enclave / keystone

Keystone Enclave (QEMU + HiFive Unleashed)
Other
463 stars 133 forks source link

About root_page_table_storage #471

Open alan2031 opened 3 weeks ago

alan2031 commented 3 weeks ago

Hello, may I ask where the root page table of the eapp is assigned? In /runtime/loader.S, the value of root_page_table_storage is written to satp, but there is no file that assigns a value to root_page_table_storage.

grg-haas commented 3 weeks ago

Hi @alan2031! root_page_table_storage is a statically allocated array that is initially empty. It is filled out (via a pointer named root_page_table) as the eapp's virtual memory is initialized

alan2031 commented 3 weeks ago

Hi @alan2031! root_page_table_storage is a statically allocated array that is initially empty. It is filled out (via a pointer named root_page_table) as the eapp's virtual memory is initialized

Hi grg-haas! Thank you for your response!I have another question: My understanding is that when the runtime ELF loader loads the eapp, it traverses the second-level and third-level page tables and establishes the address mappings. At this time, the second-level and third-level page tables reside in the enclave's free memory (freemem), where they are protected. However, when allocating the root_page_table_storage region, its specific physical memory address is not explicitly specified. So how is the root page table protected?