xref: /freebsd/share/man/man4/linux.4 (revision 9a9677ec1cbf46a86a032d18e790aa0fedc82e28)
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.\"
25*9a9677ecSRicardo Branco.Dd May 19, 2024
26c383d55bSGavin Atkinson.Dt LINUX 4
27e6769554SRui Paulo.Os
28e6769554SRui Paulo.Sh NAME
29e6769554SRui Paulo.Nm linux
30e6769554SRui Paulo.Nd Linux ABI support
31e6769554SRui Paulo.Sh SYNOPSIS
32bd8077eeSEdward Tomasz NapieralaTo enable the Linux ABI at boot time, place the following line in
33bd8077eeSEdward Tomasz Napierala.Xr rc.conf 5 :
34e6769554SRui Paulo.Bd -literal -offset indent
35bd8077eeSEdward Tomasz Napieralalinux_enable="YES"
36e6769554SRui Paulo.Ed
37e6769554SRui Paulo.Sh DESCRIPTION
38e6769554SRui PauloThe
39e6769554SRui Paulo.Nm
40595532a7SEdward Tomasz Napieralakernel module provides limited Linux ABI (application binary interface)
41595532a7SEdward Tomasz Napieralacompatibility, making it possible to run many unmodified Linux applications
42f54d9519SEdward Tomasz Napieralawithout the need for virtualization or emulation.
43f54d9519SEdward Tomasz NapieralaSome of the facilities provided are:
44e6769554SRui Paulo.Bl -bullet
45e6769554SRui Paulo.It
46e6769554SRui PauloLinux to native system call translation
47f54d9519SEdward Tomasz Napierala.It
48f54d9519SEdward Tomasz NapieralaLinux-specific system calls
49bd8077eeSEdward Tomasz Napierala.It
50bd8077eeSEdward Tomasz NapieralaSpecial signal handling for Linux processes
51bd8077eeSEdward Tomasz Napierala.It
52bd8077eeSEdward Tomasz NapieralaPath translation mechanism
53bd8077eeSEdward Tomasz Napierala.It
54bd8077eeSEdward Tomasz NapieralaLinux-specific virtual file systems
55e6769554SRui Paulo.El
56e6769554SRui Paulo.Pp
57bd8077eeSEdward Tomasz NapieralaThe path translation mechanism makes Linux processes look up file paths
58bd8077eeSEdward Tomasz Napieralaunder
59bd8077eeSEdward Tomasz Napierala.Va emul_path
60bd8077eeSEdward Tomasz Napierala(defaulting to
61bd8077eeSEdward Tomasz Napierala.Pa /compat/linux )
62bd8077eeSEdward Tomasz Napieralabefore
63bd8077eeSEdward Tomasz Napierala.Pa / .
64bd8077eeSEdward Tomasz NapieralaFor example, when Linux process attempts to open
65bd8077eeSEdward Tomasz Napierala.Pa /etc/passwd ,
66bd8077eeSEdward Tomasz Napieralait will really access
67bd8077eeSEdward Tomasz Napierala.Pa /compat/linux/etc/passwd ,
68bd8077eeSEdward Tomasz Napieralaunless the latter does not exist.
69bd8077eeSEdward Tomasz NapieralaThis is used to make sure Linux processes load Linux shared libraries
70bd8077eeSEdward Tomasz Napieralainstead of their similarly-named FreeBSD counterparts, and also
71bd8077eeSEdward Tomasz Napieralato provide alternative versions of certain other files and virtual
72f54d9519SEdward Tomasz Napieralafile systems.
73bd8077eeSEdward Tomasz Napierala.Pp
74bd8077eeSEdward Tomasz NapieralaTo install Linux shared libraries and system files into
75bd8077eeSEdward Tomasz Napierala.Pa /compat/linux ,
76595532a7SEdward Tomasz Napieralaeither use the
77f54d9519SEdward Tomasz Napierala.Pa emulators/linux_base-c7
78595532a7SEdward Tomasz Napieralaport or package,
79595532a7SEdward Tomasz Napieralaor
80595532a7SEdward Tomasz Napierala.Xr debootstrap 8
81595532a7SEdward Tomasz Napieralainstalled from
82595532a7SEdward Tomasz Napierala.Pa sysutils/debootstrap .
83bd8077eeSEdward Tomasz Napierala.Pp
84bd8077eeSEdward Tomasz NapieralaTo avoid mounting Linux-specific filesystems at startup, add the following
85bd8077eeSEdward 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.
116bd8077eeSEdward 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.
121bd8077eeSEdward 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.
125bd8077eeSEdward 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.
133b896bdb8SEdward Tomasz NapieralaDefaults to 1.
134598f6fb4SKonstantin Belousov.It Va compat.linux.setid_allowed
135595532a7SEdward Tomasz NapieralaEnable 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.
137595532a7SEdward Tomasz NapieralaWhen set to 0, new Linux images always use credentials of the program
138bd8077eeSEdward Tomasz Napieralathat issued the
139598f6fb4SKonstantin Belousov.Xr execve 2
140598f6fb4SKonstantin Belousovcall, regardless of the image file mode.
141598f6fb4SKonstantin BelousovThis might be reasonable or even required, because
142598f6fb4SKonstantin Belousov.Fx
143595532a7SEdward Tomasz Napieraladoes not emulate the Linux environment completely, and missed features
144595532a7SEdward Tomasz Napieralamay result in security vulnerabilities.
145595532a7SEdward Tomasz NapieralaDefaults to 1.
146d5dc757eSDmitry Chagin.It Va compat.linux32.emulate_i386
147d5dc757eSDmitry ChaginIn the x86_64 (amd64) world enable the real i386 Linuxulator behavior.
148d5dc757eSDmitry ChaginFor example, when set to 0, Linux uname -m will return "x86_64" even if
149d5dc757eSDmitry Chaginuname itself is a i386 Linux executable. When set to 1, Linux i386
150d5dc757eSDmitry Chaginuname -m will return "i686".
151d5dc757eSDmitry ChaginDefaults to 0.
152d458747eSChristian Brueffer.El
153e6769554SRui Paulo.Sh FILES
154f54d9519SEdward Tomasz Napierala.Bl -tag -width /compat/linux/dev/shm -compact
155e6769554SRui Paulo.It Pa /compat/linux
156bd8077eeSEdward Tomasz NapieralaLinux run-time environment
1576bc92736SEdward Tomasz Napierala.It Pa /compat/linux/dev
1586bc92736SEdward Tomasz Napieraladevice file system, see
1591a720cbeSAlexander Ziaee.Xr devfs 4
16077d3337cSDmitry Chagin.It Pa /compat/linux/dev/fd
1616ef8f9d2SEdward Tomasz Napieralafile descriptor file system mounted with the
1626ef8f9d2SEdward Tomasz Napierala.Cm linrdlnk
1636ef8f9d2SEdward Tomasz Napieralaoption, see
1641a720cbeSAlexander Ziaee.Xr fdescfs 4
165*9a9677ecSRicardo Branco.It Pa /compat/linux/dev/mqueue
166*9a9677ecSRicardo Brancosymbolic link to a mqueuefs mount, see
167*9a9677ecSRicardo Branco.Xr mqueuefs 4
168f54d9519SEdward Tomasz Napierala.It Pa /compat/linux/dev/shm
169f54d9519SEdward Tomasz Napieralain-memory file system, see
1701a720cbeSAlexander Ziaee.Xr tmpfs 4
171e6769554SRui Paulo.It Pa /compat/linux/proc
172f54d9519SEdward Tomasz NapieralaLinux process file system, see
1731a720cbeSAlexander Ziaee.Xr linprocfs 4
174e6769554SRui Paulo.It Pa /compat/linux/sys
175f54d9519SEdward Tomasz NapieralaLinux kernel objects file system, see
1761a720cbeSAlexander Ziaee.Xr linsysfs 4
177e6769554SRui Paulo.El
178e6769554SRui Paulo.Sh SEE ALSO
179e6769554SRui Paulo.Xr brandelf 1 ,
1801a720cbeSAlexander Ziaee.Xr fdescfs 4 ,
1811a720cbeSAlexander Ziaee.Xr linprocfs 4 ,
1821a720cbeSAlexander Ziaee.Xr linsysfs 4 ,
183*9a9677ecSRicardo Branco.Xr mqueuefs 4 ,
184fd2ced61SEdward Tomasz Napierala.Xr pty 4 ,
1851a720cbeSAlexander Ziaee.Xr tmpfs 4 ,
1861a720cbeSAlexander Ziaee.Xr elf 5
187e6769554SRui Paulo.Sh HISTORY
188595532a7SEdward Tomasz NapieralaLinux ABI support first appeared for i386 in
189e6769554SRui Paulo.Fx 2.1 .
190bd8077eeSEdward Tomasz NapieralaSupport for amd64 binaries first appeared in
191bd8077eeSEdward Tomasz Napierala.Fx 10.3 .
192bd8077eeSEdward Tomasz NapieralaSupport for arm64 binaries first appeared in
193bd8077eeSEdward Tomasz Napierala.Fx 12.0 .
194f54d9519SEdward Tomasz Napierala.Sh BUGS
195f54d9519SEdward Tomasz NapieralaSupport for some of the Linux-specific system calls and system call arguments
196f54d9519SEdward Tomasz Napieralais missing.
197