]> git.baikalelectronics.ru Git - kernel.git/commit
net: Add UNIX_DIAG_UID to Netlink UNIX socket diagnostics.
authorFelipe Gasper <felipe@felipegasper.com>
Tue, 21 May 2019 00:43:51 +0000 (19:43 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 May 2019 17:36:35 +0000 (10:36 -0700)
commit0fb6442d46d1f30e82dcf9cc7631603c7424da4a
treedc250270bd6fd4598e781559176e529d2c65b34d
parent0ed97d2785137228782a82c0743e5c85030b4bf9
net: Add UNIX_DIAG_UID to Netlink UNIX socket diagnostics.

This adds the ability for Netlink to report a socket's UID along with the
other UNIX diagnostic information that is already available. This will
allow diagnostic tools greater insight into which users control which
socket.

To test this, do the following as a non-root user:

    unshare -U -r bash
    nc -l -U user.socket.$$ &

.. and verify from within that same session that Netlink UNIX socket
diagnostics report the socket's UID as 0. Also verify that Netlink UNIX
socket diagnostics report the socket's UID as the user's UID from an
unprivileged process in a different session. Verify the same from
a root process.

Signed-off-by: Felipe Gasper <felipe@felipegasper.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/unix_diag.h
net/unix/diag.c