lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 23 Apr 2014 15:23:18 -0400
From:	Jeff Layton <jlayton@...hat.com>
To:	ams@....org
Cc:	libc-alpha@...rceware.org, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, tytso@....edu, dalias@...c.org,
	mtk.manpages@...il.com, samba-technical@...ts.samba.org,
	nfs-ganesha-devel@...ts.sourceforge.net, carlos@...hat.com,
	metze@...ba.org, hch@...radead.org, bharrosh@...asas.com
Subject: Re: [RFC][glibc PATCH] fcntl-linux.h: add new definitions and
 manual updates for open file description locks

On Wed, 23 Apr 2014 15:00:06 -0400
ams@....org (Alfred M. Szmidt) wrote:

>    > Likewise.  You infact write that it does get the lock information
>    > later in the document wrt. F_OFD_GETLK.
> 
>    Sorry, I disagree here...GETLK is really a misnomer, IMO. TESTLK
>    would have been a better name.
> 
>    GETLK are used is to "get the first lock".
> 
>    It's a way to test whether a particular lock can be applied, and to
>    return information about a conflicting lock if it can't. If, for
>    instance there is no conflicting lock, then you don't "get" any
>    lock information back (l_type just gets reset to F_UNLCK).
> 
> While I kinda see your point, it isn't what GETLK does; it really does
> get you information about the first lock -- you're not testing
> anything.  It is also the terminology used in the POSIX standard.


You *are* testing a lock.

For instance, a process has locked bytes 0-5 for read in the file. I
then submit a F_GETLK request from another process and set:

    l_type = F_WRLCK
    l_start = 7
    l_len = 1

...this range does not overlap with the original range, and so no lock
will be returned even though one is being held on the file. In order to
determine whether it should return information about a lock it has to
first _test_ whether it conflicts with the information in the struct
flock that was passed down.

Similarly, if the struct flock I submit to the F_GETLK request has this:

   l_type = F_RDLCK
   l_start = 0
   l_len = 1

...then I also will not get any information about a lock back. The
information in the lock request does not conflict with the one being
held on the file (because they are both read locks).

If F_GETLK were just "getting" a lock, then there would be no test
involved, but that's not how this works. F_GETLK has to test and see
whether there is a conflicting lock before it can return anything.

If all you're objecting to is the change in verbiage on those two
pieces, then I'll back that part out in the interest of wrapping this
up.

I still think I'm correct though ;)

-- 
Jeff Layton <jlayton@...hat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ