All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx+linux-man@kernel.org>
To: "Günther Noack" <gnoack3000@gmail.com>
Cc: linux-man@vger.kernel.org,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	 Kuniyuki Iwashima <kuniyu@google.com>,
	Eric Dumazet <edumazet@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH v3 1/5] man/man7/unix.7: SCM_SECURITY: Generalize to other LSMs, not just SELinux
Date: Thu, 26 Nov 2026 23:58:56 +0100	[thread overview]
Message-ID: <awi5ncjq0qTWo5cK@devuan> (raw)
In-Reply-To: <20261120161202.27163-2-gnoack3000@gmail.com>

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

Hi Günther,

> Date: 2026-11-20 17:11:58+0100
> From: Günther Noack <gnoack3000@gmail.com>
>
> Reword the description of SCM_SECURITY to not be specific to SELinux.
> 
> The security context is populated in scm_passec() in linux.git
> net/core/scm.c, through the security_secid_to_secctx() LSM hook, which
> is currently implemented by SELinux, Smack and AppArmor.
> 
> As clarified in [1], the returned security context is in the general
> case a byte buffer, not a null-terminated string.  The only LSM that
> returns a buffer with trailing null byte is SELinux, but even that is
> not guaranteed in case that the message is truncated.
> 
> Link: [1] <https://lore.kernel.org/all/auZcwYWv0NeiIR8d@google.com/>
> Fixes: ffad6a017f91 (2018-07-28; "unix.7: Document SCM_SECURITY ancillary data")
> Cc: Michael Kerrisk <mtk.manpages@gmail.com>
> Cc: Kuniyuki Iwashima <kuniyu@google.com>
> Cc: Eric Dumazet <edumazet@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: Willem de Bruijn <willemb@google.com>
> Reported-by: LLM
> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
> Signed-off-by: Günther Noack <gnoack3000@gmail.com>

Thanks!  I've applied the patch.


Have a lovely night!
Alex

> ---
>  man/man7/unix.7 | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/man/man7/unix.7 b/man/man7/unix.7
> index 61f06a74359b..3322d915f1bb 100644
> --- a/man/man7/unix.7
> +++ b/man/man7/unix.7
> @@ -312,7 +312,7 @@ .SS Socket options
>  is an integer boolean flag.
>  .TP
>  .B SO_PASSSEC
> -Enables receiving of the SELinux security label of the peer socket
> +Enables receiving of the security label of the peer socket
>  in an ancillary message of type
>  .B SCM_SECURITY
>  (see below).
> @@ -538,13 +538,19 @@ .SS Ancillary messages
>  option must be enabled on the socket.
>  .TP
>  .B SCM_SECURITY
> -Receive the SELinux security context (the security label)
> -of the peer socket.
> -The received ancillary data is a null-terminated string containing
> -the security context.
> -The receiver should allocate at least
> -.B NAME_MAX
> -bytes in the data portion of the ancillary message for this data.
> +Receive the security context (the security label)
> +of the peer socket,
> +as provided by the active Linux Security Module (LSM).
> +The received ancillary data is a byte buffer.
> +.IP
> +The exact format of the security context buffer
> +is defined by the active major LSM.
> +If the caller does not provide sufficient buffer space,
> +the buffer is truncated in a format-unaware manner
> +and
> +.B MSG_CTRUNC
> +is set in
> +.IR msg.msg_flags .
>  .IP
>  To receive the security context, the
>  .B SO_PASSSEC
> -- 
> 2.56.1
> 

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-11-26 22:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 16:11 [PATCH v3 0/5] unix.7: Socket Options and SCM_* fixes Günther Noack
2026-11-20 16:11 ` [PATCH v3 1/5] man/man7/unix.7: SCM_SECURITY: Generalize to other LSMs, not just SELinux Günther Noack
2026-11-26 22:58   ` Alejandro Colomar [this message]
2026-11-20 16:11 ` [PATCH v3 2/5] man/man7/unix.7: SO_PASSSEC: wfix Günther Noack
2026-11-26 22:59   ` Alejandro Colomar
2026-11-20 16:12 ` [PATCH v3 3/5] man/man7/unix.7: Document SO_PASSPIDFD, SO_PEERPIDFD, and SCM_PIDFD Günther Noack
2026-11-20 16:12 ` [PATCH v3 4/5] man/man7/unix.7: Document SO_PASSRIGHTS Günther Noack
2026-11-20 16:12 ` [PATCH v3 5/5] man/man7/unix.7: Remove mentions of "namespace" in the general sense Günther Noack

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=awi5ncjq0qTWo5cK@devuan \
    --to=alx+linux-man@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=gnoack3000@gmail.com \
    --cc=kuniyu@google.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=pabeni@redhat.com \
    --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 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.