svn commit: r367288 - head/sys/compat/linux

Conrad Meyer cem at FreeBSD.org
Tue Nov 3 01:19:14 UTC 2020


Author: cem
Date: Tue Nov  3 01:19:13 2020
New Revision: 367288
URL: https://svnweb.freebsd.org/changeset/base/367288

Log:
  linux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED
  
  This is required by some major linux applications, such as Chrome and
  Firefox.  (As well as Electron-using applications, which are essentially
  a bundled version of Chrome.)
  
  Reviewed by:	markj
  Differential Revision:	https://reviews.freebsd.org/D27012

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c	Tue Nov  3 01:17:45 2020	(r367287)
+++ head/sys/compat/linux/linux_socket.c	Tue Nov  3 01:19:13 2020	(r367288)
@@ -222,6 +222,8 @@ linux_to_bsd_so_sockopt(int opt)
 		return (SO_LINGER);
 	case LINUX_SO_REUSEPORT:
 		return (SO_REUSEPORT_LB);
+	case LINUX_SO_PASSCRED:
+		return (LOCAL_CREDS_PERSISTENT);
 	case LINUX_SO_PEERCRED:
 		return (LOCAL_PEERCRED);
 	case LINUX_SO_RCVLOWAT:
@@ -1445,6 +1447,9 @@ linux_setsockopt(struct thread *td, struct linux_setso
 	case SOL_SOCKET:
 		name = linux_to_bsd_so_sockopt(args->optname);
 		switch (name) {
+		case LOCAL_CREDS_PERSISTENT:
+			level = SOL_LOCAL;
+			break;
 		case SO_RCVTIMEO:
 			/* FALLTHROUGH */
 		case SO_SNDTIMEO:
@@ -1522,6 +1527,9 @@ linux_getsockopt(struct thread *td, struct linux_getso
 	case SOL_SOCKET:
 		name = linux_to_bsd_so_sockopt(args->optname);
 		switch (name) {
+		case LOCAL_CREDS_PERSISTENT:
+			level = SOL_LOCAL;
+			break;
 		case SO_RCVTIMEO:
 			/* FALLTHROUGH */
 		case SO_SNDTIMEO:


More information about the svn-src-head mailing list