[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <67638eaf-3d94-450a-8280-df4f7dc66ce7@yandex.ru>
Date: Tue, 19 Nov 2024 14:04:41 +0300
From: stsp <stsp2@...dex.ru>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: almasrymina@...gle.com, asml.silence@...il.com, axboe@...nel.dk,
brauner@...nel.org, cyphar@...har.com, davem@...emloft.net,
edumazet@...gle.com, gouhao@...ontech.com, horms@...nel.org,
kees@...nel.org, krisman@...e.de, kuba@...nel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org, mhal@...x.co,
netdev@...r.kernel.org, oleg@...hat.com, pabeni@...hat.com,
quic_abchauha@...cinc.com, shuah@...nel.org, tandersen@...flix.com,
viro@...iv.linux.org.uk, willemb@...gle.com
Subject: Re: [PATCH v2] net/unix: pass pidfd flags via SCM_PIDFD cmsg
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 = {
Powered by blists - more mailing lists