1.\" Copyright (c) 2000 Sheldon Hearn 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD$ 26.\" 27.Dd January 2, 2022 28.Dt LINUX 4 29.Os 30.Sh NAME 31.Nm linux 32.Nd Linux ABI support 33.Sh SYNOPSIS 34To enable the Linux ABI at boot time, place the following line in 35.Xr rc.conf 5 : 36.Bd -literal -offset indent 37linux_enable="YES" 38.Ed 39.Sh DESCRIPTION 40The 41.Nm 42module provides limited Linux ABI (application binary interface) compatibility, 43making it possible to run many unmodified Linux applications 44without the need for virtualization or emulation. 45Some of the facilities provided are: 46.Bl -bullet 47.It 48Linux to native system call translation 49.It 50Linux-specific system calls 51.It 52Special signal handling for Linux processes 53.It 54Path translation mechanism 55.It 56Linux-specific virtual file systems 57.El 58.Pp 59The path translation mechanism makes Linux processes look up file paths 60under 61.Va emul_path 62(defaulting to 63.Pa /compat/linux ) 64before 65.Pa / . 66For example, when Linux process attempts to open 67.Pa /etc/passwd , 68it will really access 69.Pa /compat/linux/etc/passwd , 70unless the latter does not exist. 71This is used to make sure Linux processes load Linux shared libraries 72instead of their similarly-named FreeBSD counterparts, and also 73to provide alternative versions of certain other files and virtual 74file systems. 75.Pp 76To install Linux shared libraries and system files into 77.Pa /compat/linux , 78use the 79.Pa emulators/linux_base-c7 80port or the 81.Dv linux_base-c7 82package. 83.Pp 84To avoid mounting Linux-specific filesystems at startup, add the following 85line to the 86.Xr rc.conf 5 87file: 88.Pp 89.Dl linux_mounts_enable="NO" 90.Sh SYSCTL VARIABLES 91The following variables are available as both 92.Xr sysctl 8 93variables and 94.Xr loader 8 95tunables: 96.Bl -tag -width indent 97.It Va compat.linux.debug 98Enable debugging messages. 99Set to 0 to silence them. 100Defaults to 3. 101A setting of 1 prints debug messages, tells about unimplemented stuff (only 102once). 103Set to 2 is like 1, but also prints messages about implemented but not tested 104stuff (only once). 105Setting it to 3 or higher is like 2, but no rate limiting of messages. 106.It Va compat.linux.default_openfiles 107Default soft openfiles resource limit for Linux applications. 108Set to -1 to disable the limit. 109Defaults to 1024. 110.It Va compat.linux.emul_path 111Path to the Linux run-time environment. 112Defaults to 113.Pa /compat/linux . 114.It Va compat.linux.osname 115Linux kernel operating system name. 116Defaults to "Linux". 117.It Va compat.linux.osrelease 118Linux kernel operating system release. 119Changing this to something else is discouraged on non-development systems, 120because it may change the way Linux programs work. 121Some versions of GNU libc are known to use different syscalls depending 122on the value of this sysctl. 123.It Va compat.linux.oss_version 124Linux Open Sound System version. 125Defaults to 198144. 126.It Va compat.linux.preserve_vstatus 127When set to 1, it prevents Linux applications from resetting the 128.Xr termios 4 129VSTATUS setting. 130From a user perspective, this makes 131.Va SIGINFO 132work for Linux executables. 133Defaults to 0. 134.It Va compat.linux.setid_allowed 135Disable handling of set-user-ID and set-group-ID mode bits for the new 136process image file when image is to be executed under Linux ABI. 137When set, new Linux images always use credentials of the program 138that issued the 139.Xr execve 2 140call, regardless of the image file mode. 141Defaults to 1. 142.Pp 143This might be reasonable or even required, because 144.Fx 145does not emulate Linux environment completely, and missed features 146could become holes. 147.El 148.Sh FILES 149.Bl -tag -width /compat/linux/dev/shm -compact 150.It Pa /compat/linux 151Linux run-time environment 152.It Pa /compat/linux/dev 153device file system, see 154.Xr devfs 5 155.It Pa /compat/linux/dev/fd 156file descriptor file system mounted with the 157.Cm linrdlnk 158option, see 159.Xr fdescfs 5 160.It Pa /compat/linux/dev/shm 161in-memory file system, see 162.Xr tmpfs 5 163.It Pa /compat/linux/proc 164Linux process file system, see 165.Xr linprocfs 5 166.It Pa /compat/linux/sys 167Linux kernel objects file system, see 168.Xr linsysfs 5 169.El 170.Sh SEE ALSO 171.Xr brandelf 1 , 172.Xr pty 4 , 173.Xr elf 5 , 174.Xr fdescfs 5 , 175.Xr linprocfs 5 , 176.Xr linsysfs 5 , 177.Xr tmpfs 5 178.Sh HISTORY 179Linux ABI support first appeared in 180.Fx 2.1 . 181Support for amd64 binaries first appeared in 182.Fx 10.3 . 183Support for arm64 binaries first appeared in 184.Fx 12.0 . 185.Sh BUGS 186Support for some of the Linux-specific system calls and system call arguments 187is missing. 188