[haiku-development] debugging memory allocations

  • From: Lucian Adrian Grijincu <lucian.grijincu@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 5 Jul 2010 17:20:03 +0300

Hi,

I'm having some problems regarding the Haiku+LKL interaction.


== Question ==

How can I debug memory layout problems from the KDL console?
I'd like to find out the access rights for kernel pages.


== Problem ==
LKL boots the Linux kernel and is able to correctly free it's
resources when it is unloaded.

I managed to mount/unmount an EXT4 partition and list the files in
it's root directory (just a silly test to see that things really
work).

However I've reached a problem: after loading/unloading a few times
the Linux kernel and mounting/unmounting the same partition a few
times during the Hiaku boot process, I sometimes get a page fault that
says that the instruction at address 0x80234e09 (an example) cannot
access the memory at address 0x80234e09 (the kernel wants to run some
code, but cannot execute that code).

I guess this can happen in cases where the code misses execution
permissions (as I've said in a previous email I had to hack into
Haiku's add-on loader to accommodate a combined .text+.data section as
with LKL) or when the code was unmapped from memory.

The instruction is only sometimes from lkl. It happened a few times
while in what should be normal performing Haiku code.

An illustrative example: it once happened while executing the x86
'halt' asm instruction (on the idle cpu thread).

I suspect a race on my part of the code. This suspicion is fueled more
by the disappearance of the problem after activating tracing in some
VM related files (e.g. TRACE_VM_PAGE in
src/system/kernel/vm/vm_page.cpp).


-- 
 .
..: Lucian

Other related posts: