Realmode Kernel failsafe

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Realmode Kernel failsafe

Post by VolTeK »

I had an idea, since realmode does not have protection that you would see in protected mode, i have decided to plan an API wrapped around my own way of protection. Now this does not mean that it would still be protected but in a case that the kernel does get corrupted by some program, has anyone tried having another kernel in memory? Where an interrupt is fired (that CS:IP recorded) jumping to another segment at the last IP? for example

0x1000:IP -> error, do jmp far 0x2000:IP ? In case of being corrupted (not a software error)

The idea being, having another copy in memory in case of corruption?
Tosi
Member
Member
Posts: 255
Joined: Tue Jun 15, 2010 9:27 am
Location: Flyover State, United States
Contact:

Re: Realmode Kernel failsafe

Post by Tosi »

If some program corrupts the kernel, what's to say that the other kernel in memory hasn't been corrupted as well?
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Realmode Kernel failsafe

Post by Kazinsal »

And what if that kernel copy gets totally wrecked? And how does the first kernel know how to redirect to the second? How do you plan on maintaining the same variable data in both kernels?

Keep in mind that if a program in real mode can trash whatever it pleases, whenever it pleases.
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: Realmode Kernel failsafe

Post by VolTeK »

Blacklight wrote:How do you plan on maintaining the same variable data in both kernels?
A shared pool would be stored after the second kernel.
Blacklight wrote:Keep in mind that if a program in real mode can trash whatever it pleases, whenever it pleases.
Duh. :roll:
"Keep in mind that if a program is executing in real mode, it can trash whatever whenever it pleases."
Is probably what you mean't.
Tosi wrote:If some program corrupts the kernel, what's to say that the other kernel in memory hasn't been corrupted as well?
This in case another program has been loaded right above the kernel, And has placed its stack at the beginning of the program.

|Kernel| |Program_Stack, Program| say for example the program has pushed too many variables to the stack, and heads on into the kernel.

Also note, this kernel multitasks. Say during the kernels operation it hits an invalid opcode (from the stack of the program in front of it) that interrupt then transfers control to the second kernel, at the end of memory. What is everyone's opinion on that?


Edit: Nevermind, there are too many problems that would occur during transfer of kernels. This would be a bad idea.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Realmode Kernel failsafe

Post by JamesM »

has anyone tried having another kernel in memory?
Yes - ARM's TrustZone system does just this.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Realmode Kernel failsafe

Post by Combuster »

And on x86 (and many other systems for that matter), an if(assertion_failed) reboot(); is generally a very effective way to get a known good kernel into memory :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply