On Sun, 01 Jul 2001 17:05:52 GMT, [EMAIL PROTECTED] (John R
Ramsden) sat on a tribble, which squeaked:

>One clever use for GPFs in an old OS called Primos (anyone
>remember that?) was to detect kernel stack overflows. The
>idea was that you positioned the stack in virtual address
>space so that its end abutted onto a page marked void in
>the address translation tables, in effect a "hole" in the
>virtual address space. Then, if some rogue code overflowed
>the stack it would try and reference an address in this page
>and immediately throw up a page fault error. I think they
>did the same with the (smaller but even more critical)
>fault stacks, e.g. to catch recursive page fault errors.
>
>I'd be surprised if the same trick isn't used, even more
>extensively, in Windoze these days, since many ex-Primates
>probably migrated to Microsoft after Prime Computer Inc's
>woes in the early '90s.

Windoze does use a trick like that to detect when it needs to read a
page in from swap. A swapped-out page is marked void in the virtual
address table, and access to it triggers a page fault. The page is
then swapped in, unless it's truly bogus, in which case an application
fault occurs.

On comp.os.msdos.djgpp there's been some discussion about having the
runtime environment detect stack overflows by exactly the mechanism
you just described.

>> As opposed to [2] the GPF's this guy is hiding - these
>> are not GPF's that are supposed to happen.
>
>Mind you, I can see how this might make more efficient and
>streamlined the kind of code in which references through
>null pointers were an anticipated but infrequent event.

Yeah, and I can see how this might be the most god-awful kluge in
world history, particularly when you can't distinguish accessing a
null pointer deliberately from doing so due to a bug.


-- 
Bill Gates: "No computer will ever need more than 640K of RAM." -- 1980
"There's nobody getting rich writing software that I know of." -- 1980
"This antitrust thing will blow over." -- 1998
Combine neo, an underscore, and one thousand sixty-one to make my hotmail addy.


=================================================================
Instructions for joining and leaving this list and remarks about
the problem of INAPPROPRIATE MESSAGES are available at
                  http://jse.stat.ncsu.edu/
=================================================================

Reply via email to