Missing Page Directory & Segfault in User Process
Posted: Mon Nov 30, 2015 8:01 am
Hello,
I have recently been encountering a rather bizarre bug in my OS Arcrascent while testing some user applications. All of my UNIX syscalls, at least as I have tested them, are working fine and my I/O also seems to be OK. But whenever I try to execute malloc(), free(), or pretty much any C dynamic memory-allocating function in a user application, my paging manager keeps saying that it is "missing page directory while mapping ... -> ..." in the sbrk() syscall, and attempts to set a new page directory. And when I try to write to any of these dynamically allocated memory regions, I simply get a Page Fault (#PF) in the application, leading to its automatic termination by my process manager. I have verified that I am setting all of the read, write, global, and user permissions for the pages I newly map for the user application.
What might be the problem here? Has anyone encountered an issue similar to this?
P.S. This is the code for the application, btw.
Thanks.
I have recently been encountering a rather bizarre bug in my OS Arcrascent while testing some user applications. All of my UNIX syscalls, at least as I have tested them, are working fine and my I/O also seems to be OK. But whenever I try to execute malloc(), free(), or pretty much any C dynamic memory-allocating function in a user application, my paging manager keeps saying that it is "missing page directory while mapping ... -> ..." in the sbrk() syscall, and attempts to set a new page directory. And when I try to write to any of these dynamically allocated memory regions, I simply get a Page Fault (#PF) in the application, leading to its automatic termination by my process manager. I have verified that I am setting all of the read, write, global, and user permissions for the pages I newly map for the user application.
What might be the problem here? Has anyone encountered an issue similar to this?
P.S. This is the code for the application, btw.
Code: Select all
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main() {
char* mem = (char*)malloc(10);
for (int i = 0; i < 10; ++i)
mem[i] = i;
return 0;
}