Page 1 of 1
Realmode Kernel failsafe
Posted: Sun Aug 12, 2012 2:54 pm
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?
Re: Realmode Kernel failsafe
Posted: Sun Aug 12, 2012 4:18 pm
by Tosi
If some program corrupts the kernel, what's to say that the other kernel in memory hasn't been corrupted as well?
Re: Realmode Kernel failsafe
Posted: Sun Aug 12, 2012 4:24 pm
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.
Re: Realmode Kernel failsafe
Posted: Sun Aug 12, 2012 5:56 pm
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.
"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.
Re: Realmode Kernel failsafe
Posted: Tue Aug 14, 2012 12:09 pm
by JamesM
has anyone tried having another kernel in memory?
Yes - ARM's TrustZone system does just this.
Re: Realmode Kernel failsafe
Posted: Wed Aug 15, 2012 6:20 am
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