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

Re: GEM and memory protection



> 	Well, I don't know many things about the internal functionnement of
> memory protection, but I always thought it was a way to avoid some programm do
> write (eventually read) in memory used by other programms, except shared
> memory. So I thought it was, for each memory-writing, a test of the owner of
> the destination memory, and if not equal to the writer, error and kill the
> process which tried to write.

It is exactly how does it work.

> 	So : I don't really understand why a shell/desktop that launches a
> child process should be killed because the child does an uncorrect
> writing. For me, as a neophyte user, it sounds like a bug in the memory
> protection... And a very annoying one, because when it causes to kill N.AES
> and then MiNT :-( just because of an incorrect address passed to form_alert(),
> it doesn't make developing easy...

The child doesn't do incorrect writing. It is the shell what makes the
memory violation fault, therefore it gets killed.

The reason for that is the nature of the AV protocol. The AV client and
the AV server share pointers to own memory. Particularly, the AV client
sends a pointer to the AV server, which pointer points to a data structure
located within the client's memory. Then the AV server is supposed to
access this memory to fetch data from there.

If the AV client passes a pointer to its private (protected) memory, the
AV server causes a memory violation fault trying to access data there, and
gets killed. Because the AV server (= desktop) is killed, there's no
shell left in the system, so the AES quits. Termination of the init
process (AES) causes the MiNT to execute Pterm() and quit to TOS. 

The bad thing is that such a crash is a result of perfectly well working
memory protection. That's the current theory :-)

The strange thing is that if the desktop gets killed due to some other
reason (e.g. a bus error), the AES usually survives. Perhaps this is a
point to start improving the situation. Because as I am thinking about it
now, it seems that it is the AES, not the desktop, what is killed due to
the memory violation error.

--
Konrad M.Kokoszkiewicz
|mail: draco@mi.com.pl                  | Atari Falcon030/TT030/65XE |
|http://www.orient.uw.edu.pl/~conradus/ | ** FreeMiNT development ** |

** Ea natura multitudinis est,
** aut servit humiliter, aut superbe dominatur (Liv. XXIV,25)
*************************************************************
** U pospolstwa normalne jest, ze albo sluzy ono unizenie,
** albo bezczelnie sie panoszy.