Address 0x0 is special in that some frameworks and applications (e.g. Java OpenJDK) perform null pointer dereference on purpose, to validate PF exception handling. Previously, VM-based PALs marked the whole legacy-DOS memory region [0, 1MB) as reserved for the LibOS, which made LibOS consider address 0x0 as being used by the PAL and terminate Gramine with "internal memory fault" error.
This commit moves [0x0, 4KB) -- i.e. the very first page in address space -- outside of the reserved region. Thus, 0x0 address becomes "application available" and the LibOS forwards PF exceptions on this address to the application signal handler. This will become important in future commits when support for PF exception handling will be added.
Note that this change implies that the application can now allocate [0x0, 4KB) memory region for its own purposes (previously LibOS would refuse to consider this memory region because it was marked as reserved by PAL). Since we trust the application, this change is fine.
How to test this PR?
When Java workload will start working (need more PRs to add proper #PF exception handling), then run Java.
Description of the changes
Address 0x0 is special in that some frameworks and applications (e.g. Java OpenJDK) perform null pointer dereference on purpose, to validate PF exception handling. Previously, VM-based PALs marked the whole legacy-DOS memory region [0, 1MB) as reserved for the LibOS, which made LibOS consider address 0x0 as being used by the PAL and terminate Gramine with "internal memory fault" error.
This commit moves [0x0, 4KB) -- i.e. the very first page in address space -- outside of the reserved region. Thus, 0x0 address becomes "application available" and the LibOS forwards PF exceptions on this address to the application signal handler. This will become important in future commits when support for PF exception handling will be added.
Note that this change implies that the application can now allocate [0x0, 4KB) memory region for its own purposes (previously LibOS would refuse to consider this memory region because it was marked as reserved by PAL). Since we trust the application, this change is fine.
How to test this PR?
When Java workload will start working (need more PRs to add proper #PF exception handling), then run Java.
This change is