xref: /freebsd/share/man/man4/linux.4 (revision 5a5c2279813012882e59aa7bb51d50c5baba3b1e)
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.Dd May 19, 2024
26.Dt LINUX 4
27.Os
28.Sh NAME
29.Nm linux
30.Nd Linux ABI support
31.Sh SYNOPSIS
32To enable the Linux ABI at boot time, place the following line in
33.Xr rc.conf 5 :
34.Bd -literal -offset indent
35linux_enable="YES"
36.Ed
37.Sh DESCRIPTION
38The
39.Nm
40kernel module provides limited Linux ABI (application binary interface)
41compatibility, making it possible to run many unmodified Linux applications
42without the need for virtualization or emulation.
43Some of the facilities provided are:
44.Bl -bullet
45.It
46Linux to native system call translation
47.It
48Linux-specific system calls
49.It
50Special signal handling for Linux processes
51.It
52Path translation mechanism
53.It
54Linux-specific virtual file systems
55.El
56.Pp
57The path translation mechanism makes Linux processes look up file paths
58under
59.Va emul_path
60(defaulting to
61.Pa /compat/linux )
62before
63.Pa / .
64For example, when a Linux process attempts to open
65.Pa /etc/passwd ,
66it will first access
67.Pa /compat/linux/etc/passwd ,
68falling back to
69.Pa /etc/passwd
70if the compat path 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 ,
78either use the
79.Pa emulators/linux_base-c7
80port or package,
81or
82.Xr debootstrap 8
83installed from
84.Pa sysutils/debootstrap .
85.Pp
86To avoid mounting Linux-specific filesystems at startup, add the following
87line to the
88.Xr rc.conf 5
89file:
90.Pp
91.Dl linux_mounts_enable="NO"
92.Sh SYSCTL VARIABLES
93The following variables are available as both
94.Xr sysctl 8
95variables and
96.Xr loader 8
97tunables:
98.Bl -tag -width indent
99.It Va compat.linux.debug
100Enable debugging messages.
101Set to 0 to silence them.
102Defaults to 3.
103A setting of 1 prints debug messages, tells about unimplemented stuff (only
104once).
105Set to 2 is like 1, but also prints messages about implemented but not tested
106stuff (only once).
107Setting it to 3 or higher is like 2, but no rate limiting of messages.
108.It Va compat.linux.default_openfiles
109Default soft openfiles resource limit for Linux applications.
110Set to -1 to disable the limit.
111Defaults to 1024.
112.It Va compat.linux.emul_path
113Path to the Linux run-time environment.
114Defaults to
115.Pa /compat/linux .
116.It Va compat.linux.osname
117Linux kernel operating system name.
118Defaults to "Linux".
119.It Va compat.linux.osrelease
120Linux kernel operating system release.
121Changing this to something else is discouraged on non-development systems,
122because it may change the way Linux programs work.
123Some versions of GNU libc are known to use different syscalls depending
124on the value of this sysctl.
125.It Va compat.linux.oss_version
126Linux Open Sound System version.
127Defaults to 198144.
128.It Va compat.linux.preserve_vstatus
129When set to 1, it prevents Linux applications from resetting the
130.Xr termios 4
131VSTATUS setting.
132From a user perspective, this makes
133.Va SIGINFO
134work for Linux executables.
135Defaults to 1.
136.It Va compat.linux.setid_allowed
137Enable handling of set-user-ID and set-group-ID mode bits for the new
138process image file when image is to be executed under Linux ABI.
139When set to 0, new Linux images always use credentials of the program
140that issued the
141.Xr execve 2
142call, regardless of the image file mode.
143This might be reasonable or even required, because
144.Fx
145does not emulate the Linux environment completely, and missed features
146may result in security vulnerabilities.
147Defaults to 1.
148.It Va compat.linux32.emulate_i386
149In the x86_64 (amd64) world enable the real i386 Linuxulator behavior.
150For example, when set to 0, Linux uname -m will return "x86_64" even if
151uname itself is a i386 Linux executable. When set to 1, Linux i386
152uname -m will return "i686".
153Defaults to 0.
154.El
155.Sh FILES
156.Bl -tag -width /compat/linux/dev/shm -compact
157.It Pa /compat/linux
158Linux run-time environment
159.It Pa /compat/linux/dev
160device file system, see
161.Xr devfs 4
162.It Pa /compat/linux/dev/fd
163file descriptor file system mounted with the
164.Cm linrdlnk
165option, see
166.Xr fdescfs 4
167.It Pa /compat/linux/dev/mqueue
168symbolic link to a mqueuefs mount, see
169.Xr mqueuefs 4
170.It Pa /compat/linux/dev/shm
171in-memory file system, see
172.Xr tmpfs 4
173.It Pa /compat/linux/proc
174Linux process file system, see
175.Xr linprocfs 4
176.It Pa /compat/linux/sys
177Linux kernel objects file system, see
178.Xr linsysfs 4
179.El
180.Sh SEE ALSO
181.Xr brandelf 1 ,
182.Xr fdescfs 4 ,
183.Xr linprocfs 4 ,
184.Xr linsysfs 4 ,
185.Xr mqueuefs 4 ,
186.Xr pty 4 ,
187.Xr tmpfs 4 ,
188.Xr elf 5
189.Sh HISTORY
190Linux ABI support first appeared for i386 in
191.Fx 2.1 .
192Support for amd64 binaries first appeared in
193.Fx 10.3 .
194Support for arm64 binaries first appeared in
195.Fx 12.0 .
196.Sh BUGS
197Support for some of the Linux-specific system calls and system call arguments
198is missing.
199