svn commit: r331637 - in stable/10/sys: dev/aac dev/aacraid modules/aac modules/aacraid sys

Brooks Davis brooks at FreeBSD.org
Tue Mar 27 17:52:54 UTC 2018


Author: brooks
Date: Tue Mar 27 17:52:52 2018
New Revision: 331637
URL: https://svnweb.freebsd.org/changeset/base/331637

Log:
  MFC r330949:
  
  Fix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat.
  
  This includes FSACTL_LNX_GET_NEXT_ADAPTER_FIB.
  
  Reviewed by:	cem
  Obtained from:	CheriBSD
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D14672

Modified:
  stable/10/sys/dev/aac/aac.c
  stable/10/sys/dev/aacraid/aacraid.c
  stable/10/sys/modules/aac/Makefile
  stable/10/sys/modules/aacraid/Makefile
  stable/10/sys/sys/aac_ioctl.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/aac/aac.c
==============================================================================
--- stable/10/sys/dev/aac/aac.c	Tue Mar 27 17:51:45 2018	(r331636)
+++ stable/10/sys/dev/aac/aac.c	Tue Mar 27 17:52:52 2018	(r331637)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #define AAC_DRIVERNAME			"aac"
 
 #include "opt_aac.h"
+#include "opt_compat.h"
 
 /* #include <stddef.h> */
 #include <sys/param.h>
@@ -43,7 +44,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>
+#include <sys/proc.h>
 #include <sys/sysctl.h>
+#include <sys/sysent.h>
 #include <sys/poll.h>
 #include <sys/ioccom.h>
 
@@ -3520,7 +3523,19 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	if ((error = copyin(arg, &agf, sizeof(agf))) == 0) {
+#ifdef COMPAT_FREEBSD32
+	if (SV_CURPROC_FLAG(SV_ILP32)) {
+		struct get_adapter_fib_ioctl32 agf32;
+		error = copyin(arg, &agf32, sizeof(agf32));
+		if (error == 0) {
+			agf.AdapterFibContext = agf32.AdapterFibContext;
+			agf.Wait = agf32.Wait;
+			agf.AifFib = (caddr_t)(uintptr_t)agf32.AifFib;
+		}
+	} else
+#endif
+		error = copyin(arg, &agf, sizeof(agf));
+	if (error == 0) {
 		for (ctx = sc->fibctx; ctx; ctx = ctx->next) {
 			if (agf.AdapterFibContext == ctx->unique)
 				break;

Modified: stable/10/sys/dev/aacraid/aacraid.c
==============================================================================
--- stable/10/sys/dev/aacraid/aacraid.c	Tue Mar 27 17:51:45 2018	(r331636)
+++ stable/10/sys/dev/aacraid/aacraid.c	Tue Mar 27 17:52:52 2018	(r331637)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #define AAC_DRIVERNAME			"aacraid"
 
 #include "opt_aacraid.h"
+#include "opt_compat.h"
 
 /* #include <stddef.h> */
 #include <sys/param.h>
@@ -44,7 +45,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>
+#include <sys/proc.h>
 #include <sys/sysctl.h>
+#include <sys/sysent.h>
 #include <sys/poll.h>
 #include <sys/ioccom.h>
 
@@ -3380,7 +3383,19 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
 	mtx_lock(&sc->aac_io_lock);
-	if ((error = copyin(arg, &agf, sizeof(agf))) == 0) {
+#ifdef COMPAT_FREEBSD32
+	if (SV_CURPROC_FLAG(SV_ILP32)) {
+		struct get_adapter_fib_ioctl32 agf32;
+		error = copyin(arg, &agf32, sizeof(agf32));
+		if (error == 0) {
+			agf.AdapterFibContext = agf32.AdapterFibContext;
+			agf.Wait = agf32.Wait;
+			agf.AifFib = (caddr_t)(uintptr_t)agf32.AifFib;
+		}
+	} else
+#endif
+		error = copyin(arg, &agf, sizeof(agf));
+	if (error == 0) {
 		for (ctx = sc->fibctx; ctx; ctx = ctx->next) {
 			if (agf.AdapterFibContext == ctx->unique)
 				break;

Modified: stable/10/sys/modules/aac/Makefile
==============================================================================
--- stable/10/sys/modules/aac/Makefile	Tue Mar 27 17:51:45 2018	(r331636)
+++ stable/10/sys/modules/aac/Makefile	Tue Mar 27 17:52:52 2018	(r331637)
@@ -8,7 +8,7 @@ SUBDIR= aac_linux
 
 KMOD=	aac
 SRCS=	aac.c aac_pci.c aac_disk.c aac_cam.c
-SRCS+=	opt_scsi.h opt_cam.h opt_aac.h
+SRCS+=	opt_scsi.h opt_cam.h opt_compat.h opt_aac.h
 SRCS+=	device_if.h bus_if.h pci_if.h
 
 # To enable debug output from the driver, uncomment these two lines.

Modified: stable/10/sys/modules/aacraid/Makefile
==============================================================================
--- stable/10/sys/modules/aacraid/Makefile	Tue Mar 27 17:51:45 2018	(r331636)
+++ stable/10/sys/modules/aacraid/Makefile	Tue Mar 27 17:52:52 2018	(r331637)
@@ -8,7 +8,7 @@ SUBDIR= aacraid_linux
 
 KMOD=	aacraid
 SRCS=	aacraid.c aacraid_pci.c aacraid_cam.c
-SRCS+=	opt_scsi.h opt_cam.h opt_aacraid.h
+SRCS+=	opt_scsi.h opt_cam.h opt_compat.h opt_aacraid.h
 SRCS+=	device_if.h bus_if.h pci_if.h
 
 # To enable debug output from the driver, uncomment these two lines.

Modified: stable/10/sys/sys/aac_ioctl.h
==============================================================================
--- stable/10/sys/sys/aac_ioctl.h	Tue Mar 27 17:51:45 2018	(r331636)
+++ stable/10/sys/sys/aac_ioctl.h	Tue Mar 27 17:52:52 2018	(r331637)
@@ -173,6 +173,14 @@ struct get_adapter_fib_ioctl {
 	caddr_t		AifFib;
 };
 
+#ifdef _KERNEL
+struct get_adapter_fib_ioctl32 {
+	u_int32_t	AdapterFibContext;
+	int	  	Wait;
+	u_int32_t	AifFib;
+};
+#endif
+
 struct aac_query_disk {
 	int32_t		ContainerNumber;
 	int32_t		Bus;


More information about the svn-src-all mailing list