strange Page Fault
Posted: Sat Apr 09, 2005 10:01 am
before a while my kernel work fine. today I just make a small in my kernel, which should not change does not do any pointer operations. after this change user application crash with page fault. take alook to the attached picture. the first one at 0x8048080 which I expect. I don't load all code to memory, I load it when this page fault occure. kernel handle this page fault and return back to user mode. now my application try to call strlen with a defined string, which located at data segment:
then I got page fault at 0x804B000, which out of code/data/bss segment. the application has not extend its heep yet.
CPU tell me this intructions has made the fault:
I can't figure why "mov %esp,%ebp" cased page fault at 0x804B000!!!
I am sure there is something in my kernel has cased this. the application I written work on linux like a charm, that mean something on my kernel make damage.
for any HINTS I will be appreciated!
[tt]
CODE start at 8048000
DATA start at 8049be0
error copy segment 8049be0 offset BE
Exception #14 (pagefault)
EDI=0 ESI=0 EBP=804aff4 ESP=d033dfe0
EBX=0 EDX=0 ECX=0 EAX=1
DS=2B ES=2B FS=2B GS=2B
int=0E err=06 EIP=8048561 CVS=33
uSP=804afbc uSS=2B
[/tt]
Code: Select all
write(1, "\x1B[2J", strlen("\x1B[2J"));
80480a3: 83 ec 04 sub $0x4,%esp
80480a6: 83 ec 08 sub $0x8,%esp
80480a9: 68 d7 8b 04 08 push $0x8048bd7
80480ae: e8 ad 04 00 00 call 8048560 <strlen>
80480b3: 83 c4 0c add $0xc,%esp
80480b6: 50 push %eax
80480b7: 68 d7 8b 04 08 push $0x8048bd7
80480bc: 6a 01 push $0x1
80480be: e8 08 02 00 00 call 80482cb <write>
80480c3: 83 c4 10 add $0x10,%esp
CPU tell me this intructions has made the fault:
Code: Select all
08048560 <strlen>:
8048560: 55 push %ebp
8048561: 89 e5 mov %esp,%ebp
8048563: 8b 55 08 mov 0x8(%ebp),%edx
8048566: 89 d0 mov %edx,%eax
8048568: 80 3a 00 cmpb $0x0,(%edx)
804856b: 74 09 je 8048576 <strlen+0x16>
804856d: 8d 76 00 lea 0x0(%esi),%esi
8048570: 40 inc %eax
8048571: 80 38 00 cmpb $0x0,(%eax)
8048574: 75 fa jne 8048570 <strlen+0x10>
8048576: 29 d0 sub %edx,%eax
8048578: 5d pop %ebp
8048579: c3 ret
804857a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
I am sure there is something in my kernel has cased this. the application I written work on linux like a charm, that mean something on my kernel make damage.
for any HINTS I will be appreciated!
[tt]
CODE start at 8048000
DATA start at 8049be0
error copy segment 8049be0 offset BE
Exception #14 (pagefault)
EDI=0 ESI=0 EBP=804aff4 ESP=d033dfe0
EBX=0 EDX=0 ECX=0 EAX=1
DS=2B ES=2B FS=2B GS=2B
int=0E err=06 EIP=8048561 CVS=33
uSP=804afbc uSS=2B
[/tt]