1e6769554SRui Paulo.\" Copyright (c) 2000 Sheldon Hearn 2e6769554SRui Paulo.\" All rights reserved. 3e6769554SRui Paulo.\" 4e6769554SRui Paulo.\" Redistribution and use in source and binary forms, with or without 5e6769554SRui Paulo.\" modification, are permitted provided that the following conditions 6e6769554SRui Paulo.\" are met: 7e6769554SRui Paulo.\" 1. Redistributions of source code must retain the above copyright 8e6769554SRui Paulo.\" notice, this list of conditions and the following disclaimer. 9e6769554SRui Paulo.\" 2. Redistributions in binary form must reproduce the above copyright 10e6769554SRui Paulo.\" notice, this list of conditions and the following disclaimer in the 11e6769554SRui Paulo.\" documentation and/or other materials provided with the distribution. 12e6769554SRui Paulo.\" 13e6769554SRui Paulo.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14e6769554SRui Paulo.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15e6769554SRui Paulo.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16e6769554SRui Paulo.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17e6769554SRui Paulo.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18e6769554SRui Paulo.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19e6769554SRui Paulo.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20e6769554SRui Paulo.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21e6769554SRui Paulo.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22e6769554SRui Paulo.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23e6769554SRui Paulo.\" SUCH DAMAGE. 24e6769554SRui Paulo.\" 25e6769554SRui Paulo.\" $FreeBSD$ 26e6769554SRui Paulo.\" 27*598f6fb4SKonstantin Belousov.Dd May 6, 2021 28c383d55bSGavin Atkinson.Dt LINUX 4 29e6769554SRui Paulo.Os 30e6769554SRui Paulo.Sh NAME 31e6769554SRui Paulo.Nm linux 32e6769554SRui Paulo.Nd Linux ABI support 33e6769554SRui Paulo.Sh SYNOPSIS 3439eb4bc6SBernhard SchmidtTo compile support for this ABI into an i386 kernel 35e6769554SRui Pauloplace the following line in your 36e6769554SRui Paulokernel configuration file: 37e6769554SRui Paulo.Bd -ragged -offset indent 38e6769554SRui Paulo.Cd "options COMPAT_LINUX" 39e6769554SRui Paulo.Ed 40e6769554SRui Paulo.Pp 4139eb4bc6SBernhard Schmidtfor an amd64 kernel use: 4239eb4bc6SBernhard Schmidt.Bd -ragged -offset indent 4339eb4bc6SBernhard Schmidt.Cd "options COMPAT_LINUX32" 4439eb4bc6SBernhard Schmidt.Ed 4539eb4bc6SBernhard Schmidt.Pp 46e6769554SRui PauloAlternatively, to load the ABI as a 47e6769554SRui Paulomodule at boot time, place the following line in 48e6769554SRui Paulo.Xr loader.conf 5 : 49e6769554SRui Paulo.Bd -literal -offset indent 50e6769554SRui Paulolinux_load="YES" 51e6769554SRui Paulo.Ed 52e6769554SRui Paulo.Sh DESCRIPTION 53e6769554SRui PauloThe 54e6769554SRui Paulo.Nm 55f54d9519SEdward Tomasz Napieralamodule provides limited Linux ABI (application binary interface) compatibility, 56f54d9519SEdward Tomasz Napieralamaking it possible to run many unmodified Linux applications and libraries 57f54d9519SEdward Tomasz Napieralawithout the need for virtualization or emulation. 58f54d9519SEdward Tomasz NapieralaSome of the facilities provided are: 59e6769554SRui Paulo.Bl -bullet 60e6769554SRui Paulo.It 61e6769554SRui PauloAn image activator 62e6769554SRui Paulofor correctly branded 63e6769554SRui Paulo.Xr elf 5 64e6769554SRui Pauloexecutable images 65e6769554SRui Paulo.It 66e6769554SRui PauloSpecial signal handling for activated images 67e6769554SRui Paulo.It 68e6769554SRui PauloLinux to native system call translation 69f54d9519SEdward Tomasz Napierala.It 70f54d9519SEdward Tomasz NapieralaLinux-specific system calls 71e6769554SRui Paulo.El 72e6769554SRui Paulo.Pp 73f54d9519SEdward Tomasz NapieralaNote that dynamically linked Linux executables 74f54d9519SEdward Tomasz Napieralawill require a suitable environment in 75f54d9519SEdward Tomasz Napierala.Pa /compat/linux . 76f54d9519SEdward Tomasz NapieralaThis includes native Linux shared libraries, and Linux-specific virtual 77f54d9519SEdward Tomasz Napieralafilesystems. 78f54d9519SEdward Tomasz NapieralaTo set it up, install the 79f54d9519SEdward Tomasz Napierala.Pa emulators/linux_base-c7 80f54d9519SEdward Tomasz Napieralaport or the linux_base-c7 81f54d9519SEdward Tomasz Napieralapackage, and add the following line to the 82f54d9519SEdward Tomasz Napierala.Xr rc.conf 5 83f54d9519SEdward Tomasz Napieralafile: 84e6769554SRui Paulo.Pp 85f54d9519SEdward Tomasz Napierala.Dl linux_enable="YES" 86f54d9519SEdward Tomasz Napierala.Pp 87f54d9519SEdward Tomasz NapieralaTo avoid mounting Linux-specific filesystems at startup, also add the following 88f54d9519SEdward Tomasz Napieralaline: 89f54d9519SEdward Tomasz Napierala.Pp 90f54d9519SEdward Tomasz Napierala.Dl linux_mounts_enable="NO" 91f54d9519SEdward Tomasz Napierala.Sh SYSCTL VARIABLES 92f54d9519SEdward Tomasz NapieralaThe following variables are available as both 93e6769554SRui Paulo.Xr sysctl 8 94f54d9519SEdward Tomasz Napieralavariables and 95f54d9519SEdward Tomasz Napierala.Xr loader 8 96f54d9519SEdward Tomasz Napieralatunables: 97f54d9519SEdward Tomasz Napierala.Bl -tag -width indent 98462171d9SEdward Tomasz Napierala.It Va compat.linux.debug 99462171d9SEdward Tomasz NapieralaEnable debugging messages. 100462171d9SEdward Tomasz NapieralaSet to 0 to silence them. 1018ec6c4a3SAlexander LeidingerDefaults to 3. 1028ec6c4a3SAlexander LeidingerA setting of 1 prints debug messages, tells about unimplemented stuff (only 1038ec6c4a3SAlexander Leidingeronce). 1048ec6c4a3SAlexander LeidingerSet to 2 is like 1, but also prints messages about implemented but not tested 1058ec6c4a3SAlexander Leidingerstuff (only once). 1068ec6c4a3SAlexander LeidingerSetting it to 3 or higher is like 2, but no rate limiting of messages. 1078c5059e9SEdward Tomasz Napierala.It Va compat.linux.default_openfiles 1088c5059e9SEdward Tomasz NapieralaDefault soft openfiles resource limit for Linux applications. 1098c5059e9SEdward Tomasz NapieralaSet to -1 to disable the limit. 1108c5059e9SEdward Tomasz NapieralaDefaults to 1024. 111b5f20658SEdward Tomasz Napierala.It Va compat.linux.emul_path 112b5f20658SEdward Tomasz NapieralaPath to the Linux run-time environment. 113b5f20658SEdward Tomasz NapieralaDefaults to 114b5f20658SEdward Tomasz Napierala.Pa /compat/linux . 115f54d9519SEdward Tomasz Napierala.It Va compat.linux.osname 116e6769554SRui PauloLinux kernel operating system name. 117f54d9519SEdward Tomasz Napierala.It Va compat.linux.osrelease 118e6769554SRui PauloLinux kernel operating system release. 119e6769554SRui PauloChanging this to something else is discouraged on non-development systems, 120e6769554SRui Paulobecause it may change the way Linux programs work. 121e6769554SRui PauloRecent versions of GNU libc are known to use different syscalls depending 122e6769554SRui Pauloon the value of this sysctl. 123f54d9519SEdward Tomasz Napierala.It Va compat.linux.oss_version 124e6769554SRui PauloLinux Open Sound System version. 1252cf9eb6cSEdward Tomasz Napierala.It Va compat.linux.preserve_vstatus 1262cf9eb6cSEdward Tomasz NapieralaWhen set to 1, it prevents Linux applications from resetting the 1272cf9eb6cSEdward Tomasz Napierala.Xr termios 4 1282cf9eb6cSEdward Tomasz NapieralaVSTATUS setting. 1292cf9eb6cSEdward Tomasz NapieralaFrom a user perspective, this makes 1302cf9eb6cSEdward Tomasz Napierala.Va SIGINFO 1312cf9eb6cSEdward Tomasz Napieralawork for Linux executables. 1322cf9eb6cSEdward Tomasz NapieralaDefaults to 0. 133*598f6fb4SKonstantin Belousov.It Va compat.linux.setid_allowed 134*598f6fb4SKonstantin BelousovDisable handling of set-user-ID and set-group-ID mode bits for the new 135*598f6fb4SKonstantin Belousovprocess image file when image is to be executed under Linux ABI. 136*598f6fb4SKonstantin BelousovWhen set, new Linux images always use credentials of the program 137*598f6fb4SKonstantin Belousovthat issued 138*598f6fb4SKonstantin Belousov.Xr execve 2 139*598f6fb4SKonstantin Belousovcall, regardless of the image file mode. 140*598f6fb4SKonstantin Belousov.Pp 141*598f6fb4SKonstantin BelousovThis might be reasonable or even required, because 142*598f6fb4SKonstantin Belousov.Fx 143*598f6fb4SKonstantin Belousovdoes not emulate Linux environment completely, and missed features 144*598f6fb4SKonstantin Belousovcould become holes. 145d458747eSChristian Brueffer.El 146e6769554SRui Paulo.Sh FILES 147f54d9519SEdward Tomasz Napierala.Bl -tag -width /compat/linux/dev/shm -compact 148e6769554SRui Paulo.It Pa /compat/linux 149e6769554SRui Paulominimal Linux run-time environment 1506bc92736SEdward Tomasz Napierala.It Pa /compat/linux/dev 1516bc92736SEdward Tomasz Napieraladevice file system, see 1526bc92736SEdward Tomasz Napierala.Xr devfs 5 15377d3337cSDmitry Chagin.It Pa /compat/linux/dev/fd 1546ef8f9d2SEdward Tomasz Napieralafile descriptor file system mounted with the 1556ef8f9d2SEdward Tomasz Napierala.Cm linrdlnk 1566ef8f9d2SEdward Tomasz Napieralaoption, see 157f54d9519SEdward Tomasz Napierala.Xr fdescfs 5 158f54d9519SEdward Tomasz Napierala.It Pa /compat/linux/dev/shm 159f54d9519SEdward Tomasz Napieralain-memory file system, see 160f54d9519SEdward Tomasz Napierala.Xr tmpfs 5 161e6769554SRui Paulo.It Pa /compat/linux/proc 162f54d9519SEdward Tomasz NapieralaLinux process file system, see 163f54d9519SEdward Tomasz Napierala.Xr linprocfs 5 164e6769554SRui Paulo.It Pa /compat/linux/sys 165f54d9519SEdward Tomasz NapieralaLinux kernel objects file system, see 166f54d9519SEdward Tomasz Napierala.Xr linsysfs 5 167e6769554SRui Paulo.El 168e6769554SRui Paulo.Sh SEE ALSO 169e6769554SRui Paulo.Xr brandelf 1 , 170fd2ced61SEdward Tomasz Napierala.Xr pty 4 , 171e6769554SRui Paulo.Xr elf 5 , 17277d3337cSDmitry Chagin.Xr fdescfs 5 , 173e6769554SRui Paulo.Xr linprocfs 5 , 174f54d9519SEdward Tomasz Napierala.Xr linsysfs 5 , 175f54d9519SEdward Tomasz Napierala.Xr tmpfs 5 176e6769554SRui Paulo.Sh HISTORY 177e6769554SRui PauloLinux ABI support first appeared in 178e6769554SRui Paulo.Fx 2.1 . 179f54d9519SEdward Tomasz Napierala.Sh BUGS 180f54d9519SEdward Tomasz NapieralaSupport for some of the Linux-specific system calls and system call arguments 181f54d9519SEdward Tomasz Napieralais missing. 182