Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Apr 2004 03:31:00 -0500
From:      "James R. Van Artsalen" <james@jrv.org>
To:        freebsd-amd64@freebsd.org
Subject:   Re: malloc: bug or feature ?
Message-ID:  <40765F44.9070705@jrv.org>
In-Reply-To: <407539A6.4090701@jrv.org>
References:  <4073F699.6010402@cri.ensmp.fr> <20040407125532.GA75228@stack.nl> <200404070837.43253.peter@wemm.org> <407539A6.4090701@jrv.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080301050909070408070807
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Peter Wemm wrote:

> The SEGV looks suspicious though.  I wonder if malloc is trying to put 
> the junk in without checking if malloc failed.


Attached is a proposed patch for this bug.  It fixes the test program 
(which now fails the ASSERT in main() as it ought to).  I have not 
tested it in any other way.

Without this change I expect every brk(2) call that fails to crash.

I haven't checked for equivalent bugs in other functions.

--------------080301050909070408070807
Content-Type: text/plain;
 name="pat.brk"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="pat.brk"

--- lib/libc/amd64/sys/brk.S.~1~	Sat May 24 12:35:23 2003
+++ lib/libc/amd64/sys/brk.S	Fri Apr  9 02:02:22 2004
@@ -78,6 +78,7 @@
 	popq	%rdi
 	ret
 err:
+	popq	%rdi
 #ifdef PIC
 	movq	PIC_GOT(HIDENAME(cerror)),%rdx
 	jmp	*%rdx

--------------080301050909070408070807--



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