aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-01-08 17:21:59 +0000
committerMark Johnston <markj@FreeBSD.org>2019-01-08 17:21:59 +0000
commitbb376a990cfbc7ebece8faa245e2530fce163c33 (patch)
tree29844351e85851dd53180265ec7783a0f2173825
parent9cf6837897f545b3e59c39fe78a29340b6845886 (diff)
downloadsrc-bb376a990cfbc7ebece8faa245e2530fce163c33.tar.gz
src-bb376a990cfbc7ebece8faa245e2530fce163c33.zip
Specify the correct option level when emulating SO_PEERCRED.
Our equivalent to SO_PEERCRED, LOCAL_PEERCRED, is implemented at socket option level 0, not SOL_SOCKET. PR: 234722 Submitted by: Dániel Bakai <bakaidl@gmail.com> MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=342864
-rw-r--r--sys/compat/linux/linux_socket.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 2979b257bd94..9456e2489427 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1633,6 +1633,11 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
case LOCAL_PEERCRED:
if (args->optlen < sizeof(lxu))
return (EINVAL);
+ /*
+ * LOCAL_PEERCRED is not served at the SOL_SOCKET level,
+ * but by the Unix socket's level 0.
+ */
+ bsd_args.level = 0;
xulen = sizeof(xu);
error = kern_getsockopt(td, args->s, bsd_args.level,
name, &xu, UIO_SYSSPACE, &xulen);