summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotto <>2010-01-13 12:40:11 +0000
committerotto <>2010-01-13 12:40:11 +0000
commit8bd93f3746d18101d992ecf3736c1b4d77e4a65f (patch)
tree8bb109b1fc8f03024685133e2b6cc5d37394024e
parentd4e7c61bda32ceac2251a146fb851175e8720274 (diff)
downloadopenbsd-8bd93f3746d18101d992ecf3736c1b4d77e4a65f.tar.gz
openbsd-8bd93f3746d18101d992ecf3736c1b4d77e4a65f.tar.bz2
openbsd-8bd93f3746d18101d992ecf3736c1b4d77e4a65f.zip
New options 'S', as a shorthand for the options most suitable as an
extra safeguard (FGJ). Idea from deraadt@; ok deraadt@ dlg@
-rw-r--r--src/lib/libc/stdlib/malloc.36
-rw-r--r--src/lib/libc/stdlib/malloc.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index e0edd9446e..71962c565b 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.63 2009/10/10 18:36:52 otto Exp $ 33.\" $OpenBSD: malloc.3,v 1.64 2010/01/13 12:40:11 otto Exp $
34.\" 34.\"
35.Dd $Mdocdate: October 10 2009 $ 35.Dd $Mdocdate: January 13 2010 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -272,6 +272,8 @@ This can substantially aid in compacting memory.
272.\".Xr ktrace 1 272.\".Xr ktrace 1
273.\"for all operations. 273.\"for all operations.
274.\"Consult the source for this one. 274.\"Consult the source for this one.
275.It Cm S
276Enable all options suitable for security auditing.
275.It Cm X 277.It Cm X
276.Dq xmalloc . 278.Dq xmalloc .
277Rather than return failure, 279Rather than return failure,
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index 9bdea862f2..9cee3e5935 100644
--- a/src/lib/libc/stdlib/malloc.c
+++ b/src/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: malloc.c,v 1.123 2009/12/16 08:23:53 otto Exp $ */ 1/* $OpenBSD: malloc.c,v 1.124 2010/01/13 12:40:11 otto Exp $ */
2/* 2/*
3 * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
4 * 4 *
@@ -661,6 +661,10 @@ omalloc_init(struct dir_info **dp)
661 case 'R': 661 case 'R':
662 mopts.malloc_realloc = 1; 662 mopts.malloc_realloc = 1;
663 break; 663 break;
664 case 'S':
665 mopts.malloc_freeprot = mopts.malloc_junk = 1;
666 mopts.malloc_guard = MALLOC_PAGESIZE;
667 break;
664 case 'x': 668 case 'x':
665 mopts.malloc_xmalloc = 0; 669 mopts.malloc_xmalloc = 0;
666 break; 670 break;