Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Apr 2019 14:03:32 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r346832 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Message-ID:  <201904281403.x3SE3WFh038877@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sun Apr 28 14:03:32 2019
New Revision: 346832
URL: https://svnweb.freebsd.org/changeset/base/346832

Log:
  MFC r335201 (by emaste@):
  
  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.

Modified:
  stable/11/sys/amd64/linux/linux.h
  stable/11/sys/amd64/linux32/linux.h
  stable/11/sys/compat/linux/linux_event.c
  stable/11/sys/compat/linux/linux_file.c
  stable/11/sys/compat/linux/linux_fork.c
  stable/11/sys/compat/linux/linux_misc.c
  stable/11/sys/compat/linux/linux_stats.c
  stable/11/sys/compat/linux/linux_sysctl.c
  stable/11/sys/i386/linux/linux.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/linux/linux.h
==============================================================================
--- stable/11/sys/amd64/linux/linux.h	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/amd64/linux/linux.h	Sun Apr 28 14:03:32 2019	(r346832)
@@ -35,6 +35,8 @@
 #include <compat/linux/linux.h>
 #include <amd64/linux/linux_syscall.h>
 
+#define	LINUX_LEGACY_SYSCALLS
+
 /*
  * debugging support
  */

Modified: stable/11/sys/amd64/linux32/linux.h
==============================================================================
--- stable/11/sys/amd64/linux32/linux.h	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/amd64/linux32/linux.h	Sun Apr 28 14:03:32 2019	(r346832)
@@ -36,6 +36,8 @@
 #include <compat/linux/linux.h>
 #include <amd64/linux32/linux32_syscall.h>
 
+#define	LINUX_LEGACY_SYSCALLS
+
 /*
  * debugging support
  */

Modified: stable/11/sys/compat/linux/linux_event.c
==============================================================================
--- stable/11/sys/compat/linux/linux_event.c	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/compat/linux/linux_event.c	Sun Apr 28 14:03:32 2019	(r346832)
@@ -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: stable/11/sys/compat/linux/linux_file.c
==============================================================================
--- stable/11/sys/compat/linux/linux_file.c	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/compat/linux/linux_file.c	Sun Apr 28 14:03:32 2019	(r346832)
@@ -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)
 {
@@ -166,7 +167,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);
@@ -192,6 +197,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)
 {
@@ -208,6 +214,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)
@@ -317,6 +324,7 @@ struct l_dirent64 {
 #define	LINUX_RECLEN64_RATIO(X)	X * offsetof(struct dirent, d_name) / 	\
     offsetof(struct l_dirent64, d_name);
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_getdents(struct thread *td, struct linux_getdents_args *args)
 {
@@ -397,6 +405,7 @@ out1:
 	free(buf, M_TEMP);
 	return (error);
 }
+#endif
 
 int
 linux_getdents64(struct thread *td, struct linux_getdents64_args *args)
@@ -532,6 +541,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)
 {
@@ -554,6 +564,7 @@ linux_access(struct thread *td, struct linux_access_ar
 
 	return (error);
 }
+#endif
 
 int
 linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
@@ -579,6 +590,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)
 {
@@ -605,6 +617,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)
@@ -654,6 +667,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)
 {
@@ -671,6 +685,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)
@@ -691,6 +706,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)
 {
@@ -707,6 +723,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)
@@ -726,6 +743,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)
 {
@@ -766,6 +784,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)
@@ -793,6 +812,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)
 {
@@ -816,6 +836,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)
@@ -843,6 +864,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)
 {
@@ -861,6 +883,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)
@@ -928,6 +951,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)
 {
@@ -952,6 +976,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)
@@ -1151,6 +1176,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)
 {
@@ -1160,6 +1186,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
@@ -1472,6 +1499,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)
 {
@@ -1489,6 +1517,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)
@@ -1515,6 +1544,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)
 {
@@ -1532,6 +1562,7 @@ linux_lchown(struct thread *td, struct linux_lchown_ar
 	LFREEPATH(path);
 	return (error);
 }
+#endif
 
 static int
 convert_fadvice(int advice)
@@ -1580,6 +1611,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)
 {
@@ -1603,6 +1635,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: stable/11/sys/compat/linux/linux_fork.c
==============================================================================
--- stable/11/sys/compat/linux/linux_fork.c	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/compat/linux/linux_fork.c	Sun Apr 28 14:03:32 2019	(r346832)
@@ -63,6 +63,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)
 {
@@ -134,6 +135,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: stable/11/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/11/sys/compat/linux/linux_misc.c	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/compat/linux/linux_misc.c	Sun Apr 28 14:03:32 2019	(r346832)
@@ -189,6 +189,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)
 {
@@ -223,6 +224,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)
@@ -492,6 +494,7 @@ cleanup:
 
 #endif	/* __i386__ */
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_select(struct thread *td, struct linux_select_args *args)
 {
@@ -583,6 +586,7 @@ select_out:
 #endif
 	return (error);
 }
+#endif
 
 int
 linux_mremap(struct thread *td, struct linux_mremap_args *args)
@@ -644,6 +648,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)
 {
@@ -663,6 +668,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;
@@ -759,6 +765,7 @@ struct l_utimbuf {
 	l_time_t l_modtime;
 };
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_utime(struct thread *td, struct linux_utime_args *args)
 {
@@ -792,7 +799,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)
 {
@@ -825,6 +834,7 @@ linux_utimes(struct thread *td, struct linux_utimes_ar
 	LFREEPATH(fname);
 	return (error);
 }
+#endif
 
 static int
 linux_utimensat_nsec_valid(l_long nsec)
@@ -919,6 +929,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)
 {
@@ -951,6 +962,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,
@@ -1091,6 +1103,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)
 {
@@ -1139,6 +1152,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: stable/11/sys/compat/linux/linux_stats.c
==============================================================================
--- stable/11/sys/compat/linux/linux_stats.c	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/compat/linux/linux_stats.c	Sun Apr 28 14:03:32 2019	(r346832)
@@ -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)
@@ -155,6 +157,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)
 {
@@ -196,6 +199,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)
@@ -509,6 +513,7 @@ struct l_ustat
 	char		f_fpack[6];
 };
 
+#ifdef LINUX_LEGACY_SYSCALLS
 int
 linux_ustat(struct thread *td, struct linux_ustat_args *args)
 {
@@ -519,6 +524,7 @@ linux_ustat(struct thread *td, struct linux_ustat_args
 
 	return (EOPNOTSUPP);
 }
+#endif
 
 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
 

Modified: stable/11/sys/compat/linux/linux_sysctl.c
==============================================================================
--- stable/11/sys/compat/linux/linux_sysctl.c	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/compat/linux/linux_sysctl.c	Sun Apr 28 14:03:32 2019	(r346832)
@@ -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: stable/11/sys/i386/linux/linux.h
==============================================================================
--- stable/11/sys/i386/linux/linux.h	Sun Apr 28 13:45:18 2019	(r346831)
+++ stable/11/sys/i386/linux/linux.h	Sun Apr 28 14:03:32 2019	(r346832)
@@ -36,6 +36,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?201904281403.x3SE3WFh038877>