Out of Stack Region Read Fault

So it could just be that its late and that I am missing something, but I am approaching a weird error while trying to run /testbin/stacktest. As you can see from my print outs below, I am successfully creating the segments from base --> bounds with proper permissions (Even though the don’t really do much right now). I am successfully creating pages for VM_FAULT_WRITEs, and for VM_FAULT_READ we either:

  • Return EFAULT if the a page does not exist in the segment, as you shouldn’t read from something that hasn’t been writen to yet. OR
  • Get the page that the address corresponds to and continue normally.

but I notice that it is requesting an address in the stack that hasn’t been written to yet, and that doesn’t have a page created yet. If it is something involving with the stack growing downwards, note that we have the base and bounds still for the stack, and treat it as any other segment/region.

Is this a normal operation for the stack, to read from a page before it is allocated/written to? I don’t believe so, but then I don’t know why this would be happening…

If anyone can provide any help, that would be much appreciated! :smile:

Program Trace:

OS/161 kernel [? for menu]: p /testbin/stacktest
HEAP: 0x20000000 --> 0x20000000
CODE/TEXT: Executable, Readable, 0x400000 --> 0x4021a4
Writeable, Readable, 0x4121b0 --> 0x4125d0
Requested 0x400000, so adding page to cover 0x400000 -> 0x400fff.
Requested 0x401000, so adding page to cover 0x401000 -> 0x401fff.
Requested 0x402000, so adding page to cover 0x402000 -> 0x402fff.
Requested 0x4121b0, so adding page to cover 0x412000 -> 0x412fff.
Writeable, Readable, 0x7fa00000 --> 0x80000000
Reading page at 0x400000
Requested 0x7fffffec, so adding page to cover 0x7ffff000 -> 0x7fffffff.
Reading page at 0x400000
Reading page at 0x7fcdf000
Fatal user mode trap 2 sig 11 (TLB miss on load, epc 0x400180, vaddr 0x7fcdffd0)
Operation took 1.353794513 seconds

Note that the ‘Reading page at’ values are all page-aligned, and so are additions

That’s valid behavior, if a bin unusual. Read the test and it will make a lot more sense :-).

Figured it out, thanks!