OpenBSD CVS

CVS log for src/libexec/ld.so/malloc.c


[BACK] Up to [local] / src / libexec / ld.so

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.35 / (download) - annotate - [select for diffs], Tue Jan 18 21:59:29 2022 UTC (2 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.34: +4 -3 lines
Diff to previous 1.34 (colored)

Avoid pulling sys/param.h, by using _ALIGN instead.
sys/time.h now gets NBBY and howmany() also
ok guenther

Revision 1.34 / (download) - annotate - [select for diffs], Sat Jan 8 06:49:41 2022 UTC (2 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.33: +5 -6 lines
Diff to previous 1.33 (colored)

Prep .c files for removing the #includes from */archdep.h
 * replace #include "archdep.h" with #includes of what is used, pulling in
   "syscall.h", "util.h", and "archdep.h" as needed
 * delete #include <sys/syscall.h> from syscall.h
 * only pull in <sys/stat.h> to the three files that use _dl_fstat(),
   forward declare struct stat in syscall.h for the others
 * NBBY is for <sys/select.h> macros; just use '8' in dl_printf.c
 * <machine/vmparam.h> is only needed on i386; conditionalize it
 * stop using __LDPGSZ: use _MAX_PAGE_SHIFT (already used by malloc.c)
   where necessary
 * delete other bogus #includes, order legit per style: <sys/*> then
   <*/*>, then <*>, then "*"

dir.c improvement from jsg@
ok and testing assistance deraadt@

Revision 1.33 / (download) - annotate - [select for diffs], Thu Dec 30 08:39:19 2021 UTC (2 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.32: +2 -7 lines
Diff to previous 1.32 (colored)

Sync from libc: Use _MAX_PAGE_SHIFT, rather than #ifdef mips64

ok otto@

Revision 1.32 / (download) - annotate - [select for diffs], Mon Apr 19 06:43:15 2021 UTC (3 years, 1 month ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.31: +4 -1 lines
Diff to previous 1.31 (colored)

Same internal consistency check as libc malloc: size in hash table
should correspond to size of chunk meta data

Revision 1.31 / (download) - annotate - [select for diffs], Sat Dec 26 13:17:33 2020 UTC (3 years, 5 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.30: +1 -4 lines
Diff to previous 1.30 (colored)

Fix a nasty mem leak in ld.so's own malloc. This was hard to diagnose, since
malloc dumping and gdb do not help at all when studying ld.so. In the end
it turns out ot be a simple merge error causing extra mmap calls.
ok miller@ tb@

Revision 1.30 / (download) - annotate - [select for diffs], Mon Sep 30 03:35:09 2019 UTC (4 years, 8 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Oops: the call to ofree() in orealloc() was misconverted into a call to
_dl_free(), which would trigger a "recursive call" assertion...if we
had ever realloced in ld.so

ok deraadt@

Revision 1.29 / (download) - annotate - [select for diffs], Fri Nov 2 07:26:25 2018 UTC (5 years, 7 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.28: +72 -75 lines
Diff to previous 1.28 (colored)

ld.so's malloc has no runtime option processing, so remove the
setting flags and replace them by constants. ok deraadt@ guenther@

Revision 1.28 / (download) - annotate - [select for diffs], Tue Oct 23 04:01:45 2018 UTC (5 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.27: +14 -35 lines
Diff to previous 1.27 (colored)

Delay processing of ld.so's own PT_GNU_RELRO section until after environment
processing and malloc initialization, and then move variables set by those
steps, including malloc's mopts structure, into the .data.rel.ro segment.
This protects more data and eliminates the extra padding of the mopts.

ok kettenis@

Revision 1.27 / (download) - annotate - [select for diffs], Wed Feb 7 18:59:20 2018 UTC (6 years, 4 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.26: +1 -3 lines
Diff to previous 1.26 (colored)

sync with libc malloc: use consistent style for for loop in unmap(),
no functional change

Revision 1.26 / (download) - annotate - [select for diffs], Thu Feb 1 11:14:23 2018 UTC (6 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.25: +1 -0 lines
Diff to previous 1.25 (colored)

don't forget to increment loop var; infinite loops spotted by sthen@

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jan 30 17:45:53 2018 UTC (6 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.24: +1 -1 lines
Diff to previous 1.24 (colored)

kill a gcc warning

Revision 1.24 / (download) - annotate - [select for diffs], Tue Jan 30 16:40:20 2018 UTC (6 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.23: +294 -305 lines
Diff to previous 1.23 (colored)

port over the malloc changes from libc. prompted by deraadt@

Revision 1.23 / (download) - annotate - [select for diffs], Fri Dec 1 23:30:05 2017 UTC (6 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.22: +119 -0 lines
Diff to previous 1.22 (colored)

Redo the calculation of the alignment and placement of static TLS data to
correctly take into account the segment p_align.  Previously, anything
with a size belong the natural alignment or with alignment larger than
the natural one would either not be intialized correctly, be misaligned,
or result in the TIB being misaligned.

Problems reported by Charles Collicutt (charles (at) collicutt.co.uk)
ok kettenis@

Revision 1.22 / (download) - annotate - [select for diffs], Thu Oct 5 09:34:57 2017 UTC (6 years, 8 months ago) by otto
Branch: MAIN
Changes since 1.21: +15 -21 lines
Diff to previous 1.21 (colored)

Sync with libc malloc, doing delayed free double-free check always

Revision 1.21 / (download) - annotate - [select for diffs], Sun Jul 23 09:36:16 2017 UTC (6 years, 10 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

from libc malloc: only access offset if canaries are enabled *and* size > 0
and initialize ->offset to a definite value in the size == 0 case

Revision 1.20 / (download) - annotate - [select for diffs], Mon May 8 02:34:01 2017 UTC (7 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.19: +13 -8 lines
Diff to previous 1.19 (colored)

Always use the same callback to unlock as was used to lock.  Permits
libpthread initialization from a shared object's init (or fini, I suppose)
routines.

ok kurt@ kettenis@ espie@

Revision 1.19 / (download) - annotate - [select for diffs], Sat Feb 18 20:29:38 2017 UTC (7 years, 3 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.18: +4 -1 lines
Diff to previous 1.18 (colored)

Add NULL tests to wrterror() to avoid a NULL deref when called from
malloc initialization or a free() error path.

Prompted by libc's malloc.c rev 1.214; with correction from jsg@ and otto@
ok jsg@ krw@

Revision 1.18 / (download) - annotate - [select for diffs], Tue Jan 24 07:48:37 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.17: +2 -17 lines
Diff to previous 1.17 (colored)

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@

Revision 1.17 / (download) - annotate - [select for diffs], Thu Nov 3 18:52:40 2016 UTC (7 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.16: +4 -2 lines
Diff to previous 1.16 (colored)

small tweak to also check canaries if F is in effect

Revision 1.16 / (download) - annotate - [select for diffs], Mon Oct 31 10:08:09 2016 UTC (7 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.15: +4 -9 lines
Diff to previous 1.15 (colored)

sync to libc: malloc_move is not an option anymore

Revision 1.15 / (download) - annotate - [select for diffs], Tue Oct 25 06:04:41 2016 UTC (7 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.14: +29 -12 lines
Diff to previous 1.14 (colored)

bring canaries for > page sized objects from libc to ld.so; ok guenther@

Revision 1.14 / (download) - annotate - [select for diffs], Fri Oct 14 17:35:39 2016 UTC (7 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

0xd0 -> 0xdb from libc malloc

Revision 1.13 / (download) - annotate - [select for diffs], Fri Oct 14 11:33:13 2016 UTC (7 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.12: +75 -13 lines
Diff to previous 1.12 (colored)

move better canary code and validate_junk() over from libc malloc

Revision 1.12 / (download) - annotate - [select for diffs], Sun Sep 18 13:54:58 2016 UTC (7 years, 8 months ago) by otto
Branch: MAIN
Changes since 1.11: +5 -5 lines
Diff to previous 1.11 (colored)

merge form libc malloc:
move page junking tp unmap(), right before we stick the region in the cache;
ok tedu@

Revision 1.11 / (download) - annotate - [select for diffs], Sun Sep 4 18:26:28 2016 UTC (7 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.10: +12 -21 lines
Diff to previous 1.10 (colored)

Redundant memset and some better style wrt exiting functions after error.
ok guenther@

Revision 1.10 / (download) - annotate - [select for diffs], Sat Sep 3 12:24:10 2016 UTC (7 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.9: +36 -68 lines
Diff to previous 1.9 (colored)

cherry-pick a few diffs from libc malloc; ok guenther@

Revision 1.9 / (download) - annotate - [select for diffs], Fri Aug 12 20:39:01 2016 UTC (7 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.8: +4 -4 lines
Diff to previous 1.8 (colored)

the slimmed down random functions inside ld.so are strict clones of the
libc arc4random API, so call them _dl_{arc4random,arcrandombuf}
ok tedu guenther

Revision 1.8 / (download) - annotate - [select for diffs], Thu May 19 18:50:01 2016 UTC (8 years ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.7: +29 -10 lines
Diff to previous 1.7 (colored)

ld.so can now be entered by multiple threads via _dl_{allocate,free}_tib(),
so do locking in ld.so's malloc subsystem, (re)using the existing
_dl_thread_kern_{stop,go}() callbacks.

problem diagnosed by jsing@ in the 'go' port; fix tested there and by
semarie@ in the 'rust' port

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jan 22 05:48:17 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.6: +15 -15 lines
Diff to previous 1.6 (colored)

delete annoying white space that annoy

Revision 1.6 / (download) - annotate - [select for diffs], Fri Jan 16 16:18:07 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +2 -4 lines
Diff to previous 1.5 (colored)

<sys/param.h> to <limits.h> conversion.  Verified binaries
ok millert, thanks to doug for process advice

Revision 1.5 / (download) - annotate - [select for diffs], Mon Nov 3 06:08:56 2014 UTC (9 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

arc4random_uniform() transformation was off, resulting in badly skewed
distribution in the placement of malloc's dir_info.

ok otto@ deraadt@

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jul 6 08:34:12 2014 UTC (9 years, 11 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.3: +1 -2 lines
Diff to previous 1.3 (colored)

this version of malloc does not need string.h

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jun 21 08:00:23 2014 UTC (9 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.2: +47 -1 lines
Diff to previous 1.2 (colored)

Move to a non-zeroing _dl_malloc, a _dl_calloc and _dl_reallocarry and
fix _dl_strdup to return NULL instead of crash; ok deraadt@

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jun 15 06:48:30 2014 UTC (9 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

move to a smaller rbytes buffer; ok miod@ deraadt@

Revision 1.1 / (download) - annotate - [select for diffs], Thu Jun 5 08:39:07 2014 UTC (10 years ago) by otto
Branch: MAIN

Move to (slightly stripped) version of libc malloc; ok deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.