Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 103717 - lockf function doesn't comply with Single Unix Specification
lockf function doesn't comply with Single Unix Specification
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: kernel (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jim Paradis
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2003-09-04 04:53 EDT by Unai Uribarri Rodríguez
Modified: 2013-08-05 21:02 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-06-08 17:39:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Unai Uribarri Rodríguez 2003-09-04 04:53:23 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624

Description of problem:
lockf returns EINVAL if the third argument of the function lockf, len, is
negative, if running a kernel < 2.4.21 (currently, I'm using redhat

All the versions of the Single Unix Specification says that, when len is
negative, lockf must affect "the preceding bytes up to but not including the
current offset".

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Call lockf with a negative len argument

Actual Results:  lockf return -1, errno==EINVAL.

Expected Results:  lockf must return 0.

Additional info:
Comment 1 Unai Uribarri Rodríguez 2003-09-04 04:54:35 EDT
The glibc version is glibc-2.2.4-26.
Comment 2 Jakub Jelinek 2003-09-04 05:12:22 EDT
glibc lockf just calls fcntl in the kernel.
Comment 3 Arjan van de Ven 2003-09-04 05:19:27 EDT
if we change this, we change behavior to userspace, which is something we don't
want within a stable product release.
Comment 4 Unai Uribarri Rodríguez 2003-09-04 05:39:59 EDT
It isn't needed to change the kernel. You can call traslate the negative length
in lockf to a negative start and a positive length to fcntl, for example:

struct flock flock;
/* ... */
if (len < 0)
  flock.l_start = len
  flock.l_len = -len;
  flock.l_start = 0;
  flock.l_len = len;
Comment 5 Jim Paradis 2006-06-08 17:39:05 EDT
RHEL2.1 is currently accepting only critical security fixes.  This issue is
outside the current scope of support.

Note You need to log in before you can comment on or make changes to this bug.