Hi,<div><br></div><div>I&#39;ve been developing a memory management library on Barrelfish (SCC). Recently I bumped into a very weird bug about page fault. I attached a minimal case (pgfault_test.tgz) that can reproduce this bug.</div>

<div><br>
</div><div>The work flow of the test case is as simple as following:</div><div><br></div><div>1) Allocate an array of doubles as read-only, using frame_alloc and vspace_map_one_frame_attr (or pmap-&gt;f.map, this doesn&#39;t matter)</div>


<div><br></div><div>2) Initiate the array, this will generate page fault</div><div><br></div><div>3) In page fault handler, remap the faulted page as read-write, using pmap-&gt;f.modify_flags</div><div><br></div><div>The weird thing is: the first touch of this array will not result in a proper value, but just NaN!</div>


<div><br></div><div>I&#39;ve conducted several runs and found the following:</div><div><br></div><div>1) This bug will occur when the array type is double or float. Everything is fine if it&#39;s a integer array.</div><div>


<br></div><div>2) Only the item that caused the page fault will end in a NaN value, others items are just fine. And this applies when the faulted be anywhere within that page, not just the page start.</div><div><br></div>


<div>3) If you assign each array value with a constant value (say 1.0), or a int/double variable, then all items will end up with a right value. It seems only when we assign a[i] with i (or any expression contains i) will produce this bug.</div>


<div><br></div><div><div>I tested the attached code in release2012-05-25 (the revision I work on) and the latest revision (release2012-10-03).</div></div><div><br></div><div>I&#39;ve also composed a minimal test case in sccLinux (write_fault.c). It turns out that everything is all good. No annoying NaN values.</div>


<div><br></div><div>This bug has bothered me for quite a few days. Really appreciate if someone can give a hint on this.</div><div><br></div><div>Thanks,</div><div>Jinghao</div>