Page 1 of 1
Forking causes triple fault occasionally
Posted: Wed Oct 15, 2008 10:11 pm
by piranha
I have this weird bug/issue/thing thats really annoying me.
When I add something to my task structure (the struct for a process {eip, pid, etc}), many times forking will not work, as in I have it fork a new process and it triple faults.
Is this a common problem, something that my tired brain is overlooking or am I just being slow?
And...of course...is there a way to fix it?
(Any more info you need, I'll provide)
-JL
Re: Forking causes triple fault occasionally
Posted: Thu Oct 16, 2008 12:05 am
by Stevo14
You say "occasionally," does this mean that one time you will run the kernel and it will triple fault but you run it again without any changes and it works fine? Usually that is a sign that there is a race condition somewhere.
Also, where exactly does it fault? Is it actually in fork() or is it in something like switch_task() that runs after fork()?
Re: Forking causes triple fault occasionally
Posted: Thu Oct 16, 2008 4:43 am
by JamesM
First thing I'd check is your Makefile dependencies - when you change the process header, does all the process code actually get rebuilt? If not, try a make clean.
Re: Forking causes triple fault occasionally
Posted: Thu Oct 16, 2008 5:23 pm
by piranha
I do a make clean...every time I update a header. The problem persists.
The triple fault occurs every time I run it with the added thing. When I remove it, it runs fine.
By occasionally, I mean some new additions are fine, some make it angry. I'll spend like, an hour debugging it and I don't find anything, so I remove all the debugging stuff and sometimes it works fine, and sometimes it doesn't.
-JL
Re: Forking causes triple fault occasionally
Posted: Thu Oct 16, 2008 8:59 pm
by cr2
piranha, give us an example of one or two of the bugs that came up. Besides, stuff like this happens (alot). Its probably the result of a weird linker(or compiler) bug.
Re: Forking causes triple fault occasionally
Posted: Thu Oct 16, 2008 9:13 pm
by piranha
Well, I added a 'u32int *wait' to the structure that blocks the task from being scheduled if it so requests. The pointer gets set to a variable. Once the variable becomes true, it unblocks the process.
The test wasn't even using the new feature, and I called 'fork' and it died...
Are there any ways to get around such a compiler bug if thats the problem?
-JL
Re: Forking causes triple fault occasionally
Posted: Thu Oct 16, 2008 9:29 pm
by cr2
Could you turn off optimization? This might help...
Re: Forking causes triple fault occasionally
Posted: Thu Oct 16, 2008 9:58 pm
by piranha
Well, unfortunately, it's temperamental, so it's difficult to test. I tried to add some new things to the struct, and it seemed fine...