Page MenuHomeFreeBSD

D20720.id61837.diff
No OneTemporary

D20720.id61837.diff

Index: share/man/man4/linux.4
===================================================================
--- share/man/man4/linux.4
+++ share/man/man4/linux.4
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 1, 2017
+.Dd September 9, 2019
.Dt LINUX 4
.Os
.Sh NAME
@@ -75,7 +75,11 @@
The following
.Xr sysctl 8
tunable variables are available:
-.Bl -tag -width compat.linux.oss_version
+.Bl -tag -width compat.linux.exec_unbranded
+.It compat.linux.exec_unbranded
+If set to 1, execute binaries which lack proper ELF brand
+and cannot otherwise be recognized as Linux binaries.
+Defaults to 0.
.It compat.linux.osname
Linux kernel operating system name.
.It compat.linux.osrelease
Index: sys/amd64/linux/linux_sysvec.c
===================================================================
--- sys/amd64/linux/linux_sysvec.c
+++ sys/amd64/linux/linux_sysvec.c
@@ -109,6 +109,10 @@
u_long stack);
static int linux_vsyscall(struct thread *td);
+static int linux_exec_unbranded = 0;
+SYSCTL_INT(_compat_linux, OID_AUTO, exec_unbranded, CTLFLAG_RWTUN,
+ &linux_exec_unbranded, 0, "Execute binaries which lack proper brand");
+
#define LINUX_T_UNKNOWN 255
static int _bsd_to_linux_trapcode[] = {
LINUX_T_UNKNOWN, /* 0 */
@@ -795,6 +799,16 @@
return (true);
}
+static boolean_t
+linux_nobrand_supported(struct image_params *imgp)
+{
+
+ if (linux_exec_unbranded)
+ return (TRUE);
+
+ return (FALSE);
+}
+
static Elf_Brandnote linux64_brandnote = {
.hdr.n_namesz = sizeof(GNULINUX_ABI_VENDOR),
.hdr.n_descsz = 16,
@@ -840,10 +854,24 @@
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
};
+static Elf64_Brandinfo linux_nobrand = {
+ .brand = ELFOSABI_NONE,
+ .machine = EM_X86_64,
+ .compat_3_brand = NULL,
+ .emul_path = "/compat/linux",
+ .interp_path = NULL,
+ .sysvec = &elf_linux_sysvec,
+ .interp_newpath = NULL,
+ .brand_note = NULL,
+ .flags = BI_CAN_EXEC_DYN,
+ .header_supported= linux_nobrand_supported
+};
+
Elf64_Brandinfo *linux_brandlist[] = {
&linux_glibc2brand,
&linux_glibc2brandshort,
&linux_muslbrand,
+ &linux_nobrand,
NULL
};

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 23, 2:31 PM (14 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24093364
Default Alt Text
D20720.id61837.diff (2 KB)

Event Timeline