commit | ccc11382778ccc35860a8966f6ad1332ba447603 | [log] [tgz] |
---|---|---|
author | Pierre-Clément Tosi <ptosi@google.com> | Fri Apr 21 16:44:53 2023 +0100 |
committer | Pierre-Clément Tosi <ptosi@google.com> | Thu Apr 27 09:19:38 2023 +0100 |
tree | 6590f391e486be20e581ca2628f99476899ccefb | |
parent | 23aba521568584e9cd41a697551aa6a4cfb4c6a6 [diff] |
vmbase: Handle stack overflows Allocate the first page of the writable_data region for a stack to be used by the exception handlers so that faults caused by accesses to the SP from the main thread can be handled. As fault handlers push the register file to the stack on entry, we would previously enter an exception loop on stack overflow. This works by reserving SP_EL0 for the "main" thread and relying on current_exception_sp0 (from exceptions.S) switching to SP_EL1 when taking an exception. SP_EL1 is first initialized to the bottom of the newly allocated page while SP_EL0 is initialized to the value previously used (note that SP_EL0 was previously unused). Use the linker script to ensure that there is always at least one full page between the end of .bss and the top (i.e. smallest address) of the stack, in order to guarantee a permission fault on stack overflow, if the MMU has been set properly. Rely on the fact that the page preceding the page containing the EH stack isn't mapped R/W to catch EH stack overflows (which would still end up in an exception loop). Bug: 279209532 Test: atest MicrodroidTests Change-Id: Ie5a8dc06348bfb7db2742b1affec4d162d8b538c
This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.