Annotation of htdocs/docs/kernel/non-exec.html, revision 1.3

1.1       dsieger     1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                      2: <html>
                      3: <head>
                      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                      5: <meta name="generator" content="Website XSL Stylesheet V2.6.0">
                      6: <link rel="home" href="../../." title="Welcome to The NetBSD Project: Of course it runs NetBSD.">
                      7: <link rel="up" href="../../docs/kernel/." title="NetBSD Documentation: Kernel">
                      8: <link rel="previous" href="../../docs/kernel/lazyfpu.html" title="NetBSD Documentation: How lazy FPU context switch works">
                      9: <link rel="next" href="../../docs/kernel/ddwg.html" title="NetBSD Device Driver Writing Guide">
                     10: <link rel="first" href="../../docs/kernel/lazyfpu.html" title="NetBSD Documentation: How lazy FPU context switch works">
                     11: <link rel="last" href="../../docs/kernel/elf-notes.html" title="NetBSD Documentation: Vendor-specific ELF Note Elements">
1.3     ! dsieger    12: <link rel="stylesheet" href="/global.css" type="text/css">
1.1       dsieger    13: <title>Non-executable stack and heap</title>
                     14: </head>
                     15: <body class="website"><div class="webpage">
1.3     ! dsieger    16: <a name="docs-kernel-non-exec"></a><div id="top"><a href="#mainContent" class="doNotDisplay doNotPrint">Skip to main content.</a></div>
        !            17: <div id="header">
        !            18: <div class="topNavigation">
        !            19: <span>» </span><a href="/docs/guide/en/">The Guide</a> |
        !            20:        <a href="http://man.NetBSD.org/">Manual pages</a> |
        !            21:        <a href="/mailinglists/">Mailing lists</a> and
        !            22:        <a href="http://mail-index.NetBSD.org/">Archives</a> |
        !            23:        <a href="http://cvsweb.NetBSD.org/">CVS repository</a> |
        !            24:        <a href="http://www.NetBSD.org/Gnats/">Report or query a bug</a> |
        !            25:        <a href="/docs/software/packages.html">Packages</a>
        !            26: </div>
        !            27: <div class="centralHeader">
        !            28: <a href="/"><img src="/images/NetBSD-headerlogo.png" alt="[NetBSD Logo]" width="506" height="90"></a><div class="headerTools"><div id="headerSearch"><form method="get" action="http://www.google.com/custom">
        !            29: <input type="text" name="q" onfocus="if(this.value==this.defaultValue ) this.value='';" size="12" maxlength="255" value="Search"><input type="hidden" name="cof" value="L:http://www.NetBSD.org/images/NetBSD-smaller.png;LH:200;LW:200;AH:center;AWFID:4f6b0499f0f58d2c;"><input type="hidden" name="domains" value="NetBSD.org"><input type="hidden" name="sitesearch" value="www.NetBSD.org"><input type="submit" value="Search">
        !            30: </form></div></div>
        !            31: </div>
        !            32: <div class="navBar">
        !            33: <span class="doNotDisplay">Navigation:</span><a href="/">Home <span>»</span></a> 
        !            34:        <a href="/about/">About <span>»</span></a> 
        !            35:        <a href="/releases/">Download <span>»</span></a> 
        !            36:        <a href="/docs/">Documentation <span>»</span></a> 
        !            37:        <a href="/support/">Support <span>»</span></a> 
        !            38:        <a href="/community/">Community <span>»</span></a> 
        !            39:        <a href="/ports/">Ports <span>»</span></a>
        !            40: </div>
        !            41: </div>
        !            42: <div id="content"><div class="fullWidth"><div class="rowOfBoxes">
        !            43: <h1>Non-executable stack and heap</h1>
1.1       dsieger    44: <div class="sect1" lang="en">
                     45: <div class="titlepage"></div>
                     46: 
                     47: <p>
                     48: Starting with version 2.0, NetBSD supports non-executable mappings on
                     49: platforms where the hardware allows it. Process stack and heap mappings are
                     50: non-executable by default. This makes exploiting potential buffer overflows
                     51: harder. NetBSD supports PROT_EXEC permission via mmap() for all platforms
                     52: where the hardware differentiates execute access from data access, though
                     53: not necessarily with single-page granularity. When the hardware has a
                     54: larger granularity, the rule is that if any page in the larger unit is
                     55: executable, then the entire larger unit is executable, otherwise the entire
                     56: larger unit is not executable.
                     57: </p>
                     58: 
                     59: <p>
                     60: No compile-time option is needed to enable this software support,
                     61: it's always available. 
                     62: </p>
                     63: 
                     64: <div class="sect2" lang="en">
                     65: <div class="titlepage"><div><div><h3 class="title">
                     66: <a name="supported-platforms"></a>Supported platforms</h3></div></div></div>
                     67: 
                     68: 
                     69: <p>
                     70: Here is a list of support levels based on hardware
                     71: limitations. In this list "the stack" refers to the traditional UNIX
                     72: process stack, not pthreads stacks.
                     73: </p>
                     74: 
                     75: <div class="itemizedlist"><ul type="disc">
                     76: <li>
                     77: <span class="bold"><strong>amd64, sparc64, sparc (sun4m, sun4d), powerpc (ibm4xx), 
                     78: alpha, hppa:</strong></span>
                     79: Full support, each page is independently executable or not.
                     80: </li>
                     81: <li>
                     82: <span class="bold"><strong>powerpc (eg. macppc):</strong></span>
                     83: The hardware granularity is a segment (256MB) instead of a page.
                     84: By default, the segment containing the stack is not executable.
                     85: </li>
                     86: <li>
                     87: <span class="bold"><strong>i386:</strong></span>
                     88: The hardware support is pretty limited, so the granularity is very coarse.
                     89: The current software implementation in NetBSD is that there are only two
                     90: regions of the application address space which may be independently
                     91: executable or not: the stack and everything else.  By default,
                     92: the stack is not executable and everything else is executable
                     93: </li>
                     94: <li>
                     95: <span class="bold"><strong>Everything else; arm, m68k, mips, pc532, sh3, 
                     96: sparc(sun, sun4c), vax:</strong></span>
                     97: No support, the hardware does not differentiate execute vs. data accesses,
                     98: so anything readable to a process as data is executable by the process
                     99: as code.
                    100: </li>
                    101: </ul></div>
                    102: 
                    103: </div>
                    104: </div>
1.3     ! dsieger   105: </div></div></div>
        !           106: <div class="navfoot"></div>
        !           107: <div id="footer"><center>
        !           108: <span class="footfeed"><a href="http://www.NetBSD.org/cgi-bin/feedback.cgi">
        !           109:          Contact</a> |
        !           110:       </span><span class="footcopy"><a href="/about/disclaimer.html">
        !           111:       Disclaimer</a> |
        !           112: 
        !           113:       <span class="copyright">Copyright © 1994-2007 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>®</sup> is a registered trademark of The NetBSD
        !           114:        Foundation, Inc.</span>
        !           115: </center></div>
1.1       dsieger   116: </div></body>
                    117: </html>

CVSweb <webmaster@jp.NetBSD.org>