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
This commit is contained in:
Wojciech Macek 2018-01-25 12:13:41 +00:00
parent af89fcf725
commit 74549d4b0f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328394

View File

@ -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, int flags,
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