Otto Moerbeek
unread,Oct 14, 2016, 7:41:01 AM10/14/16You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to te...@openbsd.org
Hi,
0xdb is better dan 0xd0, since it is unaligned in more cases (think
about the bytes being used as a pointer.
ok?
-Otto
Index: lib/libc/stdlib/malloc.c
===================================================================
RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v
retrieving revision 1.200
diff -u -p -r1.200 malloc.c
--- lib/libc/stdlib/malloc.c 12 Oct 2016 07:36:38 -0000 1.200
+++ lib/libc/stdlib/malloc.c 14 Oct 2016 11:37:44 -0000
@@ -81,8 +81,8 @@
* when the 'J' option is enabled. Use SOME_JUNK right after alloc,
* and SOME_FREEJUNK right before free.
*/
-#define SOME_JUNK 0xd0 /* as in "Duh" :-) */
-#define SOME_FREEJUNK 0xdf
+#define SOME_JUNK 0xdb /* deadbeef */
+#define SOME_FREEJUNK 0xdf /* dead, free */
#define MMAP(sz) mmap(NULL, (sz), PROT_READ | PROT_WRITE, \
MAP_ANON | MAP_PRIVATE, -1, 0)
Index: share/man/man5/malloc.conf.5
===================================================================
RCS file: /cvs/src/share/man/man5/malloc.conf.5,v
retrieving revision 1.7
diff -u -p -r1.7 malloc.conf.5
--- share/man/man5/malloc.conf.5 6 Jul 2016 20:32:02 -0000 1.7
+++ share/man/man5/malloc.conf.5 14 Oct 2016 11:37:45 -0000
@@ -84,10 +84,8 @@ Increase the junk level by one if it is
.Dq Less junking .
Decrease the junk level by one if it is larger than 0.
Junking writes some junk bytes into the area allocated.
-Currently junk is bytes of 0xd0 when allocating; this is pronounced
-.Dq Duh .
-\&:-)
-Freed chunks are filled with 0xdf.
+Currently junk is bytes of 0xdb when allocating;
+freed chunks are filled with 0xdf.
By default the junk level is 1: small chunks are always junked
and the first part of pages is junked after free.
After a delay (if not switched off by the F option),