From owner-freebsd-current@FreeBSD.ORG Tue Aug 24 18:51:20 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B7A2516A4CE; Tue, 24 Aug 2004 18:51:20 +0000 (GMT) Received: from mail.mcneil.com (rrcs-west-24-199-45-54.biz.rr.com [24.199.45.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9583243D2F; Tue, 24 Aug 2004 18:51:18 +0000 (GMT) (envelope-from sean@mcneil.com) Received: from localhost (localhost.mcneil.com [127.0.0.1]) by mail.mcneil.com (Postfix) with ESMTP id CAA6EFD0B6; Tue, 24 Aug 2004 11:20:00 -0700 (PDT) Received: from mail.mcneil.com ([127.0.0.1]) by localhost (server.mcneil.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09961-05; Tue, 24 Aug 2004 11:20:00 -0700 (PDT) Received: from [24.199.45.54] (mcneil.com [24.199.45.54]) by mail.mcneil.com (Postfix) with ESMTP id 2AB97FD06B; Tue, 24 Aug 2004 11:20:00 -0700 (PDT) From: Sean McNeil To: Harti Brandt In-Reply-To: <20040824200225.V517@beagle.kn.op.dlr.de> References: <1092777586.92327.9.camel@server.mcneil.com> <20040817213813.GE3827@gothmog.gr><4127841D.6050104@freebsd.org> <1093369220.10362.6.camel@server.mcneil.com> <20040824200225.V517@beagle.kn.op.dlr.de> Content-Type: text/plain Message-Id: <1093371600.10464.23.camel@server.mcneil.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 24 Aug 2004 11:20:00 -0700 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mcneil.com cc: Giorgos Keramidas cc: Tim Kientzle cc: current@freebsd.org Subject: Re: bsdtar core dumps X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2004 18:51:20 -0000 On Tue, 2004-08-24 at 11:08, Harti Brandt wrote: > On Tue, 24 Aug 2004, Sean McNeil wrote: > [snip] > > Sorry to jump in. > > You cannot use a va_list twice. As soon as someone call va_arg() on the > ap all the aps in the calling functions get invalid. The only thing that > can and must be done is that the function that did the va_start() must > call va_end. > > If you need it twice you must make a copy as in the patch below. > But the function call va_copy must also call va_end() on that copy > (this seems missing in the patch). I took the lead from /usr/src/lib/libc/stdio/vfprintf.c It happens to do a va_copy(orgap,ap) but never does a va_end(orgap). Either vfprintf.c is incorrect or it is not necessary to call va_end(). One point I would like to make clear - you _can_ use a va_list twice on architectures that will pass the va_list argument by value (i.e. i386). This makes it easy to produce faulty code for those architectures that pass by reference and thus have a side-effect. Since most people here are developing and testing on x86 machines I would think this problem to have happened more often than it has. Cheers, Sean