maxdev1/ghost

Stack overflow handling by reserving virtual space

maxdev1 opened this issue · 1 comments

Currently just a single page is allocated in taskingMemoryCreateStacks. This is what causes the window server to die while calling Cairo, as a lot of calls are happening.

This should be improved so that a range of virtual memory is pre-allocated but not filled with physical pages, including a guard page on the very bottom of the stack. The stack structure in the task should memorize the number of already allocated pages or maybe a simple allocate-on-write is sufficient as long as within the stack range and not on the guard page.

Allocation of pages would then look like this from start to end:
X 0 0 0 0 0 0 0 0 0 1
On page-fault, the stack is to be extended accordingly:
X 0 0 0 0 0 0 0 0 1 1
If the limit is reached, access to the guard-page should terminate the process with a SIGSEGV.
X 1 1 1 1 1 1 1 1 1 1