mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: stsp <stsp2@yandex.ru>
To: Alexander Mikhalitsyn <alexander@mihalicyn.com>
Cc: linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Kees Cook <kees@kernel.org>,
	Kuniyuki Iwashima <kuniyu@amazon.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net v2] scm: fix negative fds with SO_PASSPIDFD
Date: Sun, 17 Nov 2024 13:04:53 +0300	[thread overview]
Message-ID: <d1e90994-ca11-4a3e-b627-e3425dc5bf26@yandex.ru> (raw)
In-Reply-To: <CAJqdLrp4J57k67R3OWM-_6QZSv8EV9UANzdAtBCiLGQZPTXDcQ@mail.gmail.com>

17.11.2024 12:40, Alexander Mikhalitsyn пишет:
> Hi Stas,
>
> Actually, it's not a forgotten check. It's intended behavior to pass
> through errors from pidfd_prepare() to
> the userspace. In my first version [1] of the patch I tried to return
> ESRCH instead of EINVAL in your case, but
> then during discussions we decided to remove that.
>
> [1] https://lore.kernel.org/all/20230316131526.283569-2-aleksandr.mikhalitsyn@canonical.com/
Yes, the patch you referenced above,
only calls put_cmsg() with an error code.

But the code I can see now in git, does
much more. Namely,
if (pidfd_file)
     fd_install(pidfd, pidfd_file);

Or:

put_unused_fd(pidfd);

And I really can't find any ">=0" check
in those funcs. What am I missing?
Is it safe to call fd_install(-22, pidfd_file)?


  reply	other threads:[~2024-11-17 10:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-17  9:13 Stas Sergeev
2024-11-17  9:40 ` Alexander Mikhalitsyn
2024-11-17 10:04   ` stsp [this message]
2024-11-17 10:10     ` stsp
2024-11-18 14:59       ` Alexander Mikhalitsyn

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=d1e90994-ca11-4a3e-b627-e3425dc5bf26@yandex.ru \
    --to=stsp2@yandex.ru \
    --cc=alexander@mihalicyn.com \
    --cc=brauner@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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

all inboxes | Powered by JetHome®