[PATCH] Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251)
Florian Weimer
fweimer@redhat.com
Fri Jun 1 15:00:00 GMT 2018
On 04/04/2018 11:26 PM, Adhemerval Zanella wrote:
> @@ -59,16 +50,56 @@ __libc_fcntl (int fd, int cmd, ...)
>
> cmd = FCNTL_ADJUST_CMD (cmd);
>
> - if (cmd == F_SETLKW || cmd == F_SETLKW64)
> - return SYSCALL_CANCEL (fcntl64, fd, cmd, (void *) arg);
> -
> - return fcntl_common (fd, cmd, arg);
> + switch (cmd)
> + {
> + case F_SETLKW:
> + return SYSCALL_CANCEL (fcntl64, fd, cmd, arg);
> + case F_GETLK64:
> + case F_OFD_GETLK:
> + {
> + struct flock *flk = (struct flock *) arg;
> + struct flock64 flk64 = flock_to_flock64 (flk);
> + int ret = SYSCALL_CANCEL (fcntl64, fd, cmd, &flk64);
> + if (ret == -1)
> + return -1;
> + flk->l_type = flk64.l_type;
> + flk->l_whence = flk64.l_whence;
> + flk->l_start = flk64.l_start;
> + flk->l_len = flk64.l_len;
> + flk->l_pid = flk64.l_pid;
> + return ret;
Doesn't this need an overflow check?
I think you should mention somewhere that this introduces new
cancellation points.
Thanks,
Florian
More information about the Libc-alpha
mailing list