Conditionally weaken sys_generic.c rev 1.136 to allow certain dubious
ioctl numbers in backwards compatability mode. eg: an IOC_IN ioctl with a size of zero. Traditionally this was what you did before IOC_VOID existed, and we had some established users of this in the tree, namely procfs. Certain 3rd party drivers with binary userland components also have this too. This is necessary to have 4.x and 5.x binaries use these ioctl's. We found this at work when trying to run 4.x binaries. Approved by: re
This commit is contained in:
parent
b107fcf877
commit
2de92a386e
@ -28,6 +28,8 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "opt_compat.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
@ -51,12 +53,21 @@ procfs_ioctl(PFS_IOCTL_ARGS)
|
||||
PROC_LOCK(p);
|
||||
error = 0;
|
||||
switch (cmd) {
|
||||
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
|
||||
case _IOC(IOC_IN, 'p', 1, 0):
|
||||
#endif
|
||||
case PIOCBIS:
|
||||
p->p_stops |= *(uintptr_t *)data;
|
||||
break;
|
||||
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
|
||||
case _IOC(IOC_IN, 'p', 2, 0):
|
||||
#endif
|
||||
case PIOCBIC:
|
||||
p->p_stops &= ~*(uintptr_t *)data;
|
||||
break;
|
||||
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
|
||||
case _IOC(IOC_IN, 'p', 3, 0):
|
||||
#endif
|
||||
case PIOCSFL:
|
||||
flags = *(uintptr_t *)data;
|
||||
if (flags & PF_ISUGID && (error = suser(td)) != 0)
|
||||
@ -83,6 +94,9 @@ procfs_ioctl(PFS_IOCTL_ARGS)
|
||||
ps->why = p->p_step ? p->p_stype : 0;
|
||||
ps->val = p->p_step ? p->p_xstat : 0;
|
||||
break;
|
||||
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
|
||||
case _IOC(IOC_IN, 'p', 5, 0):
|
||||
#endif
|
||||
case PIOCCONT:
|
||||
if (p->p_step == 0)
|
||||
break;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_compat.h"
|
||||
#include "opt_ktrace.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -534,8 +535,12 @@ ioctl(struct thread *td, struct ioctl_args *uap)
|
||||
size = IOCPARM_LEN(com);
|
||||
if ((size > IOCPARM_MAX) ||
|
||||
((com & (IOC_VOID | IOC_IN | IOC_OUT)) == 0) ||
|
||||
((com & IOC_VOID) && size > 0) ||
|
||||
((com & (IOC_IN | IOC_OUT)) && size == 0)) {
|
||||
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
|
||||
((com & IOC_OUT) && size == 0) ||
|
||||
#else
|
||||
((com & (IOC_IN | IOC_OUT)) && size == 0) ||
|
||||
#endif
|
||||
((com & IOC_VOID) && size > 0)) {
|
||||
fdrop(fp, td);
|
||||
return (ENOTTY);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user