From owner-freebsd-amd64@FreeBSD.ORG Wed Oct 27 17:05:23 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 CB08016A4CE; Wed, 27 Oct 2004 17:05:23 +0000 (GMT) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id AC4E143D58; Wed, 27 Oct 2004 17:05:21 +0000 (GMT) (envelope-from peter@wemm.org) Received: from fw.wemm.org (canning.wemm.org [192.203.228.65]) by canning.wemm.org (Postfix) with ESMTP id 7F12A2A8D5; Wed, 27 Oct 2004 10:05:21 -0700 (PDT) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (overcee.wemm.org [10.0.0.3]) by fw.wemm.org (Postfix) with ESMTP id C4008E2B3; Wed, 27 Oct 2004 10:05:20 -0700 (PDT) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (localhost [127.0.0.1]) by overcee.wemm.org (8.13.1/8.13.1) with ESMTP id i9RH5Kpn030532; Wed, 27 Oct 2004 10:05:20 -0700 (PDT) (envelope-from peter@wemm.org) Received: from localhost (localhost [[UNIX: localhost]]) by overcee.wemm.org (8.13.1/8.13.1/Submit) id i9RH5Jrl030531; Wed, 27 Oct 2004 10:05:19 -0700 (PDT) (envelope-from peter@wemm.org) X-Authentication-Warning: overcee.wemm.org: peter set sender to peter@wemm.org using -f From: Peter Wemm To: freebsd-amd64@freebsd.org, obrien@freebsd.org Date: Wed, 27 Oct 2004 10:05:19 -0700 User-Agent: KMail/1.7 References: <20041026115041.GE2841@sivokote.iziade.m$> <417E8F7A.70009@jrv.org> <20041026213227.GA95016@dragon.nuxi.com> In-Reply-To: <20041026213227.GA95016@dragon.nuxi.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410271005.19427.peter@wemm.org> cc: Georgi Guninski cc: roam@freebsd.org cc: "James R. Van Artsalen" Subject: Re: two 4GB mallocs => SEGV 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: Wed, 27 Oct 2004 17:05:23 -0000 On Tuesday 26 October 2004 02:32 pm, David O'Brien wrote: > On Tue, Oct 26, 2004 at 12:55:06PM -0500, James R. Van Artsalen wrote: > > David O'Brien wrote: > > >malloc.c:map_pages() calls brk(2) and this is where it goes to > > > la-la land. > > > > The brk() kernel call is probably failing due to ulimit being > > exceeded and not anything mysterious. > > # ulimit -a | grep virt > virtual memory (kbytes, -v) unlimited The data size limit is 8GB though. > BTW, a statically built binary (ie, using libc.a) just hangs in the > brk(2) call. Yes, and that is rather worrying. > > A few months ago I posted this bug in the libc brk(2) code - the > > stack is not balanced if the kernel returns an error. I'm not > > running current code at the moment but see if you brk.S has a stack > > issue at the err: label. Stick in this pop if so and report if > > malloc(3c) then returns NULL instead of crashing, then up your > > ulimit and try again and see if all works without error. > > > > --- 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 > > Today's code has: > > err: > addq $8, %rsp > #ifdef PIC > movq PIC_GOT(HIDENAME(cerror)),%rdx > jmp *%rdx > > > so the stack should be OK. Where do you see the addq? Its not in cvs that I can see.. Oh, its in sbrk.S - this patch is against brk.S. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5