public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH] Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251)
Date: Fri, 01 Jun 2018 15:00:00 -0000	[thread overview]
Message-ID: <36d1d0db-8661-5476-7e42-1a7015f4c766@redhat.com> (raw)
In-Reply-To: <1522877210-27934-1-git-send-email-adhemerval.zanella@linaro.org>

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

  parent reply	other threads:[~2018-06-01 15:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04 21:27 Adhemerval Zanella
2018-04-30 11:10 ` Adhemerval Zanella
2018-05-04 17:54   ` Adhemerval Zanella
2018-05-21 19:01     ` Adhemerval Zanella
2018-05-25 20:03       ` Adhemerval Zanella
2018-06-01 14:49         ` Adhemerval Zanella
2018-06-01 15:00 ` Florian Weimer [this message]
2018-06-01 20:38   ` Adhemerval Zanella
2018-06-01 20:50     ` Joseph Myers
2018-06-01 21:49       ` Adhemerval Zanella
2018-06-01 21:07     ` Florian Weimer
2018-06-01 21:48       ` Adhemerval Zanella
2018-06-01 21:53         ` Adhemerval Zanella
2018-06-02  8:00         ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36d1d0db-8661-5476-7e42-1a7015f4c766@redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).