Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/linux/linux_sysvec.c
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | |||||
static void linux_vdso_install(void *param); | static void linux_vdso_install(void *param); | ||||
static void linux_vdso_deinstall(void *param); | static void linux_vdso_deinstall(void *param); | ||||
static void linux_set_syscall_retval(struct thread *td, int error); | static void linux_set_syscall_retval(struct thread *td, int error); | ||||
static int linux_fetch_syscall_args(struct thread *td); | static int linux_fetch_syscall_args(struct thread *td); | ||||
static void linux_exec_setregs(struct thread *td, struct image_params *imgp, | static void linux_exec_setregs(struct thread *td, struct image_params *imgp, | ||||
u_long stack); | u_long stack); | ||||
static int linux_vsyscall(struct thread *td); | 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 | #define LINUX_T_UNKNOWN 255 | ||||
static int _bsd_to_linux_trapcode[] = { | static int _bsd_to_linux_trapcode[] = { | ||||
LINUX_T_UNKNOWN, /* 0 */ | LINUX_T_UNKNOWN, /* 0 */ | ||||
6, /* 1 T_PRIVINFLT */ | 6, /* 1 T_PRIVINFLT */ | ||||
LINUX_T_UNKNOWN, /* 2 */ | LINUX_T_UNKNOWN, /* 2 */ | ||||
3, /* 3 T_BPTFLT */ | 3, /* 3 T_BPTFLT */ | ||||
LINUX_T_UNKNOWN, /* 4 */ | LINUX_T_UNKNOWN, /* 4 */ | ||||
LINUX_T_UNKNOWN, /* 5 */ | LINUX_T_UNKNOWN, /* 5 */ | ||||
▲ Show 20 Lines • Show All 670 Lines • ▼ Show 20 Lines | linux_trans_osrel(const Elf_Note *note, int32_t *osrel) | ||||
* (version << 16) | (major << 8) | (minor) | * (version << 16) | (major << 8) | (minor) | ||||
* See macro in linux_mib.h | * See macro in linux_mib.h | ||||
*/ | */ | ||||
*osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); | *osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); | ||||
return (true); | 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 = { | static Elf_Brandnote linux64_brandnote = { | ||||
.hdr.n_namesz = sizeof(GNULINUX_ABI_VENDOR), | .hdr.n_namesz = sizeof(GNULINUX_ABI_VENDOR), | ||||
.hdr.n_descsz = 16, | .hdr.n_descsz = 16, | ||||
.hdr.n_type = 1, | .hdr.n_type = 1, | ||||
.vendor = GNULINUX_ABI_VENDOR, | .vendor = GNULINUX_ABI_VENDOR, | ||||
.flags = BN_TRANSLATE_OSREL, | .flags = BN_TRANSLATE_OSREL, | ||||
.trans_osrel = linux_trans_osrel | .trans_osrel = linux_trans_osrel | ||||
}; | }; | ||||
Show All 29 Lines | static Elf64_Brandinfo linux_muslbrand = { | ||||
.emul_path = "/compat/linux", | .emul_path = "/compat/linux", | ||||
.interp_path = "/lib/ld-musl-x86_64.so.1", | .interp_path = "/lib/ld-musl-x86_64.so.1", | ||||
.sysvec = &elf_linux_sysvec, | .sysvec = &elf_linux_sysvec, | ||||
.interp_newpath = NULL, | .interp_newpath = NULL, | ||||
.brand_note = &linux64_brandnote, | .brand_note = &linux64_brandnote, | ||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE | .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[] = { | Elf64_Brandinfo *linux_brandlist[] = { | ||||
&linux_glibc2brand, | &linux_glibc2brand, | ||||
&linux_glibc2brandshort, | &linux_glibc2brandshort, | ||||
&linux_muslbrand, | &linux_muslbrand, | ||||
&linux_nobrand, | |||||
NULL | NULL | ||||
}; | }; | ||||
static int | static int | ||||
linux64_elf_modevent(module_t mod, int type, void *data) | linux64_elf_modevent(module_t mod, int type, void *data) | ||||
{ | { | ||||
Elf64_Brandinfo **brandinfo; | Elf64_Brandinfo **brandinfo; | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |