linux binary blues

Dan Nelson dnelson at allantgroup.com
Tue May 20 07:36:43 PDT 2003


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 at allantgroup.com


More information about the freebsd-hackers mailing list