From owner-freebsd-amd64@FreeBSD.ORG Fri Apr 9 01:32:17 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4FFA716A4CE for ; Fri, 9 Apr 2004 01:32:17 -0700 (PDT) Received: from mail.jrv.org (rrcs-sw-24-73-246-106.biz.rr.com [24.73.246.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id A8AB443D49 for ; Fri, 9 Apr 2004 01:32:16 -0700 (PDT) (envelope-from james@jrv.org) Received: from jrv.org (zippy.jrv.org [192.168.3.156]) (authenticated bits=0) by dogfood.jrv.org (8.12.11/8.12.10) with ESMTP id i398V0HI013530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 9 Apr 2004 03:31:00 -0500 (CDT) (envelope-from james@jrv.org) Message-ID: <40765F44.9070705@jrv.org> Date: Fri, 09 Apr 2004 03:31:00 -0500 From: "James R. Van Artsalen" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-amd64@freebsd.org References: <4073F699.6010402@cri.ensmp.fr> <20040407125532.GA75228@stack.nl> <200404070837.43253.peter@wemm.org> <407539A6.4090701@jrv.org> In-Reply-To: <407539A6.4090701@jrv.org> Content-Type: multipart/mixed; boundary="------------080301050909070408070807" Subject: Re: malloc: bug or feature ? X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2004 08:32:17 -0000 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--