From: stsp <stsp2@yandex.ru>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: almasrymina@google.com, asml.silence@gmail.com, axboe@kernel.dk,
brauner@kernel.org, cyphar@cyphar.com, davem@davemloft.net,
edumazet@google.com, gouhao@uniontech.com, horms@kernel.org,
kees@kernel.org, krisman@suse.de, kuba@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
mhal@rbox.co, netdev@vger.kernel.org, oleg@redhat.com,
pabeni@redhat.com, quic_abchauha@quicinc.com, shuah@kernel.org,
tandersen@netflix.com, viro@zeniv.linux.org.uk,
willemb@google.com
Subject: Re: [PATCH v2] net/unix: pass pidfd flags via SCM_PIDFD cmsg
Date: Tue, 19 Nov 2024 14:04:41 +0300 [thread overview]
Message-ID: <67638eaf-3d94-450a-8280-df4f7dc66ce7@yandex.ru> (raw)
In-Reply-To: <20241116011038.94912-1-kuniyu@amazon.com>
16.11.2024 04:10, Kuniyuki Iwashima пишет:
> Now this allows sending pidfd without SO_PASSPIDFD, so you need to
> add a validation for "if (!msg->msg_control)" in __scm_recv_common().
Will do, thanks.
Btw don't we need MSG_CTRUNC in
such case even if "msg_control"exists?
Or the established practice is to just drop cmsg silently?
I mean, something like the below:
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -176,12 +176,19 @@ static inline bool __scm_recv_common(struct socket
*sock, struct msghdr *msg,
if (!msg->msg_control) {
if (test_bit(SOCK_PASSCRED, &sock->flags) ||
test_bit(SOCK_PASSPIDFD, &sock->flags) ||
- scm->fp || scm_has_secdata(sock))
+ scm->fp || scm_has_secdata(sock) ||
+ scm->pidfd_flags)
msg->msg_flags |= MSG_CTRUNC;
scm_destroy(scm);
return false;
}
+ if (!test_bit(SOCK_PASSPIDFD, &sock->flags) && scm->pidfd_flags) {
+ msg->msg_flags |= MSG_CTRUNC;
+ scm_destroy(scm);
+ return false;
+ }
+
if (test_bit(SOCK_PASSCRED, &sock->flags)) {
struct user_namespace *current_ns = current_user_ns();
struct ucred ucreds = {
prev parent reply other threads:[~2024-11-19 11:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 9:19 Stas Sergeev
2024-11-16 1:10 ` Kuniyuki Iwashima
2024-11-16 10:13 ` stsp
2024-11-19 11:03 ` stsp
2024-11-19 11:04 ` stsp [this message]
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=67638eaf-3d94-450a-8280-df4f7dc66ce7@yandex.ru \
--to=stsp2@yandex.ru \
--cc=almasrymina@google.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=cyphar@cyphar.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gouhao@uniontech.com \
--cc=horms@kernel.org \
--cc=kees@kernel.org \
--cc=krisman@suse.de \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mhal@rbox.co \
--cc=netdev@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=pabeni@redhat.com \
--cc=quic_abchauha@quicinc.com \
--cc=shuah@kernel.org \
--cc=tandersen@netflix.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willemb@google.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®