Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Nov 2005 03:20:37 -0800 (PST)
From:      kamal kc <kamal_ckk@yahoo.com>
To:        freebsd <freebsd-hackers@freebsd.org>
Subject:   fatal trap 12; page fault in kernel mode --HELP
Message-ID:  <20051107112037.19786.qmail@web35715.mail.mud.yahoo.com>

next in thread | raw e-mail | index | archive | help
dear all,

i am written code for compression/decompression
which works very fine for binary as well as the
ascii data.

i have put the routine just before the 
if_output() so that i do not interfere with 
the kernel ip operations.


Now the compression/decompression works fine most 
of the times but eventually i get a fatal trap, 
sooner or later.

my compression/decompression uses about 14KB of 
memory per packet which i malloc/free after the
job is done. 

the fatal trap i observed is:
-------------

Fatal Trap 12 page fault while in kernel mode
fault virtual address=0xc195600
fault code=supervisor write, page not present
instruction pointer=0x8:0xc0594877
stack pointer =0x10:0xcc6218fc
frame pointer=0x10:0xcc621908
code segment=base 0x0, limit 0xfffff, type 0x1b
		       = DPL 0, pres 1, def 32 1, gran
processor eflags=interrupt enabled, resume, IOPL=0
current process=37(swi1:net)
trap number=12
panic:page fault

------------

i used the core dump with kgdb and got the following 
results:


decomp#	kgdb kernel.debug /var/crash/vmcore.35
[GDB will not be able to debug user-mode threads:
/usr/lib/libthread_db.so: 
Undefined symbol "ps_pglobal_lookup"]
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General
Public License, and you are
welcome to change it and/or distribute copies of it
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show
warranty" for details.
This GDB was configured as "i386-marcel-freebsd".
#0  doadump () at pcpu.h:159
159		__asm __volatile("movl %%fs:0,%0" : "=r" (td));
(kgdb) bt
#0  doadump () at pcpu.h:159
#1  0xc0510c86 in boot (howto=260) at
../../../kern/kern_shutdown.c:410
#2  0xc0510f1c in panic (fmt=0xc06b5c31 "%s")
    at ../../../kern/kern_shutdown.c:566
#3  0xc068eb30 in trap_fatal (frame=0xcc6218bc,
eva=3247792128)
    at ../../../i386/i386/trap.c:817
#4  0xc068e89b in trap_pfault (frame=0xcc6218bc,
usermode=0, eva=3247792128)
    at ../../../i386/i386/trap.c:735
#5  0xc068e4fd in trap (frame=
      {tf_fs = 24, tf_es = 16, tf_ds = 16, tf_edi =
-1047715840, tf_esi = -1047207936,
	 tf_ebp = -865986296, tf_isp = -865986328, tf_ebx =
-1047209984,
      tf_edx = 129, tf_ecx = 34816, tf_eax = 256,
tf_trapno = 12, tf_err = 2,
   tf_eip = -1067890569, tf_cs = 8, tf_eflags = 66054,
tf_esp = 376, tf_ss = 385})
    at ../../../i386/i386/trap.c:425
#6  0xc067efea in calltrap () at
../../../i386/i386/exception.s:140
#7  0x00000018 in ?? ()
#8  0x00000010 in ?? ()
#9  0x00000010 in ?? ()
#10 0xc18d2000 in ?? ()
#11 0xc194e000 in ?? ()
#12 0xcc621908 in ?? ()
#13 0xcc6218e8 in ?? ()
#14 0xc194d800 in ?? ()
#15 0x00000081 in ?? ()
---Type <return> to continue, or q <return> to quit---
#16 0x00008800 in ?? ()
#17 0x00000100 in ?? ()
#18 0x0000000c in ?? ()
#19 0x00000002 in ?? ()
#20 0xc0594877 in get_string (code=0,
decode_stack=0xc194d800 "", 
    code_value=0xc18d1000, prefix_code=0xc18d2000, 
    append_character=0xc194e000 "",
add_index=0xcc621940)
    at ../../../netinet/ip_output.c:2733
#21 0xc0594739 in decompress_the_ip_packet
(ipheaderlength=0, 
    ippacketlength=0, compressed_buffer=0xc194f000 "",

    output_buffer=0xc194e800 "") at
../../../netinet/ip_output.c:2665
#22 0xc0593ec8 in copy_the_memorybuffer (m=0xc1904900)
    at ../../../netinet/ip_output.c:2237
#23 0xc05922ae in ip_output (m=0xc1904900,
opt=0xc1941010, ro=0xcc6219c8, 
    flags=1, imo=0x0, inp=0x0) at
../../../netinet/ip_output.c:827
#24 0xc05918d8 in ip_forward (m=0xc1904900, srcrt=0)
    at ../../../netinet/ip_input.c:1780
#25 0xc05905f7 in ip_input (m=0xc1904900) at
../../../netinet/ip_input.c:679
#26 0xc05806d3 in netisr_processqueue (ni=0xc074d0b8)
    at ../../../net/netisr.c:233
#27 0xc05808ca in swi_net (dummy=0x0) at
../../../net/netisr.c:346
#28 0xc04fd599 in ithread_loop (arg=0xc1541200)
    at ../../../kern/kern_intr.c:547
#29 0xc04fc82c in fork_exit (callout=0xc04fd448
<ithread_loop>, 
---Type <return> to continue, or q <return> to quit---
    arg=0xc1541200, frame=0xcc621d48) at
../../../kern/kern_fork.c:791
#30 0xc067f04c in fork_trampoline () at
../../../i386/i386/exception.s:209
(kgdb) list *0xc0594877
0xc0594877 is in get_string
(../../../netinet/ip_output.c:2733).
2728			break;
2729		}
2730		*/
2731		i=code-256;
2732		do
2733		{
decode_stack[stack_length++]=append_character[i];
2734		  i=prefix_code[i]-256;
2735		}while(i>=0);
2736		decode_stack[stack_length]=i+256;
2737		return  stack_length;
(kgdb) up 20
#20 0xc0594877 in get_string (code=0,
decode_stack=0xc194d800 "", 
    code_value=0xc18d1000, prefix_code=0xc18d2000, 
    append_character=0xc194e000 "",
add_index=0xcc621940)
    at ../../../netinet/ip_output.c:2733
2733		{
decode_stack[stack_length++]=append_character[i];
(kgdb) print i
$1 = 0
(kgdb) print code
$2 = 0
(kgdb) print &decode_stack[0]
$3 = (unsigned char *) 0xc194d800 ""
(kgdb) print stack_length
$4 = 0
(kgdb) print append_character[0]
$5 = 0 '\0'
(kgdb) print &append_character[0]
$6 = (unsigned char *) 0xc194e000 ""
(kgdb) print &prefix_code[0]
$7 = (u_int16_t *) 0xc18d2000
(kgdb) print decode_stack[0]
$8 = 0 '\0'
(kgdb) quit



append_character[],decode_stack[],prefix_code[],
code_value[] are memory spaces of size 1700 which
i malloc/free for every packet.

in case the get_string() helps i have put the 
code here:

int get_string(u_int16_t code,
unsigned char *decode_stack, u_int16_t *code_value,
			u_int16_t *prefix_code, unsigned char
*append_character)
{	int stack_length;
	stack_length=1;
	
	if(code<=255)  //the code is the basic alphabet
	{decode_stack[1]=code;
	  return 1;
	}

	int i;
	i=code-256;
	do
	{ decode_stack[stack_length++]=append_character[i];
	  i=prefix_code[i]-256;
	}while(i>=0);
	decode_stack[stack_length]=i+256;
	return  stack_length;
}











	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051107112037.19786.qmail>