From owner-svn-src-stable-10@freebsd.org Tue Mar 27 17:48:40 2018 Return-Path: Delivered-To: svn-src-stable-10@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 8FC1DF6FA40; Tue, 27 Mar 2018 17:48:40 +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 3CB38757BF; Tue, 27 Mar 2018 17:48:40 +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 37AE71F596; Tue, 27 Mar 2018 17:48:40 +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 w2RHme7I070552; Tue, 27 Mar 2018 17:48:40 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2RHmdZK070549; Tue, 27 Mar 2018 17:48:39 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201803271748.w2RHmdZK070549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 27 Mar 2018 17:48:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331635 - in stable/10/sys: dev/isp modules/isp X-SVN-Group: stable-10 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/10/sys: dev/isp modules/isp X-SVN-Commit-Revision: 331635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Mar 2018 17:48:40 -0000 Author: brooks Date: Tue Mar 27 17:48:39 2018 New Revision: 331635 URL: https://svnweb.freebsd.org/changeset/base/331635 Log: MFC r330876, r330945 r330876: Fix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems. For _IO() ioctls, addr is a pointer to uap->data which is a caddr_t. When the caddr_t stores an int, dereferencing addr as an (int *) results in truncation on little-endian 64-bit systems and corruption (owing to extracting top bits) on big-endian 64-bit systems. In practice the value of chan was probably always zero on systems of the latter type as all such FreeBSD platforms use a register-based calling convention. Reviewed by: mav Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14673 r330945: Add opt_compat.h to isp(4) as required by r330876. Modified: stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/modules/isp/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Tue Mar 27 17:46:25 2018 (r331634) +++ stable/10/sys/dev/isp/isp_freebsd.c Tue Mar 27 17:48:39 2018 (r331635) @@ -433,7 +433,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int case ISP_RESCAN: if (IS_FC(isp)) { - chan = *(int *)addr; + chan = *(intptr_t *)addr; if (chan < 0 || chan >= isp->isp_nchan) { retval = -ENXIO; break; @@ -450,7 +450,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int case ISP_FC_LIP: if (IS_FC(isp)) { - chan = *(int *)addr; + chan = *(intptr_t *)addr; if (chan < 0 || chan >= isp->isp_nchan) { retval = -ENXIO; break; Modified: stable/10/sys/modules/isp/Makefile ============================================================================== --- stable/10/sys/modules/isp/Makefile Tue Mar 27 17:46:25 2018 (r331634) +++ stable/10/sys/modules/isp/Makefile Tue Mar 27 17:48:39 2018 (r331635) @@ -4,7 +4,7 @@ KMOD= isp SRCS= bus_if.h device_if.h pci_if.h \ - opt_cam.h opt_ddb.h opt_isp.h \ + opt_cam.h opt_compat.h opt_ddb.h opt_isp.h \ isp.c isp_library.c isp_target.c isp_freebsd.c isp_pci.c .if ${MACHINE} == sparc64