httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject RE: [PATCH] using freed memory, and a memory debugger
Date Fri, 10 Oct 1997 06:35:59 GMT

On Thu, 9 Oct 1997, Charles Randall wrote:

> ****  Purify instrumented ./httpd (pid 10768)  ****
> UMR: Uninitialized memory read:
>   * This is occurring while in:
> 	update_vhost_given_ip [http_vhost.c:753]
> 	new_connection [http_main.c:2230]
> 	child_main     [http_main.c:2806]
> 	make_child     [http_main.c:2897]
> 	startup_children [http_main.c:2957]
> 	standalone_main [http_main.c:3167]
>   * Reading 2 bytes from 0x12c82a in the heap.
>   * Address 0x12c82a is 4146 bytes into a malloc'd block at 0x12b7f8 of
> 8216 bytes.
>   * This block was allocated from:
> 	malloc         [rtlib.o]
> 	malloc_block   [alloc.c:107]
> 	new_block      [alloc.c:207]
> 	palloc         [alloc.c:390]
> 	bcreate        [buff.c:259]
> 	child_main     [http_main.c:2783]

Unfortunately these look bogus.  I seem to recall having these sorts of
problems before with Purify.  If you check the code path up there, it's
definately initialized data. ... it's complaining about: 

unsigned port = ntohs(conn->local_addr.sin_port); 

But there's a: 

conn->local_addr = *saddr; 

which happens in new_connection ... 

Bleh. 

> ****  Purify instrumented ./httpd (pid 10768)  ****
> UMR: Uninitialized memory read:
>   * This is occurring while in:
> 	inet_ntoa      [inet_ntoa.c]
> 	new_connection [http_main.c:2235]
> 	child_main     [http_main.c:2806]
> 	make_child     [http_main.c:2897]
> 	startup_children [http_main.c:2957]
> 	standalone_main [http_main.c:3167]
>   * Reading 1 byte from 0xeffff59a on the stack.
>   * Address 0xeffff59a is 22 bytes below frame pointer in function
> new_connection.

This one I'm not sure about.  But it's probably just as bogus.

When I last had something like this happen I could trace it down to some
unused structure elements ... but I had to do some digging with the
debugger.

If these are clouding the real results try adding something like this in
http_main.c:new_connection before it initializes local_addr:

    memset(&conn->local_addr, 0, sizeof(conn->local_addr));
    memset(&conn->remote_addr, 0, sizeof(conn->remote_addr));

Dean


Mime
View raw message