From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 25 16:02:55 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDD88106564A; Mon, 25 Jul 2011 16:02:55 +0000 (UTC) (envelope-from falkman@gamozo.org) Received: from mta11.charter.net (mta11.charter.net [216.33.127.80]) by mx1.freebsd.org (Postfix) with ESMTP id 588988FC2B; Mon, 25 Jul 2011 16:02:55 +0000 (UTC) Received: from imp10 ([10.20.200.15]) by mta11.charter.net (InterMail vM.7.09.02.04 201-2219-117-106-20090629) with ESMTP id <20110725160254.TQTZ4091.mta11.charter.net@imp10>; Mon, 25 Jul 2011 12:02:54 -0400 Received: from [192.168.1.12] ([75.135.75.204]) by imp10 with smtp.charter.net id CG2t1h00Q4QU3rf05G2td8; Mon, 25 Jul 2011 12:02:54 -0400 X-Authority-Analysis: v=1.1 cv=G6Q69DB3AUoJKS2BpLRaz8MQ2NORN7h5HRzrJMPOhRw= c=1 sm=1 a=7Da5kHvgTEoA:10 a=YzQM1Zd3q-sA:10 a=EZ1XIdwCItEA:10 a=8nJEP1OIZ-IA:10 a=HEs2YkztZRVyeANDsLw8Eg==:17 a=0ba4Quu-sbMiyhfFzusA:9 a=PRLA-718_G6QWoxCTdsA:7 a=wPNLvfGTeEIA:10 a=HEs2YkztZRVyeANDsLw8Eg==:117 Message-ID: <4E2D93AD.4000103@gamozo.org> Date: Mon, 25 Jul 2011 11:02:53 -0500 From: Brandon Falk User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Robert Watson References: <4E2448D1.6020504@gamozo.org> <4E244EE1.40604@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@FreeBSD.org, jonathan@FreeBSD.org, Andriy Gapon Subject: Re: Issue with 'Unknown Error: -512' X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 16:02:56 -0000 On 7/25/2011 4:47 AM, Robert Watson wrote: > > On Mon, 18 Jul 2011, Andriy Gapon wrote: > >>> In recent branches (confirmed with 224119) builds compiled with >>> clang happen to throw 'Unknown error: -512' in a lot of places, >>> making the system unusable. (Untested on gcc compiled systems). >>> Originally I thought the problem was with specific programs, then I >>> narrowed it down to file I/O, and now I've narrowed it down to >>> open() with O_TRUNC. Without O_TRUNC there seems to be no issues >>> whatsoever. With O_TRUNC on open() it fails with that 'Unknown >>> error: -512' every other time you run the program. Common issues, >>> portsnap is affected, making it impossible to fetch/extract ports. >>> As well as redirecting output in shells eg `echo 'hi' > test` fails >>> every other try. You have the same issue with text editors like >>> `edit` where it fails every other save. There are no issues with >>> `echo 'hi' >> test` as there is no O_TRUNC, it only seems to be an >>> O_TRUNC error. >>> >>> Any tips? Otherwise I'll be looking into this today myself. >> >> Just a hint that you could try using DTrace syscall and fbt providers >> to see where in kernel (if in kernel) that -512 return value originates. > > Jon Anderson spotted that here during some Capsicum work -- initially > we were concerned it was a local patch, but it sounds like it might be > less local. I think he saw it on calls to open(2) as well, and I > couldn't help but wonder (given its recent arrival) if it was an > outcome of the change to break falloc into two parts, leading to some > or another problematic handling of file descriptor numbers. I.e., > it's not so much that -512 is being returned, as a number that's a bad > file descriptor. (Although now having seen 512 twice on two different > machines, that particular explanation seems less credible). Perhaps > this is indeed unrelated to Capsicum, and triggered by a clang bug or > something else. > > I've CC'd Jon, maybe he has gained further insight since we chatted. > > Robert > I've been building head every single day to check for the disappearance of this bug, and it seems to be gone as of 224302 (maybe before, but 224302 is what I built). I wrote a program to do tons of open()s and truncate()s to try to get the error, where initially I'd get an error every other attempt, then it was every 100 or so iterations it would fail, now I've tested 500,000 opens and truncates and there have been no issues. -Brandon Falk