Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 2016 01:09:53 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294368 - in stable/10/sys: amd64/linux amd64/linux32 cddl/dev/systrace compat/linux kern modules/dtrace modules/dtrace/systrace_linux modules/dtrace/systrace_linux32
Message-ID:  <201601200109.u0K19rv4007791@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Jan 20 01:09:53 2016
New Revision: 294368
URL: https://svnweb.freebsd.org/changeset/base/294368

Log:
  MFC 289769,289822,290143,290144:
  Rename remaining linux32 symbols from linux_* to linux32_*.
  
  289769:
  Rename remaining linux32 symbols such as linux_sysent[] and
  linux_syscallnames[] from linux_* to linux32_* to avoid conflicts with
  linux64.ko.  While here, add support for linux64 binaries to systrace.
  - Update NOPROTO entries in amd64/linux/syscalls.master to match the
    main table to fix systrace build.
  - Add a special case for union l_semun arguments to the systrace
    generation.
  - The systrace_linux32 module now only builds the systrace_linux32.ko.
    module on amd64.
  - Add a new systrace_linux module that builds on both i386 and amd64.
    For i386 it builds the existing systrace_linux.ko.  For amd64 it
    builds a systrace_linux.ko for 64-bit binaries.
  
  289822:
  Fix build for the KTR-enabled kernels.
  
  290143:
  Fix build with DEBUG defined.
  
  290144:
  Update for LINUX32 rename.  The assembler didn't complain about undefined
  symbols but just used 0 after the rename.

Added:
  stable/10/sys/modules/dtrace/systrace_linux/
     - copied from r289769, head/sys/modules/dtrace/systrace_linux/
Modified:
  stable/10/sys/amd64/linux/syscalls.master
  stable/10/sys/amd64/linux32/linux.h
  stable/10/sys/amd64/linux32/linux32_locore.s
  stable/10/sys/amd64/linux32/linux32_sysvec.c
  stable/10/sys/amd64/linux32/syscalls.conf
  stable/10/sys/amd64/linux32/syscalls.master
  stable/10/sys/cddl/dev/systrace/systrace.c
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/kern/makesyscalls.sh
  stable/10/sys/modules/dtrace/Makefile
  stable/10/sys/modules/dtrace/systrace_linux32/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/syscalls.master
==============================================================================
--- stable/10/sys/amd64/linux/syscalls.master	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/amd64/linux/syscalls.master	Wed Jan 20 01:09:53 2016	(r294368)
@@ -49,8 +49,8 @@
 				    struct l_newstat *buf); }
 6	AUE_LSTAT	STD	{ int linux_newlstat(char *path, \
 				    struct l_newstat *buf); }
-7	AUE_POLL	NOPROTO	{ int poll(struct pollfd*, \
-				    unsigned int nfds, int timeout); }
+7	AUE_POLL	NOPROTO	{ int poll(struct pollfd *fds, u_int nfds, \
+				    int timeout); }
 8	AUE_LSEEK	STD	{ int linux_lseek(l_uint fdes, l_off_t off, \
 				    l_int whence); }
 9	AUE_MMAP	STD	{ int linux_mmap2(l_ulong addr, l_ulong len, \
@@ -316,7 +316,7 @@
 161	AUE_CHROOT	NOPROTO	{ int chroot(char *path); }
 162	AUE_SYNC	NOPROTO	{ int sync(void); }
 163	AUE_ACCT	NOPROTO	{ int acct(char *path); }
-164	AUE_SETTIMEOFDAY	NOPROTO	{ int settimeofday(struct l_timeval *tp, struct timezone *tzp); }
+164	AUE_SETTIMEOFDAY	NOPROTO	{ int settimeofday(struct l_timeval *tv, struct timezone *tzp); }
 165	AUE_MOUNT	STD	{ int linux_mount(char *specialfile, \
 				    char *dir, char *filesystemtype, \
 				    l_ulong rwflag, void *data); }

Modified: stable/10/sys/amd64/linux32/linux.h
==============================================================================
--- stable/10/sys/amd64/linux32/linux.h	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/amd64/linux32/linux.h	Wed Jan 20 01:09:53 2016	(r294368)
@@ -40,7 +40,7 @@
  * debugging support
  */
 extern u_char linux_debug_map[];
-#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
+#define	ldebug(name)	isclr(linux_debug_map, LINUX32_SYS_linux_ ## name)
 #define	ARGS(nm, fmt)	"linux(%ld/%ld): "#nm"("fmt")\n",			\
 			(long)td->td_proc->p_pid, (long)td->td_tid
 #define	LMSG(fmt)	"linux(%ld/%ld): "fmt"\n",				\

Modified: stable/10/sys/amd64/linux32/linux32_locore.s
==============================================================================
--- stable/10/sys/amd64/linux32/linux32_locore.s	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/amd64/linux32/linux32_locore.s	Wed Jan 20 01:09:53 2016	(r294368)
@@ -28,7 +28,7 @@ NON_GPROF_ENTRY(linux32_sigcode)
 	jmp	*LINUX_SIGF_HANDLER(%ebx)
 .startsigcode:
 	popl	%eax
-	movl	$LINUX_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
+	movl	$LINUX32_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
 	int	$0x80				/* enter kernel with args */
 .endsigcode:
 0:	jmp	0b
@@ -44,7 +44,7 @@ NON_GPROF_ENTRY(linux32_rt_sigcode)
 	push	%eax
 	jmp	*LINUX_RT_SIGF_HANDLER(%edi)
 .startrtsigcode:
-	movl	$LINUX_SYS_linux_rt_sigreturn,%eax   /* linux_rt_sigreturn() */
+	movl	$LINUX32_SYS_linux_rt_sigreturn,%eax   /* linux_rt_sigreturn() */
 	int	$0x80				/* enter kernel with args */
 .endrtsigcode:
 0:	jmp	0b

Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/10/sys/amd64/linux32/linux32_sysvec.c	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/amd64/linux32/linux32_sysvec.c	Wed Jan 20 01:09:53 2016	(r294368)
@@ -105,8 +105,8 @@ MODULE_VERSION(linux, 1);
  * to syscall 0. This is slightly less bogus than using
  * ldebug(sigreturn).
  */
-#define	LINUX_SYS_linux_rt_sendsig	0
-#define	LINUX_SYS_linux_sendsig		0
+#define	LINUX32_SYS_linux_rt_sendsig	0
+#define	LINUX32_SYS_linux_sendsig	0
 
 const char *linux_kplatform;
 static int linux_szsigcode;
@@ -115,7 +115,7 @@ static char *linux_shared_page_mapping;
 extern char _binary_linux32_locore_o_start;
 extern char _binary_linux32_locore_o_end;
 
-extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
+extern struct sysent linux32_sysent[LINUX32_SYS_MAXSYSCALL];
 
 SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
 
@@ -1008,8 +1008,8 @@ linux32_fixlimit(struct rlimit *rl, int 
 }
 
 struct sysentvec elf_linux_sysvec = {
-	.sv_size	= LINUX_SYS_MAXSYSCALL,
-	.sv_table	= linux_sysent,
+	.sv_size	= LINUX32_SYS_MAXSYSCALL,
+	.sv_table	= linux32_sysent,
 	.sv_mask	= 0,
 	.sv_sigsize	= 0,
 	.sv_sigtbl	= NULL,

Modified: stable/10/sys/amd64/linux32/syscalls.conf
==============================================================================
--- stable/10/sys/amd64/linux32/syscalls.conf	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/amd64/linux32/syscalls.conf	Wed Jan 20 01:09:53 2016	(r294368)
@@ -1,11 +1,11 @@
 # $FreeBSD$
 sysnames="linux32_syscalls.c"
 sysproto="linux32_proto.h"
-sysproto_h=_LINUX_SYSPROTO_H_
+sysproto_h=_LINUX32_SYSPROTO_H_
 syshdr="linux32_syscall.h"
 syssw="linux32_sysent.c"
 sysmk="/dev/null"
-syscallprefix="LINUX_SYS_"
-switchname="linux_sysent"
-namesname="linux_syscallnames"
+syscallprefix="LINUX32_SYS_"
+switchname="linux32_sysent"
+namesname="linux32_syscallnames"
 systrace="linux32_systrace_args.c"

Modified: stable/10/sys/amd64/linux32/syscalls.master
==============================================================================
--- stable/10/sys/amd64/linux32/syscalls.master	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/amd64/linux32/syscalls.master	Wed Jan 20 01:09:53 2016	(r294368)
@@ -2,7 +2,7 @@
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 ; System call name/number master file (or rather, slave, from LINUX).
-; Processed to create linux_sysent.c, linux_proto.h and linux_syscall.h.
+; Processed to create linux32_sysent.c, linux32_proto.h and linux32_syscall.h.
 
 ; Columns: number audit type nargs name alt{name,tag,rtyp}/comments
 ;	number	system call number, must be in order

Modified: stable/10/sys/cddl/dev/systrace/systrace.c
==============================================================================
--- stable/10/sys/cddl/dev/systrace/systrace.c	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/cddl/dev/systrace/systrace.c	Wed Jan 20 01:09:53 2016	(r294368)
@@ -60,24 +60,37 @@
 
 #ifdef LINUX_SYSTRACE
 #if defined(__amd64__)
-#include <amd64/linux32/linux.h>
-#include <amd64/linux32/linux32_proto.h>
-#include <amd64/linux32/linux32_syscalls.c>
-#include <amd64/linux32/linux32_systrace_args.c>
-#define	MODNAME		"linux32"
+#include <amd64/linux/linux.h>
+#include <amd64/linux/linux_proto.h>
+#include <amd64/linux/linux_syscalls.c>
+#include <amd64/linux/linux_systrace_args.c>
 #elif defined(__i386__)
 #include <i386/linux/linux.h>
 #include <i386/linux/linux_proto.h>
 #include <i386/linux/linux_syscalls.c>
 #include <i386/linux/linux_systrace_args.c>
-#define	MODNAME		"linux"
 #else
 #error Only i386 and amd64 are supported.
 #endif
+#define	MODNAME		"linux"
 extern struct sysent linux_sysent[];
 #define	MAXSYSCALL	LINUX_SYS_MAXSYSCALL
 #define	SYSCALLNAMES	linux_syscallnames
 #define	SYSENT		linux_sysent
+#elif defined(LINUX32_SYSTRACE)
+#if defined(__amd64__)
+#include <amd64/linux32/linux.h>
+#include <amd64/linux32/linux32_proto.h>
+#include <amd64/linux32/linux32_syscalls.c>
+#include <amd64/linux32/linux32_systrace_args.c>
+#else
+#error Only amd64 is supported.
+#endif
+#define	MODNAME		"linux32"
+extern struct sysent linux32_sysent[];
+#define	MAXSYSCALL	LINUX32_SYS_MAXSYSCALL
+#define	SYSCALLNAMES	linux32_syscallnames
+#define	SYSENT		linux32_sysent
 #elif defined(FREEBSD32_SYSTRACE)
 /*
  * The syscall arguments are processed into a DTrace argument array
@@ -103,6 +116,7 @@ extern const char *freebsd32_syscallname
 #define	MAXSYSCALL	SYS_MAXSYSCALL
 #define	SYSCALLNAMES	syscallnames
 #define	SYSENT		sysent
+#define	NATIVE_ABI
 #endif
 
 #define	PROVNAME	"syscall"
@@ -132,7 +146,7 @@ static void	systrace_load(void *);
 static struct cdevsw systrace_cdevsw = {
 	.d_version	= D_VERSION,
 	.d_open		= systrace_open,
-#ifdef LINUX_SYSTRACE
+#ifndef NATIVE_ABI
 	.d_name		= "systrace_" MODNAME,
 #else
 	.d_name		= "systrace",
@@ -171,7 +185,7 @@ static dtrace_provider_id_t	systrace_id;
 typedef void (*systrace_dtrace_probe_t)(dtrace_id_t, uintptr_t, uintptr_t,
     uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
 
-#if !defined(LINUX_SYSTRACE)
+#ifdef NATIVE_ABI
 /*
  * Probe callback function.
  *
@@ -314,7 +328,7 @@ systrace_load(void *dummy)
 	    NULL, &systrace_pops, NULL, &systrace_id) != 0)
 		return;
 
-#if !defined(LINUX_SYSTRACE)
+#ifdef NATIVE_ABI
 	systrace_probe_func = systrace_probe;
 #endif
 }
@@ -328,7 +342,7 @@ systrace_unload()
 	if ((error = dtrace_unregister(systrace_id)) != 0)
 		return (error);
 
-#if !defined(LINUX_SYSTRACE)
+#ifdef NATIVE_ABI
 	systrace_probe_func = NULL;
 #endif
 
@@ -370,6 +384,16 @@ SYSINIT(systrace_load, SI_SUB_DTRACE_PRO
 SYSUNINIT(systrace_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, systrace_unload, NULL);
 
 #ifdef LINUX_SYSTRACE
+DEV_MODULE(systrace_linux, systrace_modevent, NULL);
+MODULE_VERSION(systrace_linux, 1);
+#ifdef __amd64__
+MODULE_DEPEND(systrace_linux, linux64, 1, 1, 1);
+#else
+MODULE_DEPEND(systrace_linux, linux, 1, 1, 1);
+#endif
+MODULE_DEPEND(systrace_linux, dtrace, 1, 1, 1);
+MODULE_DEPEND(systrace_linux, opensolaris, 1, 1, 1);
+#elif defined(LINUX32_SYSTRACE)
 DEV_MODULE(systrace_linux32, systrace_modevent, NULL);
 MODULE_VERSION(systrace_linux32, 1);
 MODULE_DEPEND(systrace_linux32, linux, 1, 1, 1);

Modified: stable/10/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/10/sys/compat/linux/linux_misc.c	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/compat/linux/linux_misc.c	Wed Jan 20 01:09:53 2016	(r294368)
@@ -2362,7 +2362,13 @@ linux_ppoll(struct thread *td, struct li
 #if defined(DEBUG) || defined(KTR)
 /* XXX: can be removed when every ldebug(...) and KTR stuff are removed. */
 
-u_char linux_debug_map[howmany(LINUX_SYS_MAXSYSCALL, sizeof(u_char))];
+#ifdef COMPAT_LINUX32
+#define	L_MAXSYSCALL	LINUX32_SYS_MAXSYSCALL
+#else
+#define	L_MAXSYSCALL	LINUX_SYS_MAXSYSCALL
+#endif
+
+u_char linux_debug_map[howmany(L_MAXSYSCALL, sizeof(u_char))];
 
 static int
 linux_debug(int syscall, int toggle, int global)
@@ -2374,7 +2380,7 @@ linux_debug(int syscall, int toggle, int
 		memset(linux_debug_map, c, sizeof(linux_debug_map));
 		return (0);
 	}
-	if (syscall < 0 || syscall >= LINUX_SYS_MAXSYSCALL)
+	if (syscall < 0 || syscall >= L_MAXSYSCALL)
 		return (EINVAL);
 	if (toggle)
 		clrbit(linux_debug_map, syscall);
@@ -2382,6 +2388,7 @@ linux_debug(int syscall, int toggle, int
 		setbit(linux_debug_map, syscall);
 	return (0);
 }
+#undef L_MAXSYSCALL
 
 /*
  * Usage: sysctl linux.debug=<syscall_nr>.<0/1>

Modified: stable/10/sys/kern/makesyscalls.sh
==============================================================================
--- stable/10/sys/kern/makesyscalls.sh	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/kern/makesyscalls.sh	Wed Jan 20 01:09:53 2016	(r294368)
@@ -410,6 +410,10 @@ s/\$//g
 					printf("\t\tuarg[%d] = (intptr_t) p->%s; /* %s */\n", \
 					     i - 1, \
 					     argname[i], arg) > systrace
+				else if (arg == "union l_semun")
+					printf("\t\tuarg[%d] = p->%s.buf; /* %s */\n", \
+					     i - 1, \
+					     argname[i], arg) > systrace
 				else if (substr(arg, 1, 1) == "u" || arg == "size_t")
 					printf("\t\tuarg[%d] = p->%s; /* %s */\n", \
 					     i - 1, \

Modified: stable/10/sys/modules/dtrace/Makefile
==============================================================================
--- stable/10/sys/modules/dtrace/Makefile	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/modules/dtrace/Makefile	Wed Jan 20 01:09:53 2016	(r294368)
@@ -16,7 +16,10 @@ SUBDIR=		dtmalloc	\
 		systrace
 
 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
-SUBDIR+=	fasttrap fbt systrace_linux32
+SUBDIR+=	fasttrap fbt systrace_linux
+.endif
+.if ${MACHINE_CPUARCH} == "amd64"
+SUBDIR+=	systrace_linux32
 .endif
 .if ${MACHINE_CPUARCH} == "powerpc"
 SUBDIR+=	fbt fasttrap

Modified: stable/10/sys/modules/dtrace/systrace_linux32/Makefile
==============================================================================
--- stable/10/sys/modules/dtrace/systrace_linux32/Makefile	Wed Jan 20 00:26:50 2016	(r294367)
+++ stable/10/sys/modules/dtrace/systrace_linux32/Makefile	Wed Jan 20 01:09:53 2016	(r294368)
@@ -2,18 +2,14 @@
 
 .PATH: ${.CURDIR}/../../../cddl/dev/systrace
 
-.if ${MACHINE} == "amd64"
 KMOD=		systrace_linux32
-.else
-KMOD=		systrace_linux
-.endif
 
 SRCS=		systrace.c
 SRCS+=		vnode_if.h
 
 CFLAGS+=	-I${.CURDIR}/../../../cddl/compat/opensolaris \
 		-I${.CURDIR}/../../../cddl/contrib/opensolaris/uts/common \
-		-I${.CURDIR}/../../.. -DLINUX_SYSTRACE
+		-I${.CURDIR}/../../.. -DLINUX32_SYSTRACE
 
 .include <bsd.kmod.mk>
 



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