diff options
author | Felipe Gasper <felipe@felipegasper.com> | 2019-05-20 19:43:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-22 10:36:35 -0700 |
commit | cae9910e73446cac68a54e3a7b02aaa12b689026 (patch) | |
tree | dc250270bd6fd4598e781559176e529d2c65b34d /include | |
parent | 54dee406374ce8adb352c48e175176247cb8db7c (diff) | |
download | linux-stable-cae9910e73446cac68a54e3a7b02aaa12b689026.tar.gz linux-stable-cae9910e73446cac68a54e3a7b02aaa12b689026.tar.bz2 linux-stable-cae9910e73446cac68a54e3a7b02aaa12b689026.zip |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/uapi/linux/unix_diag.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h index 5c502fdf7a42..a1988576fa8a 100644 --- a/include/uapi/linux/unix_diag.h +++ b/include/uapi/linux/unix_diag.h @@ -20,6 +20,7 @@ struct unix_diag_req { #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ #define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ +#define UDIAG_SHOW_UID 0x00000040 /* show socket's UID */ struct unix_diag_msg { __u8 udiag_family; @@ -40,6 +41,7 @@ enum { UNIX_DIAG_RQLEN, UNIX_DIAG_MEMINFO, UNIX_DIAG_SHUTDOWN, + UNIX_DIAG_UID, __UNIX_DIAG_MAX, }; |