Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jun 2018 14:41:52 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335201 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Message-ID:  <201806151441.w5FEfqwu056379@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Fri Jun 15 14:41:51 2018
New Revision: 335201
URL: https://svnweb.freebsd.org/changeset/base/335201

Log:
  linuxulator: do not include legacy syscalls on arm64
  
  Existing linuxulator platforms (i386, amd64) support legacy syscalls,
  such as non-*at ones like open, but arm64 and other new platforms do
  not.
  
  Wrap these in #ifdef LINUX_LEGACY_SYSCALLS, #defined in the MD linux.h
  files.  We may need finer grained control in the future but this is
  sufficient for now.
  
  Reviewed by:	andrew
  Sponsored by:	Turing Robotic Industries
  Differential Revision:	https://reviews.freebsd.org/D15237

Modified:
  head/sys/amd64/linux/linux.h
  head/sys/amd64/linux32/linux.h
  head/sys/compat/linux/linux_event.c
  head/sys/compat/linux/linux_file.c
  head/sys/compat/linux/linux_fork.c
  head/sys/compat/linux/linux_misc.c
  head/sys/compat/linux/linux_stats.c
  head/sys/compat/linux/linux_sysctl.c
  head/sys/i386/linux/linux.h

Modified: head/sys/amd64/linux/linux.h
==============================================================================
--- head/sys/amd64/linux/linux.h	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/amd64/linux/linux.h	Fri Jun 15 14:41:51 2018	(r335201)
@@ -35,6 +35,8 @@
 #include <compat/linux/linux.h>
 #include <amd64/linux/linux_syscall.h>
 
+#define	LINUX_LEGACY_SYSCALLS
+
 /*
  * debugging support
  */

Modified: head/sys/amd64/linux32/linux.h
==============================================================================
--- head/sys/amd64/linux32/linux.h	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/amd64/linux32/linux.h	Fri Jun 15 14:41:51 2018	(r335201)
@@ -38,6 +38,8 @@
 #include <compat/linux/linux.h>
 #include <amd64/linux32/linux32_syscall.h>
 
+#define	LINUX_LEGACY_SYSCALLS
+
 /*
  * debugging support
  */

Modified: head/sys/compat/linux/linux_event.c
==============================================================================
--- head/sys/compat/linux/linux_event.c	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/compat/linux/linux_event.c	Fri Jun 15 14:41:51 2018	(r335201)
@@ -263,6 +263,7 @@ epoll_create_common(struct thread *td, int flags)
 	return (0);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_epoll_create(struct thread *td, struct linux_epoll_create_args *args)
 {
@@ -276,6 +277,7 @@ linux_epoll_create(struct thread *td, struct linux_epo
 
 	return (epoll_create_common(td, 0));
 }
+#endif
 
 int
 linux_epoll_create1(struct thread *td, struct linux_epoll_create1_args *args)
@@ -616,6 +618,7 @@ leave1:
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_epoll_wait(struct thread *td, struct linux_epoll_wait_args *args)
 {
@@ -623,6 +626,7 @@ linux_epoll_wait(struct thread *td, struct linux_epoll
 	return (linux_epoll_wait_common(td, args->epfd, args->events,
 	    args->maxevents, args->timeout, NULL));
 }
+#endif
 
 int
 linux_epoll_pwait(struct thread *td, struct linux_epoll_pwait_args *args)
@@ -707,12 +711,14 @@ eventfd_create(struct thread *td, uint32_t initval, in
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_eventfd(struct thread *td, struct linux_eventfd_args *args)
 {
 
 	return (eventfd_create(td, args->initval, 0));
 }
+#endif
 
 int
 linux_eventfd2(struct thread *td, struct linux_eventfd2_args *args)

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/compat/linux/linux_file.c	Fri Jun 15 14:41:51 2018	(r335201)
@@ -68,6 +68,7 @@ static int	linux_common_open(struct thread *, int, cha
 static int	linux_getdents_error(struct thread *, int, int);
 
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_creat(struct thread *td, struct linux_creat_args *args)
 {
@@ -84,8 +85,8 @@ linux_creat(struct thread *td, struct linux_creat_args
 	LFREEPATH(path);
 	return (error);
 }
+#endif
 
-
 static int
 linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int mode)
 {
@@ -165,7 +166,11 @@ linux_common_open(struct thread *td, int dirfd, char *
 
 done:
 #ifdef DEBUG
+#ifdef LINUX_LEGACY_SYSCALLS
 	if (ldebug(open))
+#else
+	if (ldebug(openat))
+#endif
 		printf(LMSG("open returns error %d"), error);
 #endif
 	LFREEPATH(path);
@@ -191,6 +196,7 @@ linux_openat(struct thread *td, struct linux_openat_ar
 	return (linux_common_open(td, dfd, path, args->flags, args->mode));
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_open(struct thread *td, struct linux_open_args *args)
 {
@@ -207,6 +213,7 @@ linux_open(struct thread *td, struct linux_open_args *
 #endif
 	return (linux_common_open(td, AT_FDCWD, path, args->flags, args->mode));
 }
+#endif
 
 int
 linux_lseek(struct thread *td, struct linux_lseek_args *args)
@@ -305,6 +312,7 @@ struct l_dirent64 {
     roundup(offsetof(struct l_dirent64, d_name) + (namlen) + 1,		\
     sizeof(uint64_t))
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_getdents(struct thread *td, struct linux_getdents_args *args)
 {
@@ -384,6 +392,7 @@ out1:
 	free(buf, M_TEMP);
 	return (error);
 }
+#endif
 
 int
 linux_getdents64(struct thread *td, struct linux_getdents64_args *args)
@@ -517,6 +526,7 @@ out:
  * These exist mainly for hooks for doing /compat/linux translation.
  */
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_access(struct thread *td, struct linux_access_args *args)
 {
@@ -539,6 +549,7 @@ linux_access(struct thread *td, struct linux_access_ar
 
 	return (error);
 }
+#endif
 
 int
 linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
@@ -564,6 +575,7 @@ linux_faccessat(struct thread *td, struct linux_facces
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_unlink(struct thread *td, struct linux_unlink_args *args)
 {
@@ -590,6 +602,7 @@ linux_unlink(struct thread *td, struct linux_unlink_ar
 	LFREEPATH(path);
 	return (error);
 }
+#endif
 
 int
 linux_unlinkat(struct thread *td, struct linux_unlinkat_args *args)
@@ -639,6 +652,7 @@ linux_chdir(struct thread *td, struct linux_chdir_args
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_chmod(struct thread *td, struct linux_chmod_args *args)
 {
@@ -656,6 +670,7 @@ linux_chmod(struct thread *td, struct linux_chmod_args
 	LFREEPATH(path);
 	return (error);
 }
+#endif
 
 int
 linux_fchmodat(struct thread *td, struct linux_fchmodat_args *args)
@@ -676,6 +691,7 @@ linux_fchmodat(struct thread *td, struct linux_fchmoda
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_mkdir(struct thread *td, struct linux_mkdir_args *args)
 {
@@ -692,6 +708,7 @@ linux_mkdir(struct thread *td, struct linux_mkdir_args
 	LFREEPATH(path);
 	return (error);
 }
+#endif
 
 int
 linux_mkdirat(struct thread *td, struct linux_mkdirat_args *args)
@@ -711,6 +728,7 @@ linux_mkdirat(struct thread *td, struct linux_mkdirat_
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_rmdir(struct thread *td, struct linux_rmdir_args *args)
 {
@@ -751,6 +769,7 @@ linux_rename(struct thread *td, struct linux_rename_ar
 	LFREEPATH(to);
 	return (error);
 }
+#endif
 
 int
 linux_renameat(struct thread *td, struct linux_renameat_args *args)
@@ -778,6 +797,7 @@ linux_renameat(struct thread *td, struct linux_renamea
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_symlink(struct thread *td, struct linux_symlink_args *args)
 {
@@ -801,6 +821,7 @@ linux_symlink(struct thread *td, struct linux_symlink_
 	LFREEPATH(to);
 	return (error);
 }
+#endif
 
 int
 linux_symlinkat(struct thread *td, struct linux_symlinkat_args *args)
@@ -828,6 +849,7 @@ linux_symlinkat(struct thread *td, struct linux_symlin
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_readlink(struct thread *td, struct linux_readlink_args *args)
 {
@@ -846,6 +868,7 @@ linux_readlink(struct thread *td, struct linux_readlin
 	LFREEPATH(name);
 	return (error);
 }
+#endif
 
 int
 linux_readlinkat(struct thread *td, struct linux_readlinkat_args *args)
@@ -913,6 +936,7 @@ linux_ftruncate(struct thread *td, struct linux_ftrunc
 	return (kern_ftruncate(td, args->fd, args->length));
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_link(struct thread *td, struct linux_link_args *args)
 {
@@ -937,6 +961,7 @@ linux_link(struct thread *td, struct linux_link_args *
 	LFREEPATH(to);
 	return (error);
 }
+#endif
 
 int
 linux_linkat(struct thread *td, struct linux_linkat_args *args)
@@ -1138,6 +1163,7 @@ linux_oldumount(struct thread *td, struct linux_oldumo
 }
 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_umount(struct thread *td, struct linux_umount_args *args)
 {
@@ -1147,6 +1173,7 @@ linux_umount(struct thread *td, struct linux_umount_ar
 	bsd.flags = args->flags;	/* XXX correct? */
 	return (sys_unmount(td, &bsd));
 }
+#endif
 
 /*
  * fcntl family of syscalls
@@ -1458,6 +1485,7 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_
 }
 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_chown(struct thread *td, struct linux_chown_args *args)
 {
@@ -1475,6 +1503,7 @@ linux_chown(struct thread *td, struct linux_chown_args
 	LFREEPATH(path);
 	return (error);
 }
+#endif
 
 int
 linux_fchownat(struct thread *td, struct linux_fchownat_args *args)
@@ -1501,6 +1530,7 @@ linux_fchownat(struct thread *td, struct linux_fchowna
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_lchown(struct thread *td, struct linux_lchown_args *args)
 {
@@ -1518,6 +1548,7 @@ linux_lchown(struct thread *td, struct linux_lchown_ar
 	LFREEPATH(path);
 	return (error);
 }
+#endif
 
 static int
 convert_fadvice(int advice)
@@ -1566,6 +1597,7 @@ linux_fadvise64_64(struct thread *td, struct linux_fad
 }
 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_pipe(struct thread *td, struct linux_pipe_args *args)
 {
@@ -1589,6 +1621,7 @@ linux_pipe(struct thread *td, struct linux_pipe_args *
 
 	return (error);
 }
+#endif
 
 int
 linux_pipe2(struct thread *td, struct linux_pipe2_args *args)

Modified: head/sys/compat/linux/linux_fork.c
==============================================================================
--- head/sys/compat/linux/linux_fork.c	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/compat/linux/linux_fork.c	Fri Jun 15 14:41:51 2018	(r335201)
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
 #include <compat/linux/linux_misc.h>
 #include <compat/linux/linux_util.h>
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_fork(struct thread *td, struct linux_fork_args *args)
 {
@@ -135,6 +136,7 @@ linux_vfork(struct thread *td, struct linux_vfork_args
 
 	return (0);
 }
+#endif
 
 static int
 linux_clone_proc(struct thread *td, struct linux_clone_args *args)

Modified: head/sys/compat/linux/linux_misc.c
==============================================================================
--- head/sys/compat/linux/linux_misc.c	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/compat/linux/linux_misc.c	Fri Jun 15 14:41:51 2018	(r335201)
@@ -191,6 +191,7 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_
 	return (copyout(&sysinfo, args->info, sizeof(sysinfo)));
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_alarm(struct thread *td, struct linux_alarm_args *args)
 {
@@ -225,6 +226,7 @@ linux_alarm(struct thread *td, struct linux_alarm_args
 	td->td_retval[0] = old_it.it_value.tv_sec;
 	return (0);
 }
+#endif
 
 int
 linux_brk(struct thread *td, struct linux_brk_args *args)
@@ -494,6 +496,7 @@ cleanup:
 
 #endif	/* __i386__ */
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_select(struct thread *td, struct linux_select_args *args)
 {
@@ -585,6 +588,7 @@ select_out:
 #endif
 	return (error);
 }
+#endif
 
 int
 linux_mremap(struct thread *td, struct linux_mremap_args *args)
@@ -646,6 +650,7 @@ linux_msync(struct thread *td, struct linux_msync_args
 	    args->fl & ~LINUX_MS_SYNC));
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_time(struct thread *td, struct linux_time_args *args)
 {
@@ -665,6 +670,7 @@ linux_time(struct thread *td, struct linux_time_args *
 	td->td_retval[0] = tm;
 	return (0);
 }
+#endif
 
 struct l_times_argv {
 	l_clock_t	tms_utime;
@@ -761,6 +767,7 @@ struct l_utimbuf {
 	l_time_t l_modtime;
 };
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_utime(struct thread *td, struct linux_utime_args *args)
 {
@@ -794,7 +801,9 @@ linux_utime(struct thread *td, struct linux_utime_args
 	LFREEPATH(fname);
 	return (error);
 }
+#endif
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_utimes(struct thread *td, struct linux_utimes_args *args)
 {
@@ -827,6 +836,7 @@ linux_utimes(struct thread *td, struct linux_utimes_ar
 	LFREEPATH(fname);
 	return (error);
 }
+#endif
 
 static int
 linux_utimensat_nsec_valid(l_long nsec)
@@ -921,6 +931,7 @@ linux_utimensat(struct thread *td, struct linux_utimen
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_futimesat(struct thread *td, struct linux_futimesat_args *args)
 {
@@ -953,6 +964,7 @@ linux_futimesat(struct thread *td, struct linux_futime
 	LFREEPATH(fname);
 	return (error);
 }
+#endif
 
 int
 linux_common_wait(struct thread *td, int pid, int *status,
@@ -1094,6 +1106,7 @@ linux_waitid(struct thread *td, struct linux_waitid_ar
 	return (error);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_mknod(struct thread *td, struct linux_mknod_args *args)
 {
@@ -1142,6 +1155,7 @@ linux_mknod(struct thread *td, struct linux_mknod_args
 	LFREEPATH(path);
 	return (error);
 }
+#endif
 
 int
 linux_mknodat(struct thread *td, struct linux_mknodat_args *args)

Modified: head/sys/compat/linux/linux_stats.c
==============================================================================
--- head/sys/compat/linux/linux_stats.c	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/compat/linux/linux_stats.c	Fri Jun 15 14:41:51 2018	(r335201)
@@ -81,6 +81,7 @@ linux_kern_statat(struct thread *td, int flag, int fd,
 	    translate_vnhook_major_minor));
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 static int
 linux_kern_stat(struct thread *td, char *path, enum uio_seg pathseg,
     struct stat *sbp)
@@ -97,6 +98,7 @@ linux_kern_lstat(struct thread *td, char *path, enum u
 	return (linux_kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, path,
 	    pathseg, sbp));
 }
+#endif
 
 static void
 translate_fd_major_minor(struct thread *td, int fd, struct stat *buf)
@@ -173,6 +175,7 @@ newstat_copyout(struct stat *buf, void *ubuf)
 	return (copyout(&tbuf, ubuf, sizeof(tbuf)));
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_newstat(struct thread *td, struct linux_newstat_args *args)
 {
@@ -214,6 +217,7 @@ linux_newlstat(struct thread *td, struct linux_newlsta
 		return (error);
 	return (newstat_copyout(&sb, args->buf));
 }
+#endif
 
 int
 linux_newfstat(struct thread *td, struct linux_newfstat_args *args)
@@ -524,6 +528,7 @@ struct l_ustat
 	char		f_fpack[6];
 };
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_ustat(struct thread *td, struct linux_ustat_args *args)
 {
@@ -534,6 +539,7 @@ linux_ustat(struct thread *td, struct linux_ustat_args
 
 	return (EOPNOTSUPP);
 }
+#endif
 
 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
 

Modified: head/sys/compat/linux/linux_sysctl.c
==============================================================================
--- head/sys/compat/linux/linux_sysctl.c	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/compat/linux/linux_sysctl.c	Fri Jun 15 14:41:51 2018	(r335201)
@@ -115,6 +115,7 @@ handle_string(struct l___sysctl_args *la, char *value)
 	return (0);
 }
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
 {
@@ -191,3 +192,4 @@ linux_sysctl(struct thread *td, struct linux_sysctl_ar
 	LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR);
 	return (ENOTDIR);
 }
+#endif

Modified: head/sys/i386/linux/linux.h
==============================================================================
--- head/sys/i386/linux/linux.h	Fri Jun 15 14:29:41 2018	(r335200)
+++ head/sys/i386/linux/linux.h	Fri Jun 15 14:41:51 2018	(r335201)
@@ -35,6 +35,8 @@
 #include <compat/linux/linux.h>
 #include <i386/linux/linux_syscall.h>
 
+#define LINUX_LEGACY_SYSCALLS
+
 /*
  * debugging support
  */



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