From owner-freebsd-current@FreeBSD.ORG Sat Apr 25 17:49:40 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AC38106566C for ; Sat, 25 Apr 2009 17:49:40 +0000 (UTC) (envelope-from ben@wanderview.com) Received: from mail.wanderview.com (mail.wanderview.com [66.92.166.102]) by mx1.freebsd.org (Postfix) with ESMTP id B29818FC18 for ; Sat, 25 Apr 2009 17:49:39 +0000 (UTC) (envelope-from ben@wanderview.com) Received: from harkness.in.wanderview.com (harkness.in.wanderview.com [10.76.10.150]) (authenticated bits=0) by mail.wanderview.com (8.14.3/8.14.3) with ESMTP id n3PHnXF8002417 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 25 Apr 2009 17:49:34 GMT (envelope-from ben@wanderview.com) Message-Id: From: Ben Kelly To: Artem Belevich In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Sat, 25 Apr 2009 13:49:33 -0400 References: <49C2CFF6.8070608@egr.msu.edu> <08D7DC2A-68BE-47B6-8D5D-5DE6B48F87E5@wanderview.com> X-Mailer: Apple Mail (2.930.3) X-Spam-Score: -1.44 () ALL_TRUSTED X-Scanned-By: MIMEDefang 2.64 on 10.76.20.1 Cc: freebsd-current@freebsd.org, Ryan Stone Subject: Re: [patch] zfs livelock and thread priorities X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 25 Apr 2009 17:49:40 -0000 On Apr 24, 2009, at 11:59 PM, Artem Belevich wrote: > Ah! Indeed. > >> va_list va; >> va_start(ap, fmt); >> va_copy(va, ap); >> vsnprintf(p2->p_comm, sizeof(p2->p_comm), fmt, va); >> vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap); > > We also need va_end(va) to clear up after va_copy(); I've updated the patch to use va_copy(). Unfortunately I don't have an AMD64 machine to test on at the moment. However, I did look at other places in the kernel where va_copy() is used so I am hopeful I got it right. Thanks again for the help! - Ben > > I'll give it a try. > > Thanks, > --Artem > > > > On Fri, Apr 24, 2009 at 7:47 PM, Ryan Stone wrote: >> The crash happens because vsnprintf is called twice on the same >> va_list. >> That's not legal. It happens to work on i386, but it will crash on >> amd64. >> The patch should instead do: >> >> va_list va; >> va_start(ap, fmt); >> va_copy(va, ap); >> vsnprintf(p2->p_comm, sizeof(p2->p_comm), fmt, va); >> vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap); >> >> Ryan Stone >> >>