summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/malloc.3
diff options
context:
space:
mode:
authordjm <>2012-11-02 18:18:15 +0000
committerdjm <>2012-11-02 18:18:15 +0000
commitcc27290cd0ac9c8a750e38719b5dff3cb0219726 (patch)
tree5ac95b51be61afab38ef830fc97336aacc9973c7 /src/lib/libc/stdlib/malloc.3
parente05982c56ef9dbde368df8fe35a8458f34b76f76 (diff)
downloadopenbsd-cc27290cd0ac9c8a750e38719b5dff3cb0219726.tar.gz
openbsd-cc27290cd0ac9c8a750e38719b5dff3cb0219726.tar.bz2
openbsd-cc27290cd0ac9c8a750e38719b5dff3cb0219726.zip
Add a new malloc option 'U' => "Free unmap" that does the guarding/
unmapping of freed allocations without disabling chunk randomisation like the "Freeguard" ('F') option does. Make security 'S' option use 'U' and not 'F'. Rationale: guarding with no chunk randomisation is great for debugging use-after-free, but chunk randomisation offers better defence against "heap feng shui" style attacks that depend on carefully constructing a particular heap layout so we should leave this enabled when requesting security options.
Diffstat (limited to 'src/lib/libc/stdlib/malloc.3')
-rw-r--r--src/lib/libc/stdlib/malloc.315
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index 6a012fd23d..74df922f4b 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.70 2011/07/22 07:00:44 otto Exp $ 33.\" $OpenBSD: malloc.3,v 1.71 2012/11/02 18:18:15 djm Exp $
34.\" 34.\"
35.Dd $Mdocdate: July 22 2011 $ 35.Dd $Mdocdate: November 2 2012 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -231,13 +231,17 @@ This option requires the library to have been compiled with -DMALLOC_STATS in
231order to have any effect. 231order to have any effect.
232.It Cm F 232.It Cm F
233.Dq Freeguard . 233.Dq Freeguard .
234Enable use after free protection. 234Enable use after free detection.
235Unused pages on the freelist are read and write protected to 235Unused pages on the freelist are read and write protected to
236cause a segmentation fault upon access. 236cause a segmentation fault upon access.
237This will also switch off the delayed freeing of chunks, 237This will also switch off the delayed freeing of chunks,
238reducing random behaviour but detecting double 238reducing random behaviour but detecting double
239.Fn free 239.Fn free
240calls as early as possible. 240calls as early as possible.
241This option is intended for debugging rather than improved security
242(use the
243.Cm U
244option for security).
241.It Cm G 245.It Cm G
242.Dq Guard . 246.Dq Guard .
243Enable guard pages. 247Enable guard pages.
@@ -275,6 +279,11 @@ This can substantially aid in compacting memory.
275.\"Consult the source for this one. 279.\"Consult the source for this one.
276.It Cm S 280.It Cm S
277Enable all options suitable for security auditing. 281Enable all options suitable for security auditing.
282.It Cm U
283.Dq Free unmap .
284Enable use after free protection for larger allocations.
285Unused pages on the freelist are read and write protected to
286cause a segmentation fault upon access.
278.It Cm X 287.It Cm X
279.Dq xmalloc . 288.Dq xmalloc .
280Rather than return failure, 289Rather than return failure,