xref: /freebsd/share/man/man4/linux.4 (revision d5dc757e84d8dc1db987f3a17052e32621d6ea87)
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.\"
27595532a7SEdward Tomasz Napierala.Dd January 9, 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
34bd8077eeSEdward Tomasz NapieralaTo enable the Linux ABI at boot time, place the following line in
35bd8077eeSEdward Tomasz Napierala.Xr rc.conf 5 :
36e6769554SRui Paulo.Bd -literal -offset indent
37bd8077eeSEdward Tomasz Napieralalinux_enable="YES"
38e6769554SRui Paulo.Ed
39e6769554SRui Paulo.Sh DESCRIPTION
40e6769554SRui PauloThe
41e6769554SRui Paulo.Nm
42595532a7SEdward Tomasz Napieralakernel module provides limited Linux ABI (application binary interface)
43595532a7SEdward Tomasz Napieralacompatibility, making 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
51bd8077eeSEdward Tomasz Napierala.It
52bd8077eeSEdward Tomasz NapieralaSpecial signal handling for Linux processes
53bd8077eeSEdward Tomasz Napierala.It
54bd8077eeSEdward Tomasz NapieralaPath translation mechanism
55bd8077eeSEdward Tomasz Napierala.It
56bd8077eeSEdward Tomasz NapieralaLinux-specific virtual file systems
57e6769554SRui Paulo.El
58e6769554SRui Paulo.Pp
59bd8077eeSEdward Tomasz NapieralaThe path translation mechanism makes Linux processes look up file paths
60bd8077eeSEdward Tomasz Napieralaunder
61bd8077eeSEdward Tomasz Napierala.Va emul_path
62bd8077eeSEdward Tomasz Napierala(defaulting to
63bd8077eeSEdward Tomasz Napierala.Pa /compat/linux )
64bd8077eeSEdward Tomasz Napieralabefore
65bd8077eeSEdward Tomasz Napierala.Pa / .
66bd8077eeSEdward Tomasz NapieralaFor example, when Linux process attempts to open
67bd8077eeSEdward Tomasz Napierala.Pa /etc/passwd ,
68bd8077eeSEdward Tomasz Napieralait will really access
69bd8077eeSEdward Tomasz Napierala.Pa /compat/linux/etc/passwd ,
70bd8077eeSEdward Tomasz Napieralaunless the latter does not exist.
71bd8077eeSEdward Tomasz NapieralaThis is used to make sure Linux processes load Linux shared libraries
72bd8077eeSEdward Tomasz Napieralainstead of their similarly-named FreeBSD counterparts, and also
73bd8077eeSEdward Tomasz Napieralato provide alternative versions of certain other files and virtual
74f54d9519SEdward Tomasz Napieralafile systems.
75bd8077eeSEdward Tomasz Napierala.Pp
76bd8077eeSEdward Tomasz NapieralaTo install Linux shared libraries and system files into
77bd8077eeSEdward Tomasz Napierala.Pa /compat/linux ,
78595532a7SEdward Tomasz Napieralaeither use the
79f54d9519SEdward Tomasz Napierala.Pa emulators/linux_base-c7
80595532a7SEdward Tomasz Napieralaport or package,
81595532a7SEdward Tomasz Napieralaor
82595532a7SEdward Tomasz Napierala.Xr debootstrap 8
83595532a7SEdward Tomasz Napieralainstalled from
84595532a7SEdward Tomasz Napierala.Pa sysutils/debootstrap .
85bd8077eeSEdward Tomasz Napierala.Pp
86bd8077eeSEdward Tomasz NapieralaTo avoid mounting Linux-specific filesystems at startup, add the following
87bd8077eeSEdward Tomasz Napieralaline to the
88f54d9519SEdward Tomasz Napierala.Xr rc.conf 5
89f54d9519SEdward Tomasz Napieralafile:
90e6769554SRui Paulo.Pp
91f54d9519SEdward Tomasz Napierala.Dl linux_mounts_enable="NO"
92f54d9519SEdward Tomasz Napierala.Sh SYSCTL VARIABLES
93f54d9519SEdward Tomasz NapieralaThe following variables are available as both
94e6769554SRui Paulo.Xr sysctl 8
95f54d9519SEdward Tomasz Napieralavariables and
96f54d9519SEdward Tomasz Napierala.Xr loader 8
97f54d9519SEdward Tomasz Napieralatunables:
98f54d9519SEdward Tomasz Napierala.Bl -tag -width indent
99462171d9SEdward Tomasz Napierala.It Va compat.linux.debug
100462171d9SEdward Tomasz NapieralaEnable debugging messages.
101462171d9SEdward Tomasz NapieralaSet to 0 to silence them.
1028ec6c4a3SAlexander LeidingerDefaults to 3.
1038ec6c4a3SAlexander LeidingerA setting of 1 prints debug messages, tells about unimplemented stuff (only
1048ec6c4a3SAlexander Leidingeronce).
1058ec6c4a3SAlexander LeidingerSet to 2 is like 1, but also prints messages about implemented but not tested
1068ec6c4a3SAlexander Leidingerstuff (only once).
1078ec6c4a3SAlexander LeidingerSetting it to 3 or higher is like 2, but no rate limiting of messages.
1088c5059e9SEdward Tomasz Napierala.It Va compat.linux.default_openfiles
1098c5059e9SEdward Tomasz NapieralaDefault soft openfiles resource limit for Linux applications.
1108c5059e9SEdward Tomasz NapieralaSet to -1 to disable the limit.
1118c5059e9SEdward Tomasz NapieralaDefaults to 1024.
112b5f20658SEdward Tomasz Napierala.It Va compat.linux.emul_path
113b5f20658SEdward Tomasz NapieralaPath to the Linux run-time environment.
114b5f20658SEdward Tomasz NapieralaDefaults to
115b5f20658SEdward Tomasz Napierala.Pa /compat/linux .
116f54d9519SEdward Tomasz Napierala.It Va compat.linux.osname
117e6769554SRui PauloLinux kernel operating system name.
118bd8077eeSEdward Tomasz NapieralaDefaults to "Linux".
119f54d9519SEdward Tomasz Napierala.It Va compat.linux.osrelease
120e6769554SRui PauloLinux kernel operating system release.
121e6769554SRui PauloChanging this to something else is discouraged on non-development systems,
122e6769554SRui Paulobecause it may change the way Linux programs work.
123bd8077eeSEdward Tomasz NapieralaSome versions of GNU libc are known to use different syscalls depending
124e6769554SRui Pauloon the value of this sysctl.
125f54d9519SEdward Tomasz Napierala.It Va compat.linux.oss_version
126e6769554SRui PauloLinux Open Sound System version.
127bd8077eeSEdward Tomasz NapieralaDefaults to 198144.
1282cf9eb6cSEdward Tomasz Napierala.It Va compat.linux.preserve_vstatus
1292cf9eb6cSEdward Tomasz NapieralaWhen set to 1, it prevents Linux applications from resetting the
1302cf9eb6cSEdward Tomasz Napierala.Xr termios 4
1312cf9eb6cSEdward Tomasz NapieralaVSTATUS setting.
1322cf9eb6cSEdward Tomasz NapieralaFrom a user perspective, this makes
1332cf9eb6cSEdward Tomasz Napierala.Va SIGINFO
1342cf9eb6cSEdward Tomasz Napieralawork for Linux executables.
135b896bdb8SEdward Tomasz NapieralaDefaults to 1.
136598f6fb4SKonstantin Belousov.It Va compat.linux.setid_allowed
137595532a7SEdward Tomasz NapieralaEnable handling of set-user-ID and set-group-ID mode bits for the new
138598f6fb4SKonstantin Belousovprocess image file when image is to be executed under Linux ABI.
139595532a7SEdward Tomasz NapieralaWhen set to 0, new Linux images always use credentials of the program
140bd8077eeSEdward Tomasz Napieralathat issued the
141598f6fb4SKonstantin Belousov.Xr execve 2
142598f6fb4SKonstantin Belousovcall, regardless of the image file mode.
143598f6fb4SKonstantin BelousovThis might be reasonable or even required, because
144598f6fb4SKonstantin Belousov.Fx
145595532a7SEdward Tomasz Napieraladoes not emulate the Linux environment completely, and missed features
146595532a7SEdward Tomasz Napieralamay result in security vulnerabilities.
147595532a7SEdward Tomasz NapieralaDefaults to 1.
148*d5dc757eSDmitry Chagin.It Va compat.linux32.emulate_i386
149*d5dc757eSDmitry ChaginIn the x86_64 (amd64) world enable the real i386 Linuxulator behavior.
150*d5dc757eSDmitry ChaginFor example, when set to 0, Linux uname -m will return "x86_64" even if
151*d5dc757eSDmitry Chaginuname itself is a i386 Linux executable. When set to 1, Linux i386
152*d5dc757eSDmitry Chaginuname -m will return "i686".
153*d5dc757eSDmitry ChaginDefaults to 0.
154d458747eSChristian Brueffer.El
155e6769554SRui Paulo.Sh FILES
156f54d9519SEdward Tomasz Napierala.Bl -tag -width /compat/linux/dev/shm -compact
157e6769554SRui Paulo.It Pa /compat/linux
158bd8077eeSEdward Tomasz NapieralaLinux run-time environment
1596bc92736SEdward Tomasz Napierala.It Pa /compat/linux/dev
1606bc92736SEdward Tomasz Napieraladevice file system, see
1616bc92736SEdward Tomasz Napierala.Xr devfs 5
16277d3337cSDmitry Chagin.It Pa /compat/linux/dev/fd
1636ef8f9d2SEdward Tomasz Napieralafile descriptor file system mounted with the
1646ef8f9d2SEdward Tomasz Napierala.Cm linrdlnk
1656ef8f9d2SEdward Tomasz Napieralaoption, see
166f54d9519SEdward Tomasz Napierala.Xr fdescfs 5
167f54d9519SEdward Tomasz Napierala.It Pa /compat/linux/dev/shm
168f54d9519SEdward Tomasz Napieralain-memory file system, see
169f54d9519SEdward Tomasz Napierala.Xr tmpfs 5
170e6769554SRui Paulo.It Pa /compat/linux/proc
171f54d9519SEdward Tomasz NapieralaLinux process file system, see
172f54d9519SEdward Tomasz Napierala.Xr linprocfs 5
173e6769554SRui Paulo.It Pa /compat/linux/sys
174f54d9519SEdward Tomasz NapieralaLinux kernel objects file system, see
175f54d9519SEdward Tomasz Napierala.Xr linsysfs 5
176e6769554SRui Paulo.El
177e6769554SRui Paulo.Sh SEE ALSO
178e6769554SRui Paulo.Xr brandelf 1 ,
179fd2ced61SEdward Tomasz Napierala.Xr pty 4 ,
180e6769554SRui Paulo.Xr elf 5 ,
18177d3337cSDmitry Chagin.Xr fdescfs 5 ,
182e6769554SRui Paulo.Xr linprocfs 5 ,
183f54d9519SEdward Tomasz Napierala.Xr linsysfs 5 ,
184f54d9519SEdward Tomasz Napierala.Xr tmpfs 5
185e6769554SRui Paulo.Sh HISTORY
186595532a7SEdward Tomasz NapieralaLinux ABI support first appeared for i386 in
187e6769554SRui Paulo.Fx 2.1 .
188bd8077eeSEdward Tomasz NapieralaSupport for amd64 binaries first appeared in
189bd8077eeSEdward Tomasz Napierala.Fx 10.3 .
190bd8077eeSEdward Tomasz NapieralaSupport for arm64 binaries first appeared in
191bd8077eeSEdward Tomasz Napierala.Fx 12.0 .
192f54d9519SEdward Tomasz Napierala.Sh BUGS
193f54d9519SEdward Tomasz NapieralaSupport for some of the Linux-specific system calls and system call arguments
194f54d9519SEdward Tomasz Napieralais missing.
195