Hi Günther, > Date: 2026-11-20 17:11:58+0100 > From: Günther Noack > > 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] > Fixes: ffad6a017f91 (2018-07-28; "unix.7: Document SCM_SECURITY ancillary data") > Cc: Michael Kerrisk > Cc: Kuniyuki Iwashima > Cc: Eric Dumazet > Cc: Paolo Abeni > Cc: Willem de Bruijn > Reported-by: LLM > Reviewed-by: Kuniyuki Iwashima > Signed-off-by: Günther Noack 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 > --