From owner-freebsd-hackers@FreeBSD.ORG Tue May 20 07:36:43 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 15BCA37B401 for ; Tue, 20 May 2003 07:36:43 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 624A143F93 for ; Tue, 20 May 2003 07:36:42 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h4KEaeeX069123; Tue, 20 May 2003 09:36:40 -0500 (CDT) (envelope-from dan) Date: Tue, 20 May 2003 09:36:40 -0500 From: Dan Nelson To: Bogdan TARU Message-ID: <20030520143639.GA26422@dan.emsphone.com> References: <20030520094427.K78063-100000@fw.office.icom> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030520094427.K78063-100000@fw.office.icom> X-OS: FreeBSD 5.1-BETA X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i cc: freebsd-hackers@FreeBSD.ORG cc: Dag-Erling Smorgrav Subject: Re: linux binary blues X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 May 2003 14:36:43 -0000 In the last episode (May 20), Bogdan TARU said: > So, I have installed linux_kdump package, tried to run 'ktrace' on my > binary and then analyze the ktrace.out with 'linux_kdump'. This is > the point where it ain't working no more on the 4.7 jail system: > > 73506 engine NAMI "/var/run/engine.pid" > 73506 engine RET linux_open 3 > 73506 engine CALL linux_fcntl64(0x3,0x6,0xbfbfe7b0) > 73506 engine RET linux_fcntl64 -1 errno 22 Invalid argument > > And it works on the 4.8 jail system: > > 31291 engine NAMI "/var/run/engine.pid" > 31291 engine RET linux_open 3 > 31291 engine CALL linux_fcntl64(0x3,0x6,0xbfbfe820) > 31291 engine RET linux_fcntl64 0 > > So, again, any ideas why this linux binary can get a lock on the > '/var/run/engine.pid' file under a freebsd 4.8 jail, and cannot on a > 4.7 jail? There were fixes to the linux_fcntl64 syscall that went in between 4.7 and 4.8: revision 1.72 date: 2002/12/08 18:30:44; author: iedowse; state: Exp; lines: +33 -39 Fix emulation of the fcntl64() syscall. In Linux, this is exactly the same as fcntl() except that it supports the new 64-bit file locking commands (LINUX_F_GETLK64 etc) that use the `flock64' structure. We had been interpreting all flock structures passed to fcntl64() as `struct flock64' instead of only the ones from F_*64 commands. The glibc in linux_base-7 uses fcntl64() by default, but the bug was often non-fatal since the misinterpretation typically only causes junk to appear in the `l_len' field and most junk values are accepted as valid range lengths. The result is occasional EINVAL errors from F_SETLK and a few bytes after the supplied `struct flock' getting clobbered during F_GETLK. revision 1.41.2.6 date: 2003/01/06 09:19:43; author: fjoe; state: Exp; lines: +43 -47 MFC: fcntl64 fixes -- Dan Nelson dnelson@allantgroup.com