xref: /freebsd/share/man/man4/linux.4 (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
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 Linux process attempts to open
65.Pa /etc/passwd ,
66it will really access
67.Pa /compat/linux/etc/passwd ,
68unless the latter does not exist.
69This is used to make sure Linux processes load Linux shared libraries
70instead of their similarly-named FreeBSD counterparts, and also
71to provide alternative versions of certain other files and virtual
72file systems.
73.Pp
74To install Linux shared libraries and system files into
75.Pa /compat/linux ,
76either use the
77.Pa emulators/linux_base-c7
78port or package,
79or
80.Xr debootstrap 8
81installed from
82.Pa sysutils/debootstrap .
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 1.
134.It Va compat.linux.setid_allowed
135Enable 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 to 0, new Linux images always use credentials of the program
138that issued the
139.Xr execve 2
140call, regardless of the image file mode.
141This might be reasonable or even required, because
142.Fx
143does not emulate the Linux environment completely, and missed features
144may result in security vulnerabilities.
145Defaults to 1.
146.It Va compat.linux32.emulate_i386
147In the x86_64 (amd64) world enable the real i386 Linuxulator behavior.
148For example, when set to 0, Linux uname -m will return "x86_64" even if
149uname itself is a i386 Linux executable. When set to 1, Linux i386
150uname -m will return "i686".
151Defaults to 0.
152.El
153.Sh FILES
154.Bl -tag -width /compat/linux/dev/shm -compact
155.It Pa /compat/linux
156Linux run-time environment
157.It Pa /compat/linux/dev
158device file system, see
159.Xr devfs 4
160.It Pa /compat/linux/dev/fd
161file descriptor file system mounted with the
162.Cm linrdlnk
163option, see
164.Xr fdescfs 4
165.It Pa /compat/linux/dev/mqueue
166symbolic link to a mqueuefs mount, see
167.Xr mqueuefs 4
168.It Pa /compat/linux/dev/shm
169in-memory file system, see
170.Xr tmpfs 4
171.It Pa /compat/linux/proc
172Linux process file system, see
173.Xr linprocfs 4
174.It Pa /compat/linux/sys
175Linux kernel objects file system, see
176.Xr linsysfs 4
177.El
178.Sh SEE ALSO
179.Xr brandelf 1 ,
180.Xr fdescfs 4 ,
181.Xr linprocfs 4 ,
182.Xr linsysfs 4 ,
183.Xr mqueuefs 4 ,
184.Xr pty 4 ,
185.Xr tmpfs 4 ,
186.Xr elf 5
187.Sh HISTORY
188Linux ABI support first appeared for i386 in
189.Fx 2.1 .
190Support for amd64 binaries first appeared in
191.Fx 10.3 .
192Support for arm64 binaries first appeared in
193.Fx 12.0 .
194.Sh BUGS
195Support for some of the Linux-specific system calls and system call arguments
196is missing.
197