Annotation of htdocs/docs/kernel/non-exec.xml, revision 1.7
1.1 dsieger 1: <?xml version="1.0"?>
2: <!DOCTYPE webpage
3: PUBLIC "-//NetBSD//DTD Website-based NetBSD Extension//EN"
4: "http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd" [
5: ]>
6:
7: <webpage id="docs-kernel-non-exec">
8: <config param="desc" value="Non-executable stack and heap"/>
1.7 ! maya 9: <config param="cvstag" value="$NetBSD: non-exec.xml,v 1.6 2021/05/15 06:20:07 maya Exp $"/>
! 10: <config param="rcsdate" value="$Date: 2021/05/15 06:20:07 $"/>
1.1 dsieger 11: <head>
12: <title>Non-executable stack and heap</title>
13: </head>
14:
15: <sect1 id="top">
16:
17: <para>
18: Starting with version 2.0, NetBSD supports non-executable mappings on
19: platforms where the hardware allows it. Process stack and heap mappings are
20: non-executable by default. This makes exploiting potential buffer overflows
21: harder. NetBSD supports PROT_EXEC permission via mmap() for all platforms
22: where the hardware differentiates execute access from data access, though
23: not necessarily with single-page granularity. When the hardware has a
24: larger granularity, the rule is that if any page in the larger unit is
25: executable, then the entire larger unit is executable, otherwise the entire
26: larger unit is not executable.
27: </para>
28:
29: <para>
1.6 maya 30: No compile-time option is needed to enable this software support,
31: it's always available.
32: </para>
33:
34: <para>
1.7 ! maya 35: This support is also used on some kernel configurations for PaX mprotect (also
! 36: known as W^X), which forbids even a single page from being mapped both writable
! 37: and executable. See &man.paxctl.8; for more information.
! 38: </para>
1.5 maya 39:
1.1 dsieger 40: <sect2 id="supported-platforms">
41: <title>Supported platforms</title>
42:
43: <para>
44: Here is a list of support levels based on hardware
45: limitations. In this list "the stack" refers to the traditional UNIX
46: process stack, not pthreads stacks.
47: </para>
48:
49: <itemizedlist>
50: <listitem>
1.4 maya 51: <emphasis role="bold">aarch64, arm newer than ARMv6, amd64, sparc64, sparc (sun4m, sun4d), powerpc (ibm4xx),
52: alpha, hppa, i386 with PAE (not the default):</emphasis>
1.1 dsieger 53: Full support, each page is independently executable or not.
54: </listitem>
55: <listitem>
1.3 snj 56: <emphasis role="bold">powerpc (e.g., macppc):</emphasis>
1.1 dsieger 57: The hardware granularity is a segment (256MB) instead of a page.
58: By default, the segment containing the stack is not executable.
59: </listitem>
60: <listitem>
1.4 maya 61: <emphasis role="bold">i386 by default (no PAE):</emphasis>
1.1 dsieger 62: The hardware support is pretty limited, so the granularity is very coarse.
63: The current software implementation in NetBSD is that there are only two
64: regions of the application address space which may be independently
65: executable or not: the stack and everything else. By default,
66: the stack is not executable and everything else is executable
67: </listitem>
68: <listitem>
1.4 maya 69: <emphasis role="bold">Everything else; arm older than ARMv6, m68k, mips, sh3,
1.1 dsieger 70: sparc(sun, sun4c), vax:</emphasis>
71: No support, the hardware does not differentiate execute vs. data accesses,
72: so anything readable to a process as data is executable by the process
73: as code.
74: </listitem>
75: </itemizedlist>
76:
77: </sect2>
78: </sect1>
79:
80: </webpage>
CVSweb <webmaster@jp.NetBSD.org>