All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kees Cook <keescook@chromium.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Will Drewry <wad@chromium.org>
Subject: Re: [PATCH] fs: split receive_fd_replace from __receive_fd
Date: Fri, 16 Apr 2021 03:38:09 +0000	[thread overview]
Message-ID: <YHkGodVOpc/kg3V8@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <20210325082209.1067987-2-hch@lst.de>

On Thu, Mar 25, 2021 at 09:22:09AM +0100, Christoph Hellwig wrote:
> receive_fd_replace shares almost no code with the general case, so split
> it out.  Also remove the "Bump the sock usage counts" comment from
> both copies, as that is now what __receive_sock actually does.

Nice, except that you've misread that, er, lovely API.  This

> -static inline int receive_fd_replace(int fd, struct file *file, unsigned int o_flags)
> -{
> -	return __receive_fd(fd, file, NULL, o_flags);
> +	return __receive_fd(file, NULL, o_flags);
>  }

can get called with negative fd (in which case it turns into an alias for
receive_fd(), of course).  As the result, that ioctl got broken in case
when SECCOMP_ADDFD_FLAG_SETFD is not set.  Trivially fixed by having the
only caller check the damn condition and call either receive_fd_replace()
or receive_fd().

  parent reply	other threads:[~2021-04-16  3:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  8:22 split receive_fd_replace from __receive_fd Christoph Hellwig
2021-03-25  8:22 ` [PATCH] fs: " Christoph Hellwig
2021-03-29  7:19   ` [fs] d7b0df2133: kernel-selftests.seccomp.seccomp_bpf.fail kernel test robot
2021-03-29  7:19     ` kernel test robot
2021-04-02 19:01   ` [PATCH] fs: split receive_fd_replace from __receive_fd Kees Cook
2021-04-16  4:15     ` Al Viro
2021-04-16 13:46       ` Christian Brauner
2021-04-16  3:38   ` Al Viro [this message]
2021-03-25  8:30 ` Christian Brauner

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=YHkGodVOpc/kg3V8@zeniv-ca.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=hch@lst.de \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=wad@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.