Hi,<div><br><div>Could you explain more about how the OS initialize the malloced pages? Or which part of the kernel code can do thatThanks!<br><br><div class="gmail_quote">2012/1/12 Dave Hylands <span dir="ltr"><<a href="mailto:dhylands@gmail.com" target="_blank">dhylands@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<div><br>
On Wed, Jan 11, 2012 at 4:53 AM, ÏÄÒµÌí <<a href="mailto:summerxyt@gmail.com" target="_blank">summerxyt@gmail.com</a>> wrote:<br>
> Hi,<br>
> My tutor asked me to test whether one process leaves information in<br>
> memory after it is dead. I tried to search some article about such thing on<br>
> the Internet but there seems to be no one discuss about it. And after that,<br>
> I tried to write some program in the User Mode to test it, using fork() to<br>
> create lots of processes and filling char 'a' into a 102400 bytes char array<br>
> in each process. Then I used malloc() to get some memory to seek char 'a' in<br>
> a new one process or many new processes, but failed. All memory I malloced<br>
> was full of zero.<br>
<br>
</div>Yeah - so if it were possible for one process to get information about<br>
another process like that you would have a security leak.<br>
<div><br>
> As the man page of malloc said:"The memory is not initialized", I believe<br>
> that the memory which was got by malloc() could be used by other process,<br>
> and therefor information leakage exists. But how can I test it? Or where can<br>
> I get related information?<br>
<br>
</div>All pages allocated from the OS will be initially zero'd, however,<br>
once your process owns the page, if you filled it with Z's and then<br>
freed it and reallocated you might very weill get your Z's back<br>
instead of 0's. You'll never get data from another process though.<br>
<span><font color="#888888"><br>
--<br>
Dave Hylands<br>
Shuswap, BC, Canada<br>
<a href="http://www.davehylands.com" target="_blank">http://www.davehylands.com</a><br>
</font></span></blockquote></div><br></div></div>