Linux-man Archive mirror
 help / color / mirror / Atom feed
From: Alexey Tikhonov <atikhono@redhat.com>
To: Alejandro Colomar <alx@kernel.org>, linux-man@vger.kernel.org
Cc: libc-alpha@sourceware.org, netdev@vger.kernel.org,
	 Kuniyuki Iwashima <kuniyu@amazon.com>
Subject: [patch] unix.7: SO_PEERCRED: Mention listen(2)
Date: Wed, 20 Dec 2023 19:05:31 +0100	[thread overview]
Message-ID: <CABPeg3Z5p2yapwEwPdHqDZiDL-W_gVgMc39A0Kdd95LNd+OwHA@mail.gmail.com> (raw)
In-Reply-To: <CABPeg3ZZCDkRaVy2towZ-amU9v-rQSXZ_M_KnfY1SfWhhT-AZw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

From c835c1c7c7047590263cf6c6d516092b165e013d Mon Sep 17 00:00:00 2001
From: Alexey Tikhonov <atikhono@redhat.com>
Date: Wed, 20 Dec 2023 18:28:34 +0100
Subject: [PATCH] unix.7: SO_PEERCRED: Mention listen(2)

In case of connected AF_UNIX stream sockets, server-side
credentials are set at the time of a call to listen(2),
not when client-side calls connect(2).

This is important if server side process changes UID/GID
after listen(2) and before connect(2).

Reproducer is available in https://bugzilla.redhat.com/show_bug.cgi?id=2247682

Behavior was confirmed in the email thread
https://lore.kernel.org/linux-man/CABPeg3a9L0142gmdZZ+0hoD+Q3Vgv0BQ21g8Z+gf2kznWouErA@mail.gmail.com/

Signed-off-by: Alexey Tikhonov <atikhono@redhat.com>
---
 man7/unix.7 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/man7/unix.7 b/man7/unix.7
index e9edad467..71cdfc758 100644
--- a/man7/unix.7
+++ b/man7/unix.7
@@ -331,7 +331,8 @@ This read-only socket option returns the
 credentials of the peer process connected to this socket.
 The returned credentials are those that were in effect at the time
 of the call to
-.BR connect (2)
+.BR connect (2),
+.BR listen (2),
 or
 .BR socketpair (2).
 .IP
-- 
2.41.0

[-- Attachment #2: 0001-unix.7-SO_PEERCRED-Mention-listen-2.patch --]
[-- Type: text/x-patch, Size: 1220 bytes --]

From c835c1c7c7047590263cf6c6d516092b165e013d Mon Sep 17 00:00:00 2001
From: Alexey Tikhonov <atikhono@redhat.com>
Date: Wed, 20 Dec 2023 18:28:34 +0100
Subject: [PATCH] unix.7: SO_PEERCRED: Mention listen(2)

In case of connected AF_UNIX stream sockets, server-side
credentials are set at the time of a call to listen(2),
not when client-side calls connect(2).

This is important if server side process changes UID/GID
after listen(2) and before connect(2).

Reproducer is available in https://bugzilla.redhat.com/show_bug.cgi?id=2247682

Behavior was confirmed in the email thread
https://lore.kernel.org/linux-man/CABPeg3a9L0142gmdZZ+0hoD+Q3Vgv0BQ21g8Z+gf2kznWouErA@mail.gmail.com/

Signed-off-by: Alexey Tikhonov <atikhono@redhat.com>
---
 man7/unix.7 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/man7/unix.7 b/man7/unix.7
index e9edad467..71cdfc758 100644
--- a/man7/unix.7
+++ b/man7/unix.7
@@ -331,7 +331,8 @@ This read-only socket option returns the
 credentials of the peer process connected to this socket.
 The returned credentials are those that were in effect at the time
 of the call to
-.BR connect (2)
+.BR connect (2),
+.BR listen (2),
 or
 .BR socketpair (2).
 .IP
-- 
2.41.0


  reply	other threads:[~2023-12-20 18:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 12:16 UNIX(7) Alexey Tikhonov
2023-12-01 12:54 ` UNIX(7) Alejandro Colomar
2023-12-01 22:07   ` UNIX(7) Kuniyuki Iwashima
2023-12-04 10:11     ` UNIX(7) Alexey Tikhonov
2023-12-20 18:05       ` Alexey Tikhonov [this message]
2023-12-21  1:49         ` [PATCH] unix.7: SO_PEERCRED: Mention listen(2) Kuniyuki Iwashima
2023-12-21 12:15           ` Alejandro Colomar

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=CABPeg3Z5p2yapwEwPdHqDZiDL-W_gVgMc39A0Kdd95LNd+OwHA@mail.gmail.com \
    --to=atikhono@redhat.com \
    --cc=alx@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=netdev@vger.kernel.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).