Forking causes triple fault occasionally

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Forking causes triple fault occasionally

Post 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
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Re: Forking causes triple fault occasionally

Post 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()?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Forking causes triple fault occasionally

Post 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.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: Forking causes triple fault occasionally

Post 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
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
cr2
Member
Member
Posts: 162
Joined: Fri Jun 27, 2008 8:05 pm
Location: ND, USA

Re: Forking causes triple fault occasionally

Post 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. :?
OS-LUX V0.0
Working on...
Memory management: the Pool
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: Forking causes triple fault occasionally

Post 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
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
cr2
Member
Member
Posts: 162
Joined: Fri Jun 27, 2008 8:05 pm
Location: ND, USA

Re: Forking causes triple fault occasionally

Post by cr2 »

Could you turn off optimization? This might help...
OS-LUX V0.0
Working on...
Memory management: the Pool
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: Forking causes triple fault occasionally

Post 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...
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Post Reply