Re: far pointer
- From: Joe Wright <joewwright@xxxxxxxxxxx>
- Date: Mon, 01 Aug 2005 17:33:32 -0400
CBFalconer wrote:
Sounds like the Safety mechanism still needs work. The Security side is rock solid. There is no way to find out where the launching missles are coming from or where they are going. :-)Malcolm wrote:
"pete" <pfiland@xxxxxxxxxxxxxx> wrote
I'm reading Malcolm as being wrong. The restriction that pointers must be calculated within the object, has nothing to do with comparing pointers for equality.
Example restored.
/* OK */ int x[256];
int *ptr1 = x; int *ptr2 = x + 128;
while(ptr2 != ptr1) ptr2--;
/* silly game, may work as expected may go horribly wrong */ int x[128]; int y[128];
int *ptr1 = x; int *ptr2 = y;
while(ptr2 != ptr1) ptr2--;
These could easily compile to exactly the same machine code. What the hacker who wrote the second example is relying on is that array y is probably next to array x in memory. As he decrements, ptr2 will eventually count down to ptr1, which is the start of x. If we write a value as we loop, array x will be set.
Unfortunately, it could happen that x and y are in different segments on a DOS machine. Therefore the array will be set, as before, but the loop won't terminate properly because ptr1 and ptr2 don't compare as equal, despite pointing to the same physical location. This only happens because we've managed to defeat C's pointer management system. It can't happen if we do things properly, as in example 1.
It's worse than that, and doesn't require segmented memory. There is no guarantee, even given a stack machine (which we are not) that x is assigned space above (or below) y. It is likely (but again not guaranteed) that one of those two cases will apply.
On the DS9000 the direction is the opposite of whatever you test,
and all i/o is memory mapped. There is no memory access violation
for this run. The act of pointing to an i/o location causes a
default set of 1's to be written for efficiency reasons. A 1 bit
launches a missile. For safety reasons the designers have required
confirmation with a matching 1 bit in the 127 adjacent locations. Now, if you guess wrong, all missiles are launched.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
.- Follow-Ups:
- Re: far pointer
- From: CBFalconer
- Re: far pointer
- References:
- far pointer
- From: Meenu
- Re: far pointer
- From: Malcolm
- Re: far pointer
- From: Keith Thompson
- Re: far pointer
- From: pete
- Re: far pointer
- From: Malcolm
- Re: far pointer
- From: CBFalconer
- far pointer
- Prev by Date: Re: Procedure for eliminating static variables?
- Next by Date: Re: something to do with void *
- Previous by thread: Re: far pointer
- Next by thread: Re: far pointer
- Index(es):
Relevant Pages
|