@@ -29,9 +29,7 @@ The following page table structs are set up in memory before running a Hyperligh
2929### PML4 (Page Map Level 4) Table
3030
3131The PML4 table is located at physical address specified in CR3. In Hyperlight we set
32- ` CR3=pml4_address ` (i.e., i.e., base address (0x0) + aligned guest code size), which
33- means the PML4 table is located at physical address ` 0x0 ` . The PML4 table comprises
34- 512 64-bit entries.
32+ ` CR3=pml4_address ` . The PML4 table comprises 512 64-bit entries.
3533
3634In Hyperlight, we only initialize the first entry, with value ` 0x1_000 ` , implying that
3735we only have a single PDPT.
@@ -103,48 +101,3 @@ PML4E, PDPTE, and PD Entries have the present flag set to 1, and the rest of the
103101flags are not set.
104102
105103PTE Entries all have the present flag set to 1.
106-
107- In addition, the following flags are set according to the type of memory being
108- mapped:
109-
110- For ` Host Function Definitions ` and ` Host Exception Data ` the NX flag is set to 1
111- meaning that the memory is not executable in the guest and is not accessible to
112- guest code (ring 3) and is also read only even in ring 0.
113-
114- For ` Input/Output Data ` , ` Page Table Data ` , ` PEB ` , ` PanicContext ` and
115- ` GuestErrorData ` the NX flag is set to 1 meaning that the memory is not executable
116- in the guest and the RW flag is set to 1 meaning that the memory is read/write in
117- ring 0, this means that this data is not accessible to guest code unless accessed
118- via the Hyperlight Guest API (which will be in ring 0).
119-
120- For ` Code ` the NX flag is not set meaning that the memory is executable in the guest
121- and the RW flag is set to 1 meaning the data is read/write, as the user/supervisor
122- flag is set then the memory is also read/write accessible to user code. (The code
123- section contains both code and data, so it is marked as read/write. In a future
124- update we will parse the layout of the code and set the access flags accordingly).
125-
126- For ` Stack ` the NX flag is set to 1 meaning that the memory is not executable in the
127- guest, the RW flag is set to 1 meaning the data is read/write, as the
128- user/supervisor flag is set then the memory is also read/write accessible to user
129- code.
130-
131- For ` Heap ` the RW flag is set to 1 meaning the data is read/write, as the
132- user/supervisor flag is set then the memory is also read/write accessible to user
133- code. The NX flag is not set if the feature ` executable_heap ` is enabled, otherwise
134- the NX flag is set to 1 meaning that the memory is not executable in the guest. The
135- ` executable_heap ` feature is disabled by default. It is required to allow data in
136- the heap to be executable to when guests dynamically load or generate code, e.g.
137- ` hyperlight-wasm ` supports loading of AOT compiled WebAssembly modules, these are
138- loaded dynamically by the Wasm runtime and end up in the heap, therefore for this
139- scenario the ` executable_heap ` feature must be enabled. In a future update we will
140- implement a mechanism to allow the guest to request memory to be executable at
141- runtime via the Hyperlight Guest API.
142-
143- For ` Guard Pages ` the NX flag is set to 1 meaning that the memory is not executable
144- in the guest. The RW flag is set to 1 meaning the data is read/write, as the
145- user/supervisor flag is set then the memory is also read/write accessible to user
146- code. ** Note that neither of these flags should really be set as the purpose of the
147- guard pages is to cause a fault if accessed, however, as we deal with this fault in
148- the host not in the guest we need to make the memory accessible to the guest, in a
149- future update we will implement exception and interrupt handling in the guest and
150- then change these flags.**
0 commit comments