This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251)



On 01/06/2018 18:07, Florian Weimer wrote:
> On 06/01/2018 10:38 PM, Adhemerval Zanella wrote:
>>> I think you should mention somewhere that this introduces new cancellation points.
> 
>> It is not really new, since for architectures with default LFS support this is
>> transparent and for architectures with non-default LFS my understanding is
>> functions with *64 suffix are expected to handle cancellation as the non-LFS.
> 
> The old condition was:
> 
> -  if (cmd == F_SETLKW || cmd == F_SETLKW64)
> -    return SYSCALL_CANCEL (fcntl64, fd, cmd, (void *) arg);
> 
> The new code calls SYSCALL_CANCEL for many more cases, some of which probably are bugs.

Indeed the F_{OFD}_GETLK* case is not the case for cancellation (since the
lock won't be enforced by kernel).  My understanding is both POSIX and Linux
OFD locks have similar code path which may suspend process execution (the
case for cancellation syscall).  Do you have any reservation about making
F_OFD_GETLK a cancellation entrypoint as well?

> 
> I'm also a bit worried about this:
> 
> +      case F_GETLK64:
> +      case F_OFD_GETLK:
> +    {
> +      struct flock *flk = (struct flock *) arg;
> +      struct flock64 flk64 =
> +      {
> +        .l_type = flk->l_type,
> +        .l_whence = flk->l_whence,
> +        .l_start = flk->l_start,
> +        .l_len = flk->l_len,
> +        .l_pid = flk->l_pid
> +      };
> 
> Should we really perform translation for F_GETLK64?  That looks like a bug.

My understanding is Linux expects a 'struct flock64' for both F_OFD_GETLK and
F_GETLK64 (fs/fcntl.c:493) and with the patch fcntl on non-LFS mode will only 
be called with 'struct fcntl'.  So we need to transform to avoid the same issue
as for OFD locks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]