Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jan 2018 12:13:42 +0000 (UTC)
From:      Wojciech Macek <wma@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328394 - head/sys/net
Message-ID:  <201801251213.w0PCDgxg016306@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@semihalf.com>
  Submitted by:          Wojciech Macek <wma@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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801251213.w0PCDgxg016306>