James wrote:

> # will allocate space for a `char *', but it will point to some random
> # memory location. The result of using dbQuery as the first argument to
> # sprintf() will be undetermined. The one thing of which you can be sure
> # is that it will write to some memory which it shouldn't be writing to.
> 
> about this... if one of my programs goes a bit mad and tries to write
> to something it shouldn't, does the memory write actually take place?
> or does Linux realise before and kill the process?

It depends upon whether the memory is writable. If it isn't,
attempting to write to it will cause a segfault.

> it creates a page fault because the memory wanted won't currently be in
> physical ram, Linux would go and fetch this page (if it exists), realise
> that the process doesn't have rights to access this page and send a SIGSEGV
> to the process. process then drops dead, creates a corefile and the user
> goes 'huh?... oh, missed the flipping & in my scanf'
> [is that right?]

The segfault would occur regardless of whether the page was present in
physical RAM. Resident pages can be read-only.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to