Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2020 20:25:10 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364529 - in stable/12: share/man/man4 sys/amd64/linux sys/amd64/linux32 sys/arm64/linux sys/compat/linux sys/i386/linux
Message-ID:  <202008232025.07NKPAso021989@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Aug 23 20:25:10 2020
New Revision: 364529
URL: https://svnweb.freebsd.org/changeset/base/364529

Log:
  MFC r355818:
  
  Add compat.linux.emul_path, so it can be set to something other
  than "/compat/linux".  Useful when you have several compat directories
  with different Linux versions and you don't want to clash with files
  installed by linux-c7 packages.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/12/share/man/man4/linux.4
  stable/12/sys/amd64/linux/linux_sysvec.c
  stable/12/sys/amd64/linux32/linux32_sysvec.c
  stable/12/sys/arm64/linux/linux_sysvec.c
  stable/12/sys/compat/linux/linux_util.c
  stable/12/sys/compat/linux/linux_util.h
  stable/12/sys/i386/linux/linux_sysvec.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/linux.4
==============================================================================
--- stable/12/share/man/man4/linux.4	Sun Aug 23 20:20:13 2020	(r364528)
+++ stable/12/share/man/man4/linux.4	Sun Aug 23 20:25:10 2020	(r364529)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 13, 2019
+.Dd December 16, 2019
 .Dt LINUX 4
 .Os
 .Sh NAME
@@ -95,6 +95,10 @@ variables and
 .Xr loader 8
 tunables:
 .Bl -tag -width indent
+.It Va compat.linux.emul_path
+Path to the Linux run-time environment.
+Defaults to
+.Pa /compat/linux .
 .It Va compat.linux.osname
 Linux kernel operating system name.
 .It Va compat.linux.osrelease

Modified: stable/12/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- stable/12/sys/amd64/linux/linux_sysvec.c	Sun Aug 23 20:20:13 2020	(r364528)
+++ stable/12/sys/amd64/linux/linux_sysvec.c	Sun Aug 23 20:25:10 2020	(r364529)
@@ -826,7 +826,7 @@ static Elf64_Brandinfo linux_glibc2brand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_X86_64,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib64/ld-linux-x86-64.so.2",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,
@@ -838,7 +838,7 @@ static Elf64_Brandinfo linux_glibc2brandshort = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_X86_64,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib64/ld-linux.so.2",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,
@@ -850,7 +850,7 @@ static Elf64_Brandinfo linux_muslbrand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_X86_64,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib/ld-musl-x86_64.so.1",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,

Modified: stable/12/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/12/sys/amd64/linux32/linux32_sysvec.c	Sun Aug 23 20:20:13 2020	(r364528)
+++ stable/12/sys/amd64/linux32/linux32_sysvec.c	Sun Aug 23 20:25:10 2020	(r364529)
@@ -1016,7 +1016,7 @@ static Elf32_Brandinfo linux_brand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_386,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib/ld-linux.so.1",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,
@@ -1028,7 +1028,7 @@ static Elf32_Brandinfo linux_glibc2brand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_386,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib/ld-linux.so.2",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,
@@ -1040,7 +1040,7 @@ static Elf32_Brandinfo linux_muslbrand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_386,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib/ld-musl-i386.so.1",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,

Modified: stable/12/sys/arm64/linux/linux_sysvec.c
==============================================================================
--- stable/12/sys/arm64/linux/linux_sysvec.c	Sun Aug 23 20:20:13 2020	(r364528)
+++ stable/12/sys/arm64/linux/linux_sysvec.c	Sun Aug 23 20:25:10 2020	(r364529)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <compat/linux/linux_ioctl.h>
 #include <compat/linux/linux_mib.h>
 #include <compat/linux/linux_misc.h>
+#include <compat/linux/linux_util.h>
 #include <compat/linux/linux_vdso.h>
 
 MODULE_VERSION(linux64elf, 1);
@@ -472,7 +473,7 @@ static Elf64_Brandinfo linux_glibc2brand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_AARCH64,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib64/ld-linux-x86-64.so.2",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,

Modified: stable/12/sys/compat/linux/linux_util.c
==============================================================================
--- stable/12/sys/compat/linux/linux_util.c	Sun Aug 23 20:20:13 2020	(r364528)
+++ stable/12/sys/compat/linux/linux_util.c	Sun Aug 23 20:25:10 2020	(r364529)
@@ -46,11 +46,13 @@ __FBSDID("$FreeBSD$");
 #include <sys/proc.h>
 #include <sys/sdt.h>
 #include <sys/syscallsubr.h>
+#include <sys/sysctl.h>
 #include <sys/systm.h>
 #include <sys/vnode.h>
 
 #include <machine/stdarg.h>
 
+#include <compat/linux/linux_mib.h>
 #include <compat/linux/linux_util.h>
 
 MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures");
@@ -58,7 +60,11 @@ MALLOC_DEFINE(M_EPOLL, "lepoll", "Linux events structu
 MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes");
 MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futex waiting proc");
 
-const char      linux_emul_path[] = "/compat/linux";
+char linux_emul_path[MAXPATHLEN] = "/compat/linux";
+
+SYSCTL_STRING(_compat_linux, OID_AUTO, emul_path, CTLFLAG_RWTUN,
+    linux_emul_path, sizeof(linux_emul_path),
+    "Linux runtime environment path");
 
 /*
  * Search an alternate path before passing pathname arguments on to

Modified: stable/12/sys/compat/linux/linux_util.h
==============================================================================
--- stable/12/sys/compat/linux/linux_util.h	Sun Aug 23 20:20:13 2020	(r364528)
+++ stable/12/sys/compat/linux/linux_util.h	Sun Aug 23 20:25:10 2020	(r364529)
@@ -50,7 +50,7 @@ MALLOC_DECLARE(M_EPOLL);
 MALLOC_DECLARE(M_FUTEX);
 MALLOC_DECLARE(M_FUTEX_WP);
 
-extern const char linux_emul_path[];
+extern char linux_emul_path[];
 
 int linux_emul_convpath(struct thread *, const char *, enum uio_seg, char **, int, int);
 

Modified: stable/12/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/12/sys/i386/linux/linux_sysvec.c	Sun Aug 23 20:20:13 2020	(r364528)
+++ stable/12/sys/i386/linux/linux_sysvec.c	Sun Aug 23 20:25:10 2020	(r364529)
@@ -990,7 +990,7 @@ static Elf32_Brandinfo linux_brand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_386,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib/ld-linux.so.1",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,
@@ -1002,7 +1002,7 @@ static Elf32_Brandinfo linux_glibc2brand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_386,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib/ld-linux.so.2",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,
@@ -1014,7 +1014,7 @@ static Elf32_Brandinfo linux_muslbrand = {
 	.brand		= ELFOSABI_LINUX,
 	.machine	= EM_386,
 	.compat_3_brand	= "Linux",
-	.emul_path	= "/compat/linux",
+	.emul_path	= linux_emul_path,
 	.interp_path	= "/lib/ld-musl-i386.so.1",
 	.sysvec		= &elf_linux_sysvec,
 	.interp_newpath	= NULL,



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