Hi all
I've been tinkering with my execve() syscall, and have a couple of questions..
in the man page for execve() it says that all the text data and bss are over written with the new task's image, but what about the memory that has been allocated dynamically?
I assumed that execve would require a freshly cleaned address space for the new program, and went about programming such a function and couldn't get it to work.
Thinking about it, is clearing the memory really an issue? If I reset the current "memory allocated" thing to 0, the allocater will just allocate pages again, and if it has stuff in it, well clearing that is the job of the program (or allocater)?
Am I right in thinking that I only need to clear the memory when the task is finished?
execve() and more memory related questions
-
proxy
Re:execve() and more memory related questions
I suppose the real issue is data leakage, if you don't clear things out, a child process could hypothetically read sensitive data from the parent process since it could through some pointer trickery access these uncleared pages.
proxy
proxy
-
JoeKayzA
Re:execve() and more memory related questions
I would say it's the allocator's job to return all allocated pages back to the kernel, or, at least, signal the kernel that it can now take back all the memory (the latter would be neccessary anyway if you want to clean up after a crashing process). Of course it depends on your design as well.spix wrote: Thinking about it, is clearing the memory really an issue? If I reset the current "memory allocated" thing to 0, the allocater will just allocate pages again, and if it has stuff in it, well clearing that is the job of the program (or allocater)?
cheers Joe
