1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
<table class="head">
<tr>
<td class="head-ltitle">AOUT(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">AOUT(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">aout</code> — <span class="Nd">kernel
support for executing binary files in legacy a.out format</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<div class="Bd Bd-indent Li">
<pre>kldload a.out</pre>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <a class="Xr">a.out(5)</a> executable format was used before
the release of <span class="Ux">FreeBSD 3.0</span>. Since i386 was the only
supported architecture at that time, <a class="Xr">a.out(5)</a> executables
can only be activated on platforms that support execution of i386 code, such
as i386 and amd64.</p>
<p class="Pp">To add kernel support for old syscalls and old syscall invocation
methods, place the following options in the kernel configuration file:</p>
<div class="Bd Pp Bd-indent"><code class="Cd">options COMPAT_43</code>
<br/>
<code class="Cd">options COMPAT_FREEBSD32</code></div>
<p class="Pp">The <var class="Va">COMPAT_FREEBSD32</var> option is only required
on 64-bit CPU architectures.</p>
<p class="Pp">The <var class="Va">aout.ko</var> module needs to be loaded with
the <a class="Xr">kldload(8)</a> utility in order to support the
<a class="Xr">a.out(5)</a> image activator:</p>
<div class="Bd Pp Bd-indent"><code class="Ic">kldload aout</code></div>
<p class="Pp">Alternatively, to load the module at boot time, place the
following line in <a class="Xr">loader.conf(5)</a>:</p>
<div class="Bd Pp Bd-indent Li">
<pre>aout_load="YES"</pre>
</div>
<p class="Pp">The <a class="Xr">a.out(5)</a> format was mainstream quite a long
time ago. Reasonable default settings and security requirements of modern
operating systems today contradict the default environment of that time and
require adjustments of the system to mimic natural environment for old
binaries.</p>
<p class="Pp">The following <a class="Xr">sysctl(8)</a> tunables are useful for
this:</p>
<div class="Bd-indent">
<dl class="Bl-tag">
<dt id="security.bsd.map_at_zero"><var class="Va">security.bsd.map_at_zero</var></dt>
<dd>Set to 1 to allow mapping of process pages at address 0. Some very old
<var class="Va">ZMAGIC</var> executable images require text mapping at
address 0.</dd>
<dt id="kern.pid_max"><var class="Va">kern.pid_max</var></dt>
<dd>Old versions of <span class="Ux">FreeBSD</span> used signed 16-bit type
for <var class="Vt">pid_t</var>. Current kernels use 32-bit type for
<var class="Vt">pid_t</var>, and allow process id's up to 99999. Such
values cannot be represented by old <var class="Vt">pid_t</var>, mostly
causing issues for processes using <a class="Xr">wait(2)</a> syscalls, for
example shells. Set the sysctl to 30000 to work around the problem.</dd>
<dt id="kern.elf32.read_exec"><var class="Va">kern.elf32.read_exec</var></dt>
<dd>Set to 1 to force any accessible memory mapping performed by 32-bit
process to allow execution, see <a class="Xr">mmap(2)</a>. Old i386 CPUs
did not have a bit in PTE which disallowed execution from the page, so
many old programs did not specify <var class="Va">PROT_EXEC</var> even for
mapping of executable code. The sysctl forces
<var class="Va">PROT_EXEC</var> if mapping has any access allowed at all.
The setting is only needed if the host architecture allows non-executable
mappings.</dd>
</dl>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">execve(2)</a>, <a class="Xr">a.out(5)</a>,
<a class="Xr">elf(5)</a>, <a class="Xr">sysctl(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <a class="Xr">a.out(5)</a> executable format was used on
ancient <span class="Ux">AT&T UNIX</span> and served as the main
executable format for <span class="Ux">FreeBSD</span> from the beginning up
to <span class="Ux">FreeBSD 2.2.9</span>. In <span class="Ux">FreeBSD
3.0</span> it was superseded by <a class="Xr">elf(5)</a>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">The <code class="Nm">aout</code> manual page was written by
<span class="An">Konstantin Belousov</span>
<<a class="Mt" href="mailto:kib@FreeBSD.org">kib@FreeBSD.org</a>>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
<p class="Pp">On 64bit architectures, not all wrappers for older syscalls are
implemented.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">August 14, 2012</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|