ip_reass() - possibly incorrect goto

2005-03-22 Thread Vijay.Singh
Hi hackers, I am looking at the ip_reass() routine. In case of the 1st fragment 
we create the reassembly queue. After the queue has been inserted in the hash 
bucket, the if () code does a " goto inserted". Should this be changed to "goto 
done" instead? Any code that is executed for the 1st fragment, like frag per 
packet limiting and complete reassembly are not valid. Am I mistaken?

br
vijay
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: memory leak in inflate.c

2005-03-15 Thread Vijay.Singh
Thanks. Could someone generate the patch as I dont have the latest
FreeBSD source checked out.

br
vijay

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of ext Marc Olzheim
Sent: Tuesday, March 15, 2005 11:31 AM
To: Marco Molteni
Cc: freebsd-hackers@freebsd.org
Subject: Re: memory leak in inflate.c


On Mon, Mar 14, 2005 at 09:43:52PM +0100, Marco Molteni wrote:
> On Mon, 14 Mar 2005 <[EMAIL PROTECTED]> wrote:
> > Hi, I am trying to debug a memory leak in executing gzipped binaries
  ^^
> > when the parameter list is too long. The function in question is
> > inflate_dynamic(). 
>
> _If_ I remember correctly, if inflate_dynamic() returns a non-zero
> code it means that the decompression failed and the program itself
> quits right away, no memory leak. Or am I missing something?

Your missing something: /usr/src/sys/kern/inflate.c ;-)

Looks like a good patch to me.

Marc
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


memory leak in inflate.c

2005-03-14 Thread Vijay.Singh
Hi, I am trying to debug a memory leak in executing gzipped binaries when the 
parameter list is too long. The function in question is inflate_dynamic(). 

/* decompress until an end-of-block code */
if (inflate_codes(glbl, tl, td, bl, bd))
return 1;

/* free the decoding tables, return */
huft_free(glbl, tl);
huft_free(glbl, td);
return 0;


Should this be re-written as:

i = inflate_codes(glbl, tl, td, bl, bd) ? 1 : 0;

/* free the decoding tables, return */
huft_free(glbl, tl);
huft_free(glbl, td);

return (i);

so that the Huffman tables are always freed.

Comments appreciated.

br
vijay


___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: partial memory dump

2005-03-08 Thread Vijay.Singh
Hi, thanks for the quick reply. I do indeed write the bitmap, which is a part 
of the sysdump_hdr structure to the disk. The disk routine does not currently 
report that it had to miss any block. Here is what I get from dadump().

dumpsys() in machdep.c
dumping to dev 20401, offset 0

dadump()
dodump: 1
USRSTACK: 0xbfbfc000 to 0xe6fa5000
Maxmem: 524288, secsize: 512
dumplo: 0, num: 84872, size: 2097152
next block to write: 90640 @ 8 blocks/req
Dumping bitmap at addr e6fa5000 to sec 16210, 88 sectors
next block to write: 90776 @ 8 blocks/req
Dumping 0x2960 pages of memory to sec 0x16298, 0x14b00 sectors


This version of dadump() does not implement write combining yet. Do you think 
savecore is not able to find the data blocks correctly in the swap?

br
vijay

-Original Message-
From: ext Dan Nelson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 08, 2005 1:40 PM
To: Singh Vijay (Nokia-NET/MtView)
Cc: freebsd-hackers@freebsd.org
Subject: Re: partial memory dump


In the last episode (Mar 08), [EMAIL PROTECTED] said:
> Hello all. I am trying to allow a FreeBSD based kernel to crash dump
> even if configured swap is not enough to fill entire physical memory.
> This is because there could be 2G RAM on the system. I assume that
> most pages would not be mapped.
> 
> The algorithm to do this is to have a bitmask, with bits set for
> pages: from 0 to Maxmem, and then adding pages from USRSTACK to
> vm_map_max(kmem_map).  This is done in scsi_da.c, dadump() routine. I
> am able to get the dump, and after savecore collects it from swap I
> get the kernel and core files. However I am not able to get the stack
> trace.

I think you also need to write that bitmap to disk so that savecore can
read it and put the data blocks in the right place in the vmcore file. 
You want to end up a with a sparse file, with blank spots every place
dadump skipped a block.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


partial memory dump

2005-03-08 Thread Vijay.Singh
Hello all. I am trying to allow a FreeBSD based kernel to crash dump even if 
configured swap is not enough to fill entire physical memory. This is because 
there could be 2G RAM on the system. I assume that most pages would not be 
mapped. 

The algorithm to do this is to have a bitmask, with bits set for pages: from 0 
to Maxmem, and then adding pages from USRSTACK to vm_map_max(kmem_map).  This 
is done in scsi_da.c, dadump() routine. I am able to get the dump, and after 
savecore collects it from swap I get the kernel and core files. However I am 
not able to get the stack trace. 

Anything in the design (pages) that I might have missed?

nexthop[admin]# gdb -k kernel.2 vmcore.2
GDB is free software and you are welcome to 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.
GDB 4.16 (i386-unknown-freebsd), 
Copyright 1996 Free Software Foundation, Inc...(no debugging symbols found)...
IdlePTD 69f000
current pcb at 4dd794
panic: page fault
#0  0xf6371ade in boot (cannot read proc at 0xca6c0400
)
(kgdb) bt
#0  0xf6371ade in boot (cannot read proc at 0xca6c0400
)
cannot read proc at 0xca6c0400

br,
vijay

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


loading kernel at any physical address

2004-12-15 Thread Vijay.Singh
Hello all, for a project I am trying to figure out how to boot a FreeBSD kernel 
loaded at any physical address. Right now the locore.s magic works because the 
load addres (KERNLOAD) and (KERNBASE) are set such that

#define R(foo) ((foo)-KERNBASE)

macro is able to get the addresses before paging is enabled.

If the loadaddress information is not embedded in defines, then is the 
following solution expected to work:

.globl  _loadaddress/* should be at 16M aligned ??? */
.set_loadaddress,KERNBASE

and then:

NON_GPROF_ENTRY(btext)

nop /* nops for 8 byte alignment */
nop
nop
call 0f
0:
mov 4(%ebp), %eax
add $-8, %eax   /* This is actual physical load addr */
add $-0x10, %eax
subl %eax, _loadaddress /* new kernbase w.r.t load addr */
/* instead of standard 1MB reloc */

and then 

#define R(foo) ((foo)- _loadaddress)

One issue might be loadaddress over 16M, but for this problem we can assume 
that the processor has been in protected mode, so it has access to that space.

Any input on this is highly appreciated.

br
vijay


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: integer and long max/min values

2003-11-21 Thread Vijay.Singh
Write a simple C program to ++ an int or long variable and see when it overflows.

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of ext 
> Tim Kientzle
> Sent: Friday, November 21, 2003 12:24 AM
> To: Jay Sern Liew
> Cc: [EMAIL PROTECTED]
> Subject: Re: integer and long max/min values
> 
> 
> Jay Sern Liew wrote:
> > how do I find out the maximum (and minimum) value a long 
> and int will hold
> > in C? (before it overflows or underflows)
> 
> #include 
> 
> INT_MAX and INT_MIN  are the max/min values for an int
> LONG_MAX and LONG_MIN are the max/min values for long.
> 
> Also, see stdint.h, which is defined in C99.
> 
> Also, buy a good C reference book.  ;-)
> 
> Tim Kientzle
> 
> ___
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to 
> "[EMAIL PROTECTED]"
> 
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: sendfile in FreeBSD 2.2

2003-06-03 Thread Vijay.Singh
Hi, I am following up my own post. I have been able to do most of the porting, but I 
have one question. What do I replace the OFF_TO_IDX() macro with? I could start with 
code that always passes the offset as 0 (sending the complete file). Any help would be 
appreciated.

br
vijay

-Original Message-
From: ext Yaoping Ruan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 21, 2003 12:42 PM
To: Singh Vijay (NET/MtView)
Cc: [EMAIL PROTECTED]
Subject: Re: sendfile in FreeBSD 2.2


Hi,
VOP_GETVOBJECT() macro is created by kern/vnode_if.pl and vnode_if.src. By running 
them you should be able to get vnode_if.c and vnode_if.h file. In vnode_if.h, you will 
get the macro defined as follow: (From FreeBsd 4.6)

static __inline int VOP_GETVOBJECT __P((
struct vnode *vp,
struct vm_object **objpp));
static __inline int VOP_GETVOBJECT(vp, objpp)
struct vnode *vp;
struct vm_object **objpp;
{
struct vop_getvobject_args a;
int rc;
a.a_desc = VDESC(vop_getvobject);
a.a_vp = vp;
a.a_objpp = objpp;
rc = VCALL(vp, VOFFSET(vop_getvobject), &a);
return (rc);
}

Hope this helps.

- Yaoping


> Message: 19
> Date: Wed, 21 May 2003 09:32:26 -0700
> From: <[EMAIL PROTECTED]>
> Subject: sendfile in FreeBSD 2.2
> To: <[EMAIL PROTECTED]>
> Message-ID:
>
> Hello. Would it be possible to port the sendfile system call to a FreeBSD 2.2 based 
> system? Has anyone done this? I am trying to port the code from a later FreeBSD 
> release and I have been unable to find out what the VOP_GETVOBJECT() macro does and 
> how/what should it be replaced with for my case. Any help is appreciated.
>
> Thanks
> vijay

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


panic with kqueue

2003-01-22 Thread Vijay.Singh
Greetings. I am trying to port kqueue to a FreeBSD 2.x based system. I have taken the 
base code from the 4.4.0-Release and then merged fixes all the way to the current 
version of the kern_event.c file. Some other changes needed were 

1. adding struct klist p_klist to the proc struct
2. adding struct klist si_note to the selinfo struct
3. adding function pointer fo_kqfilter and file type DTYPE_KUEUE to the file struct

etc

I have added a KNOTE(&p1->p_klist, NOTE_FORK | p2->p_pid); to kern_fork.c and I get 
this panic

Fatal trap 12: page fault while in kernel mode
fault virtual address   = 0x46
fault code  = supervisor read, page not present
instruction pointer = 0x8:0xc01716c8
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, def32 1, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 1 (init)
interrupt mask  = 
kernel: type 12 trap, code=0
panic: page fault

syncing disks... done

kernel stack backtrace:
_panic(fmt=100) at _panic+0x64
_panic(fmt=c02dbdac) at _panic+0x64
_trap_fatal(frame=bfbffebc) at _trap_fatal+0x2b3
_trap_pfault(frame=bfbffebc,usermode=0) at _trap_pfault+0x1ac
_trap(frame=e7710010) at _trap+0x277
calltrap() at calltrap+0x15
--- trap 12, eip = 0xc01716c8, ebp = 0xbfbfff00 ---
_knote(list=c7c8f700,hint=4005) at _knote+0x14
_fork1(p1=c7c8f600,isvfork=0,retval=bfbfff8c) at _fork1+0x3fb
_fork(p=c7c8f600,uap=bfbfff94,retval=bfbfff8c) at _fork+0x10
_syscall(frame=27) at _syscall+0x172
_Xsyscall() at _Xsyscall+0x2b
--- syscall 2, eip = 0x7d05, ebp = 0xbfbfbd3c ---
Rebooting...

I would really appreciate if someone could offer some help as this is my first real 
kernel work. I am guessing that either the kqueue module has not been inited (I dont 
have SYSINIT and zalloc stuff, I replaced the zalloc with malloc) or the p->p_klist 
isnt being initialized probably with a SLIST_INIT( ). Please help.

regards
vijay

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



[no subject]

2002-11-07 Thread Vijay.Singh
subscribe

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message