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

Re: [MiNT] Freeing child's base page



From: Miro Kropacek
Sent: Wednesday, January 27, 2010 12:01 AM
To: MiNT Mailing List
Subject: [MiNT] Freeing child's base page

I attached three files as test case, I hope I didn't mess something in such rush. From this you can see very simple scheme:

- proc1 passes pointer to pointer via cmd line to proc 2
- proc2 has one static variable and it stores its address into pointer which he got on command line (i.e. from proc 1)
- proc1 can do anything he likes with this new piece of memory
- as soon as we call Mfree() on proc2's basepage, our new pointer becomes illegal

So what you're saying here is that the child (proc 2) saves an address to a variable in it's own DATA-segment at some location in the parent's (proc 1) memory?

Now, easy answer would be "freeing child's basepage invalidates also its data" but I doubt this makes any sense. I'm unsure

So the problem is that the pointer in proc 1 now points to free memory. If it's Mfree'd then it belongs to the OS now. Of course it's illegal to access this memory now. If LDG does this, it must be considered a bug.

Jo Even

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4807 (20100126) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com