svn commit: r328394 - head/sys/net

Wojciech Macek wma at FreeBSD.org
Thu Jan 25 12:13:42 UTC 2018


Author: wma
Date: Thu Jan 25 12:13:41 2018
New Revision: 328394
URL: https://svnweb.freebsd.org/changeset/base/328394

Log:
  BPF: Switch to 32 bit compatible mode only when thread is 32 bit
  
  Sometimes 32 bit and 64 bit ioctls are represented by the same number.
  It causes unnecessary switch to 32 bit commpatible mode.
  
  This patch prevents switching when we are dealing with 64 bit executable.
  It fixes issue mentioned here
  
  Authored by:           Patryk Duda <pdk at semihalf.com>
  Submitted by:          Wojciech Macek <wma at semihalf.com>
  Reviewed by:           andrew, wma
  Obtained from:         Semihalf
  Sponsored by:          IBM, QCM Technologies
  Differential revision: https://reviews.freebsd.org/D14023

Modified:
  head/sys/net/bpf.c

Modified: head/sys/net/bpf.c
==============================================================================
--- head/sys/net/bpf.c	Thu Jan 25 08:36:19 2018	(r328393)
+++ head/sys/net/bpf.c	Thu Jan 25 12:13:41 2018	(r328394)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/sockio.h>
 #include <sys/ttycom.h>
 #include <sys/uio.h>
+#include <sys/sysent.h>
 
 #include <sys/event.h>
 #include <sys/file.h>
@@ -1321,9 +1322,11 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, i
 	case BIOCGDLTLIST32:
 	case BIOCGRTIMEOUT32:
 	case BIOCSRTIMEOUT32:
-		BPFD_LOCK(d);
-		d->bd_compat32 = 1;
-		BPFD_UNLOCK(d);
+		if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
+			BPFD_LOCK(d);
+			d->bd_compat32 = 1;
+			BPFD_UNLOCK(d);
+		}
 	}
 #endif
 


More information about the svn-src-all mailing list