From owner-svn-src-head@freebsd.org Mon Mar 12 23:02:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89C6AF53085; Mon, 12 Mar 2018 23:02:02 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D2987959A; Mon, 12 Mar 2018 23:02:02 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 366B111EF9; Mon, 12 Mar 2018 23:02:02 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2CN22AI081218; Mon, 12 Mar 2018 23:02:02 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2CN220A081217; Mon, 12 Mar 2018 23:02:02 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201803122302.w2CN220A081217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 12 Mar 2018 23:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330820 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 330820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2018 23:02:02 -0000 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 __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #include #include @@ -39,9 +41,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -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);