Author: brooks
Date: Mon Mar 12 23:02:01 2018
New Revision: 330820
URL: https://svnweb.freebsd.org/changeset/base/330820

Log:
  Reject ioctls to SCSI enclosures from 32-bit compat processes.
  
  The ioctl objects contain pointers and require translation and some
  refactoring of the infrastructure to work. For now prevent opertion
  on garbage values. This is very slightly overbroad in that ENCIOC_INIT
  is safe.
  
  Reviewed by:  imp, kib
  Obtained from:        CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:        https://reviews.freebsd.org/D14671

Modified:
  head/sys/cam/scsi/scsi_enc.c

Modified: head/sys/cam/scsi/scsi_enc.c
==============================================================================
--- head/sys/cam/scsi/scsi_enc.c        Mon Mar 12 22:58:07 2018        
(r330819)
+++ head/sys/cam/scsi/scsi_enc.c        Mon Mar 12 23:02:01 2018        
(r330820)
@@ -29,6 +29,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_compat.h"
+
 #include <sys/param.h>
 
 #include <sys/conf.h>
@@ -39,9 +41,11 @@ __FBSDID("$FreeBSD$");
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>
+#include <sys/proc.h>
 #include <sys/queue.h>
 #include <sys/sbuf.h>
 #include <sys/sx.h>
+#include <sys/sysent.h>
 #include <sys/systm.h>
 #include <sys/sysctl.h>
 #include <sys/types.h>
@@ -354,6 +358,10 @@ enc_ioctl(struct cdev *dev, u_long cmd, caddr_t arg_ad
        void *addr;
        int error, i;
 
+#ifdef COMPAT_FREEBSD32
+       if (SV_PROC_FLAG(td->td_proc, SV_ILP32))
+               return (ENOTTY);
+#endif
 
        if (arg_addr)
                addr = *((caddr_t *) arg_addr);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to