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*bd8077eeSEdward Tomasz Napierala.Dd January 2, 2022 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 34*bd8077eeSEdward Tomasz NapieralaTo enable the Linux ABI at boot time, place the following line in 35*bd8077eeSEdward Tomasz Napierala.Xr rc.conf 5 : 36e6769554SRui Paulo.Bd -literal -offset indent 37*bd8077eeSEdward Tomasz Napieralalinux_enable="YES" 38e6769554SRui Paulo.Ed 39e6769554SRui Paulo.Sh DESCRIPTION 40e6769554SRui PauloThe 41e6769554SRui Paulo.Nm 42f54d9519SEdward Tomasz Napieralamodule provides limited Linux ABI (application binary interface) compatibility, 43*bd8077eeSEdward Tomasz Napieralamaking it possible to run many unmodified Linux applications 44f54d9519SEdward Tomasz Napieralawithout the need for virtualization or emulation. 45f54d9519SEdward Tomasz NapieralaSome of the facilities provided are: 46e6769554SRui Paulo.Bl -bullet 47e6769554SRui Paulo.It 48e6769554SRui PauloLinux to native system call translation 49f54d9519SEdward Tomasz Napierala.It 50f54d9519SEdward Tomasz NapieralaLinux-specific system calls 51*bd8077eeSEdward Tomasz Napierala.It 52*bd8077eeSEdward Tomasz NapieralaSpecial signal handling for Linux processes 53*bd8077eeSEdward Tomasz Napierala.It 54*bd8077eeSEdward Tomasz NapieralaPath translation mechanism 55*bd8077eeSEdward Tomasz Napierala.It 56*bd8077eeSEdward Tomasz NapieralaLinux-specific virtual file systems 57e6769554SRui Paulo.El 58e6769554SRui Paulo.Pp 59*bd8077eeSEdward Tomasz NapieralaThe path translation mechanism makes Linux processes look up file paths 60*bd8077eeSEdward Tomasz Napieralaunder 61*bd8077eeSEdward Tomasz Napierala.Va emul_path 62*bd8077eeSEdward Tomasz Napierala(defaulting to 63*bd8077eeSEdward Tomasz Napierala.Pa /compat/linux ) 64*bd8077eeSEdward Tomasz Napieralabefore 65*bd8077eeSEdward Tomasz Napierala.Pa / . 66*bd8077eeSEdward Tomasz NapieralaFor example, when Linux process attempts to open 67*bd8077eeSEdward Tomasz Napierala.Pa /etc/passwd , 68*bd8077eeSEdward Tomasz Napieralait will really access 69*bd8077eeSEdward Tomasz Napierala.Pa /compat/linux/etc/passwd , 70*bd8077eeSEdward Tomasz Napieralaunless the latter does not exist. 71*bd8077eeSEdward Tomasz NapieralaThis is used to make sure Linux processes load Linux shared libraries 72*bd8077eeSEdward Tomasz Napieralainstead of their similarly-named FreeBSD counterparts, and also 73*bd8077eeSEdward Tomasz Napieralato provide alternative versions of certain other files and virtual 74f54d9519SEdward Tomasz Napieralafile systems. 75*bd8077eeSEdward Tomasz Napierala.Pp 76*bd8077eeSEdward Tomasz NapieralaTo install Linux shared libraries and system files into 77*bd8077eeSEdward Tomasz Napierala.Pa /compat/linux , 78*bd8077eeSEdward Tomasz Napieralause the 79f54d9519SEdward Tomasz Napierala.Pa emulators/linux_base-c7 80*bd8077eeSEdward Tomasz Napieralaport or the 81*bd8077eeSEdward Tomasz Napierala.Dv linux_base-c7 82*bd8077eeSEdward Tomasz Napieralapackage. 83*bd8077eeSEdward Tomasz Napierala.Pp 84*bd8077eeSEdward Tomasz NapieralaTo avoid mounting Linux-specific filesystems at startup, add the following 85*bd8077eeSEdward Tomasz Napieralaline to the 86f54d9519SEdward Tomasz Napierala.Xr rc.conf 5 87f54d9519SEdward Tomasz Napieralafile: 88e6769554SRui Paulo.Pp 89f54d9519SEdward Tomasz Napierala.Dl linux_mounts_enable="NO" 90f54d9519SEdward Tomasz Napierala.Sh SYSCTL VARIABLES 91f54d9519SEdward Tomasz NapieralaThe following variables are available as both 92e6769554SRui Paulo.Xr sysctl 8 93f54d9519SEdward Tomasz Napieralavariables and 94f54d9519SEdward Tomasz Napierala.Xr loader 8 95f54d9519SEdward Tomasz Napieralatunables: 96f54d9519SEdward Tomasz Napierala.Bl -tag -width indent 97462171d9SEdward Tomasz Napierala.It Va compat.linux.debug 98462171d9SEdward Tomasz NapieralaEnable debugging messages. 99462171d9SEdward Tomasz NapieralaSet to 0 to silence them. 1008ec6c4a3SAlexander LeidingerDefaults to 3. 1018ec6c4a3SAlexander LeidingerA setting of 1 prints debug messages, tells about unimplemented stuff (only 1028ec6c4a3SAlexander Leidingeronce). 1038ec6c4a3SAlexander LeidingerSet to 2 is like 1, but also prints messages about implemented but not tested 1048ec6c4a3SAlexander Leidingerstuff (only once). 1058ec6c4a3SAlexander LeidingerSetting it to 3 or higher is like 2, but no rate limiting of messages. 1068c5059e9SEdward Tomasz Napierala.It Va compat.linux.default_openfiles 1078c5059e9SEdward Tomasz NapieralaDefault soft openfiles resource limit for Linux applications. 1088c5059e9SEdward Tomasz NapieralaSet to -1 to disable the limit. 1098c5059e9SEdward Tomasz NapieralaDefaults to 1024. 110b5f20658SEdward Tomasz Napierala.It Va compat.linux.emul_path 111b5f20658SEdward Tomasz NapieralaPath to the Linux run-time environment. 112b5f20658SEdward Tomasz NapieralaDefaults to 113b5f20658SEdward Tomasz Napierala.Pa /compat/linux . 114f54d9519SEdward Tomasz Napierala.It Va compat.linux.osname 115e6769554SRui PauloLinux kernel operating system name. 116*bd8077eeSEdward Tomasz NapieralaDefaults to "Linux". 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. 121*bd8077eeSEdward Tomasz NapieralaSome 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. 125*bd8077eeSEdward Tomasz NapieralaDefaults to 198144. 1262cf9eb6cSEdward Tomasz Napierala.It Va compat.linux.preserve_vstatus 1272cf9eb6cSEdward Tomasz NapieralaWhen set to 1, it prevents Linux applications from resetting the 1282cf9eb6cSEdward Tomasz Napierala.Xr termios 4 1292cf9eb6cSEdward Tomasz NapieralaVSTATUS setting. 1302cf9eb6cSEdward Tomasz NapieralaFrom a user perspective, this makes 1312cf9eb6cSEdward Tomasz Napierala.Va SIGINFO 1322cf9eb6cSEdward Tomasz Napieralawork for Linux executables. 1332cf9eb6cSEdward Tomasz NapieralaDefaults to 0. 134598f6fb4SKonstantin Belousov.It Va compat.linux.setid_allowed 135598f6fb4SKonstantin BelousovDisable handling of set-user-ID and set-group-ID mode bits for the new 136598f6fb4SKonstantin Belousovprocess image file when image is to be executed under Linux ABI. 137598f6fb4SKonstantin BelousovWhen set, new Linux images always use credentials of the program 138*bd8077eeSEdward Tomasz Napieralathat issued the 139598f6fb4SKonstantin Belousov.Xr execve 2 140598f6fb4SKonstantin Belousovcall, regardless of the image file mode. 141*bd8077eeSEdward Tomasz NapieralaDefaults to 1. 142598f6fb4SKonstantin Belousov.Pp 143598f6fb4SKonstantin BelousovThis might be reasonable or even required, because 144598f6fb4SKonstantin Belousov.Fx 145598f6fb4SKonstantin Belousovdoes not emulate Linux environment completely, and missed features 146598f6fb4SKonstantin Belousovcould become holes. 147d458747eSChristian Brueffer.El 148e6769554SRui Paulo.Sh FILES 149f54d9519SEdward Tomasz Napierala.Bl -tag -width /compat/linux/dev/shm -compact 150e6769554SRui Paulo.It Pa /compat/linux 151*bd8077eeSEdward Tomasz NapieralaLinux run-time environment 1526bc92736SEdward Tomasz Napierala.It Pa /compat/linux/dev 1536bc92736SEdward Tomasz Napieraladevice file system, see 1546bc92736SEdward Tomasz Napierala.Xr devfs 5 15577d3337cSDmitry Chagin.It Pa /compat/linux/dev/fd 1566ef8f9d2SEdward Tomasz Napieralafile descriptor file system mounted with the 1576ef8f9d2SEdward Tomasz Napierala.Cm linrdlnk 1586ef8f9d2SEdward Tomasz Napieralaoption, see 159f54d9519SEdward Tomasz Napierala.Xr fdescfs 5 160f54d9519SEdward Tomasz Napierala.It Pa /compat/linux/dev/shm 161f54d9519SEdward Tomasz Napieralain-memory file system, see 162f54d9519SEdward Tomasz Napierala.Xr tmpfs 5 163e6769554SRui Paulo.It Pa /compat/linux/proc 164f54d9519SEdward Tomasz NapieralaLinux process file system, see 165f54d9519SEdward Tomasz Napierala.Xr linprocfs 5 166e6769554SRui Paulo.It Pa /compat/linux/sys 167f54d9519SEdward Tomasz NapieralaLinux kernel objects file system, see 168f54d9519SEdward Tomasz Napierala.Xr linsysfs 5 169e6769554SRui Paulo.El 170e6769554SRui Paulo.Sh SEE ALSO 171e6769554SRui Paulo.Xr brandelf 1 , 172fd2ced61SEdward Tomasz Napierala.Xr pty 4 , 173e6769554SRui Paulo.Xr elf 5 , 17477d3337cSDmitry Chagin.Xr fdescfs 5 , 175e6769554SRui Paulo.Xr linprocfs 5 , 176f54d9519SEdward Tomasz Napierala.Xr linsysfs 5 , 177f54d9519SEdward Tomasz Napierala.Xr tmpfs 5 178e6769554SRui Paulo.Sh HISTORY 179e6769554SRui PauloLinux ABI support first appeared in 180e6769554SRui Paulo.Fx 2.1 . 181*bd8077eeSEdward Tomasz NapieralaSupport for amd64 binaries first appeared in 182*bd8077eeSEdward Tomasz Napierala.Fx 10.3 . 183*bd8077eeSEdward Tomasz NapieralaSupport for arm64 binaries first appeared in 184*bd8077eeSEdward Tomasz Napierala.Fx 12.0 . 185f54d9519SEdward Tomasz Napierala.Sh BUGS 186f54d9519SEdward Tomasz NapieralaSupport for some of the Linux-specific system calls and system call arguments 187f54d9519SEdward Tomasz Napieralais missing. 188