Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Mar 2018 17:39:27 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331631 - stable/11/sys/cam/scsi
Message-ID:  <201803271739.w2RHdRt2065037@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Tue Mar 27 17:39:27 2018
New Revision: 331631
URL: https://svnweb.freebsd.org/changeset/base/331631

Log:
  MFC r330820:
  
  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 operation
  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:
  stable/11/sys/cam/scsi/scsi_enc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_enc.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_enc.c	Tue Mar 27 17:37:08 2018	(r331630)
+++ stable/11/sys/cam/scsi/scsi_enc.c	Tue Mar 27 17:39:27 2018	(r331631)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_compat.h"
+
 #include <sys/param.h>
 
 #include <sys/conf.h>
@@ -37,8 +39,10 @@ __FBSDID("$FreeBSD$");
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>
+#include <sys/proc.h>
 #include <sys/queue.h>
 #include <sys/sx.h>
+#include <sys/sysent.h>
 #include <sys/systm.h>
 #include <sys/sysctl.h>
 #include <sys/types.h>
@@ -351,6 +355,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);



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