maxdev1 / ghost

Ghost, a micro-kernel based hobby operating system.
http://ghostkernel.org/
GNU General Public License v3.0
560 stars 57 forks source link

Stack overflow handling by reserving virtual space #23

Closed maxdev1 closed 4 years ago

maxdev1 commented 4 years ago

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

maxdev1 commented 4 years ago

Done in commit fd07306e4a77783bb81bbedc12bee27ece069b79.