Re: duplicate a variable!!!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/04/2011 14:54, VAUGHAN Jay wrote:
That would be my question too. I know a little (but not much)
about hardening code, and I am aware of some of the issues if there
can be unexpected outside influences on your program (such as
radiation or hardware issues causing changes to memory locations).
I can't see any way in which some sort of general duplication of
variables would help.


The 'proper' way to do it is with C macro's that can be used to
declare, increment, and decrement, values in a redundnat structure
containing both the inverted value as well as non-inverted value, a
macro for setting the value (which also sets the inverted value), and
a macro (and error handling) for checking the value and ensuring that
it is the inverse of the inverted-values before it is used ..


I am not sure if that is the "proper" way to do it - because I am far from convinced that there /is/ a good way to harden software against memory errors using only software. It depends on what the OP is trying to achieve, which we don't know at the moment. But certainly macros like you suggest could be one way to get some hardening effects.

"Real" solutions to hardening systems against unexpected errors in memory are done in hardware. The most obvious case is to use ECC memory. For more advanced reliability, you use two processor cores in lock-step (this is done in some car engine controllers, for example). The next step up is to do things in triplicate and use majority voting (common on satellites and other space systems). For the most demanding systems you use three independently developed systems (hardware and software) using different components, technologies, and development tools, and use majority voting (you see this sort of thing in passenger plane control systems).

"Hardening" software by hacking the compiler to generate duplicate variables sounds like an academic exercise at best.

But maybe I am completely misunderstanding what the OP is doing - I'm reading a lot into a couple of short sentences.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux