xref: /freebsd/share/man/man4/aout.4 (revision ecb84463033bcaadd90c1860e7aa90a0613a3cf7)
1b80225cdSKonstantin Belousov.\" Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
2b80225cdSKonstantin Belousov.\"
3b80225cdSKonstantin Belousov.\" Redistribution and use in source and binary forms, with or without
4b80225cdSKonstantin Belousov.\" modification, are permitted provided that the following conditions
5b80225cdSKonstantin Belousov.\" are met:
6b80225cdSKonstantin Belousov.\" 1. Redistributions of source code must retain the above copyright
7b80225cdSKonstantin Belousov.\"    notice, this list of conditions and the following disclaimer.
8b80225cdSKonstantin Belousov.\" 2. Redistributions in binary form must reproduce the above copyright
9b80225cdSKonstantin Belousov.\"    notice, this list of conditions and the following disclaimer in the
10b80225cdSKonstantin Belousov.\"    documentation and/or other materials provided with the distribution.
11b80225cdSKonstantin Belousov.\"
12b80225cdSKonstantin Belousov.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13b80225cdSKonstantin Belousov.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14b80225cdSKonstantin Belousov.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15b80225cdSKonstantin Belousov.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16b80225cdSKonstantin Belousov.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17b80225cdSKonstantin Belousov.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18b80225cdSKonstantin Belousov.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19b80225cdSKonstantin Belousov.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20b80225cdSKonstantin Belousov.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21b80225cdSKonstantin Belousov.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22b80225cdSKonstantin Belousov.\"
23b80225cdSKonstantin Belousov.\" $FreeBSD$
24b80225cdSKonstantin Belousov.\"
25b80225cdSKonstantin Belousov.Dd August 14, 2012
26b80225cdSKonstantin Belousov.Dt AOUT 4
27b80225cdSKonstantin Belousov.Os
28b80225cdSKonstantin Belousov.Sh NAME
29b80225cdSKonstantin Belousov.Nm aout
30b80225cdSKonstantin Belousov.Nd kernel support for executing binary files in legacy a.out format
31b80225cdSKonstantin Belousov.Sh SYNOPSIS
32b80225cdSKonstantin Belousov.Bd -literal -offset indent
33b80225cdSKonstantin Belousovkldload a.out
34b80225cdSKonstantin Belousov.Ed
35b80225cdSKonstantin Belousov.Sh DESCRIPTION
36b80225cdSKonstantin BelousovThe
37b80225cdSKonstantin Belousov.Xr a.out 5
38*ecb84463SJoel Dahlexecutable format was used before the release of
39*ecb84463SJoel Dahl.Fx 3.0.
40*ecb84463SJoel DahlSince i386 was the only supported architecture at that time,
41b80225cdSKonstantin Belousov.Xr a.out 5
42*ecb84463SJoel Dahlexecutables can only be activated on platforms that support
43*ecb84463SJoel Dahlexecution of i386 code, such as i386, amd64 and (partially) ia64.
44b80225cdSKonstantin Belousov.Pp
45b80225cdSKonstantin BelousovTo add kernel support for old syscalls and old syscall invocation methods,
46*ecb84463SJoel Dahlplace the following options in the kernel configuration file:
47b80225cdSKonstantin Belousov.Bd -ragged -offset indent
48b80225cdSKonstantin Belousov.Cd "options COMPAT_43"
49b80225cdSKonstantin Belousov.br
50b80225cdSKonstantin Belousov.Cd "options COMPAT_FREEBSD32"
51b80225cdSKonstantin Belousov.Ed
52b80225cdSKonstantin Belousov.Pp
53b80225cdSKonstantin BelousovThe
54b80225cdSKonstantin Belousov.Va COMPAT_FREEBSD32
55b80225cdSKonstantin Belousovoption is only required on 64-bit CPU architectures.
56b80225cdSKonstantin Belousov.Pp
57b80225cdSKonstantin BelousovThe
58b80225cdSKonstantin Belousov.Va aout.ko
59*ecb84463SJoel Dahlmodule needs to be loaded with the
60*ecb84463SJoel Dahl.Xr kldload 8
61*ecb84463SJoel Dahlutility in order to support the
62b80225cdSKonstantin Belousov.Xr a.out 5
63*ecb84463SJoel Dahlimage activator:
64b80225cdSKonstantin Belousov.Bd -ragged -offset indent
65b80225cdSKonstantin Belousov.Ic kldload aout
66b80225cdSKonstantin Belousov.Ed
67*ecb84463SJoel Dahl.Pp
68*ecb84463SJoel DahlAlternatively, to load the module at boot time, place the following line in
69b80225cdSKonstantin Belousov.Xr loader.conf 5 :
70b80225cdSKonstantin Belousov.Bd -literal -offset indent
71b80225cdSKonstantin Belousovaout_load="YES"
72b80225cdSKonstantin Belousov.Ed
73b80225cdSKonstantin Belousov.Pp
74b80225cdSKonstantin BelousovThe
75b80225cdSKonstantin Belousov.Xr a.out 5
76*ecb84463SJoel Dahlformat was mainstream quite a long time ago.
77*ecb84463SJoel DahlReasonable default settings and security requirements of
78*ecb84463SJoel Dahlmodern operating systems today contradict the default environment of that time and
79b80225cdSKonstantin Belousovrequire adjustments of the system to mimic natural environment for
80b80225cdSKonstantin Belousovold binaries.
81b80225cdSKonstantin Belousov.Pp
82b80225cdSKonstantin BelousovThe following
83b80225cdSKonstantin Belousov.Xr sysctl 8
84b80225cdSKonstantin Belousovtunables are useful for this:
85b80225cdSKonstantin Belousov.Bl -tag -offset indent -width "XXXXXXXXXXXXXXXXXXXXXXXXX"
86b80225cdSKonstantin Belousov.It Xo Va security.bsd.map_at_zero
87b80225cdSKonstantin Belousov.Xc
88*ecb84463SJoel DahlSet to 1 to allow mapping of process pages at address 0.
89b80225cdSKonstantin BelousovSome very old
90b80225cdSKonstantin Belousov.Va ZMAGIC
91*ecb84463SJoel Dahlexecutable images require text mapping at address 0.
92b80225cdSKonstantin Belousov.It Xo Va kern.pid_max
93b80225cdSKonstantin Belousov.Xc
94b80225cdSKonstantin BelousovOld versions of
95b80225cdSKonstantin Belousov.Fx
96b80225cdSKonstantin Belousovused 16-bit types for
97b80225cdSKonstantin Belousov.Vt pid_t .
98b80225cdSKonstantin BelousovCurrent kernels use 32-bit type for
99b80225cdSKonstantin Belousov.Vt pid_t ,
100*ecb84463SJoel Dahland allow process id's up to 99999.
101b80225cdSKonstantin BelousovSuch values cannot be represented by old
102b80225cdSKonstantin Belousov.Vt pid_t ,
103*ecb84463SJoel Dahlmostly causing issues for processes using
104b80225cdSKonstantin Belousov.Xr wait 2
105*ecb84463SJoel Dahlsyscalls, for example shells.
106b80225cdSKonstantin BelousovSet the sysctl to 30000 to work around the problem.
107b80225cdSKonstantin Belousov.It Xo Va kern.elf32.read_exec
108b80225cdSKonstantin Belousov.Xc
109b80225cdSKonstantin BelousovSet to 1 to force any accessible memory mapping performed by 32-bit
110b80225cdSKonstantin Belousovprocess to allow execution, see
111b80225cdSKonstantin Belousov.Xr mmap 2 .
112b80225cdSKonstantin BelousovOld i386 CPUs did not have a bit in PTE which disallowed execution
113*ecb84463SJoel Dahlfrom the page, so many old programs did not specify
114b80225cdSKonstantin Belousov.Va PROT_EXEC
115b80225cdSKonstantin Belousoveven for mapping of executable code.
116b80225cdSKonstantin BelousovThe sysctl forces
117b80225cdSKonstantin Belousov.Va PROT_EXEC
118b80225cdSKonstantin Belousovif mapping has any access allowed at all.
119b80225cdSKonstantin BelousovThe setting is only needed if the host architecture allows
120b80225cdSKonstantin Belousovnon-executable mappings.
121b80225cdSKonstantin Belousov.El
122b80225cdSKonstantin Belousov.Sh SEE ALSO
123b80225cdSKonstantin Belousov.Xr execve 2 ,
124b80225cdSKonstantin Belousov.Xr a.out 5 ,
125b80225cdSKonstantin Belousov.Xr elf 5 ,
126b80225cdSKonstantin Belousov.Xr sysctl 8 .
127b80225cdSKonstantin Belousov.Sh HISTORY
128b80225cdSKonstantin BelousovThe
129b80225cdSKonstantin Belousov.Xr a.out 5
130b80225cdSKonstantin Belousovexecutable format was used on ancient
131b80225cdSKonstantin Belousov.At
132b80225cdSKonstantin Belousovand served as the main executable format for
133b80225cdSKonstantin Belousov.Fx
134*ecb84463SJoel Dahlfrom the beginning up to
135b80225cdSKonstantin Belousov.Fx 2.2.9 .
136b80225cdSKonstantin BelousovIn
137b80225cdSKonstantin Belousov.Fx 3.0
138b80225cdSKonstantin Belousovit was superseded by
139b80225cdSKonstantin Belousov.Xr elf 5 .
140b80225cdSKonstantin Belousov.Sh AUTHORS
141b80225cdSKonstantin BelousovThe
142b80225cdSKonstantin Belousov.Nm
143b80225cdSKonstantin Belousovmanual page was written by
144b80225cdSKonstantin Belousov.An Konstantin Belousov Aq kib@FreeBSD.org .
145*ecb84463SJoel Dahl.Sh BUGS
146*ecb84463SJoel DahlOn 64bit architectures, not all wrappers for older syscalls are implemented.
147