History log of /freebsd/libexec/rtld-elf/rtld_malloc.c (Results 1 – 24 of 24)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 43581d7b 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

libexec: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a pe

libexec: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


Revision tags: release/14.0.0
# eba230af 25-Sep-2023 John Baldwin <jhb@FreeBSD.org>

Purge more stray embedded $FreeBSD$ strings

These do not use __FBSDID but instead use bare char arrays.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41957


# 03a7c36d 06-Sep-2023 Konstantin Belousov <kib@FreeBSD.org>

__crt_aligned_alloc_offset(): fix ov_index for backing allocation address

Wrong value of ov_index resulted in magic check failure, and refuse to
free() the memory allocated with __crt_aligned_alloc_

__crt_aligned_alloc_offset(): fix ov_index for backing allocation address

Wrong value of ov_index resulted in magic check failure, and refuse to
free() the memory allocated with __crt_aligned_alloc_offset().
Then the TLS segments of exited threads leaked.

Reported and tested by: glebius
Fixes: c29ee08204ce4106d4992474005c5f2fb7d5fbf1
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

show more ...


# c29ee082 22-Jul-2023 Konstantin Belousov <kib@FreeBSD.org>

rtld_malloc: add __crt_aligned_alloc_offset()

It is modelled after aligned_alloc(3). Most importantly, to free the
allocation, __crt_free() can be used. Additionally, caller may specify
offset int

rtld_malloc: add __crt_aligned_alloc_offset()

It is modelled after aligned_alloc(3). Most importantly, to free the
allocation, __crt_free() can be used. Additionally, caller may specify
offset into the aligned allocation, so that we return offset-ed from
alignment pointer.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41150

show more ...


# d60130bf 25-Jul-2023 Konstantin Belousov <kib@FreeBSD.org>

rtld_malloc: increase overhead index to uint16

Reorder it with magic, to keep alignment.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://rev

rtld_malloc: increase overhead index to uint16

Reorder it with magic, to keep alignment.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41150

show more ...


# 6bb7f058 30-Jul-2023 Konstantin Belousov <kib@FreeBSD.org>

rtld_malloc.c: change return type of cp2op() to void

for it to be useful to return unaligned pointer.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision

rtld_malloc.c: change return type of cp2op() to void

for it to be useful to return unaligned pointer.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41150

show more ...


# 86c7368f 22-Jul-2023 Konstantin Belousov <kib@FreeBSD.org>

rtld_malloc: add cp2op() helper

converting user allocation address into overhead pointer

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D4

rtld_malloc: add cp2op() helper

converting user allocation address into overhead pointer

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41150

show more ...


# bc7e8610 22-Jul-2023 Konstantin Belousov <kib@FreeBSD.org>

rtld_malloc: only include internal rtld headers when building for rtld

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41150


# cf6dbdd1 22-Jul-2023 Konstantin Belousov <kib@FreeBSD.org>

rtld: remove dup __crt_malloc prototypes

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41150


# a24726a6 22-Jul-2023 Konstantin Belousov <kib@FreeBSD.org>

rtld_malloc: remove outdated comments

The ovu_magic is not neccessary overlaps with low byte of the ov_next,
for the big endian machines.

There is no range checking in the allocator.

Sponsored by:

rtld_malloc: remove outdated comments

The ovu_magic is not neccessary overlaps with low byte of the ov_next,
for the big endian machines.

There is no range checking in the allocator.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41150

show more ...


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0
# 33dba3bb 12-Oct-2021 Konstantin Belousov <kib@FreeBSD.org>

rtld-elf/paths.h: Make it usable outside rtld

but still for tightly coupled things like ldd(1)

Rename paths.h to rtld_paths.h.
Add guard for rtld-specific externs declarations.
Add _COMPAT32_BASENA

rtld-elf/paths.h: Make it usable outside rtld

but still for tightly coupled things like ldd(1)

Rename paths.h to rtld_paths.h.
Add guard for rtld-specific externs declarations.
Add _COMPAT32_BASENAME_RTLD and _COMPAT32_PATH_RTLD.

Reviewed by: arichardson, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

show more ...


# 73dddffc 15-Oct-2021 Konstantin Belousov <kib@FreeBSD.org>

crt_malloc: more accurate handling of mmap(2) failure

Reset both pagepool_start and pagepool_end after a mmap(2) failure,
to avoid using invalid pagepool either for allocation or munmap(2).

PR: 259

crt_malloc: more accurate handling of mmap(2) failure

Reset both pagepool_start and pagepool_end after a mmap(2) failure,
to avoid using invalid pagepool either for allocation or munmap(2).

PR: 259076
Noted by: Denis Koreshkov <dynamic-wind@mail.ru>
Reviewed by: arichardson
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32514

show more ...


# 19e008e7 11-Oct-2021 Konstantin Belousov <kib@FreeBSD.org>

crt_malloc: Be more persistent when handling mmap() failure

In the situation with limited address space, together with
fragmentation, it is possible for mmap() request in morecore() to fail
when ask

crt_malloc: Be more persistent when handling mmap() failure

In the situation with limited address space, together with
fragmentation, it is possible for mmap() request in morecore() to fail
when asking for required size + NPOOLPAGES, but succeed without the
addend. Retry allocation there.

PR: 259076
Reported by: Denis Koreshkov <dynamic-wind@mail.ru>
Reviewed by: arichardson
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32474

show more ...


# 0b72d296 12-Oct-2021 Konstantin Belousov <kib@FreeBSD.org>

crt_malloc: use uintptr_t instead of long for arithmetic on addresses

and avoid unneeded casts

Reviewed by: arichardson (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Dif

crt_malloc: use uintptr_t instead of long for arithmetic on addresses

and avoid unneeded casts

Reviewed by: arichardson (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32474

show more ...


Revision tags: release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0
# c5c3ba6b 03-Sep-2019 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r351317 through r351731.


# 38915409 02-Sep-2019 Brooks Davis <brooks@FreeBSD.org>

Remove remnants of optimization for > pagesize allocations.

In the past, this allocator seems to have allocated things larger than
a page seperately. Much of this code was removed at some point (per

Remove remnants of optimization for > pagesize allocations.

In the past, this allocator seems to have allocated things larger than
a page seperately. Much of this code was removed at some point (perhaps
along with sbrk() used) so remove the rest. Instead, keep allocating in
power-of-two bins up to FIRST_BUCKET_SIZE << (NBUCKETS - 1). If we want
something more efficent, we should use a fancier allocator.

While here, remove some vestages of sbrk() use. Most importantly, don't
try to page align the pagepool since it's always page aligned by mmap().

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21453

show more ...


# 98ab7906 20-Aug-2019 Brooks Davis <brooks@FreeBSD.org>

Remove some compatability with Seventh Edition UNIX realloc().

In Seventh Edition UNIX, the last pointer passed to free() was
guaranteed to not actually have been freed allowing memory to be
"compac

Remove some compatability with Seventh Edition UNIX realloc().

In Seventh Edition UNIX, the last pointer passed to free() was
guaranteed to not actually have been freed allowing memory to be
"compacted" via the following pattern:

free(foo);
foo = realloc(foo, newsize);

Further, Andrew Koenig reports in "C Traps and Pitfalls" that the
original realloc() implementation required this pattern.

The C standard is clear that this is Undefined Behavior. Modern
allocators don't support it and no portable code could rely on it so
remove this support.

Note: the removed implementation contains an off-by-one error and if
an item isn't found on the freelist, then twice as much memory as the
largest possible allocation will be copied.

Reviewed by: kib, imp
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21296

show more ...


Revision tags: release/11.3.0
# 0269ae4c 06-Jun-2019 Alan Somers <asomers@FreeBSD.org>

MFHead @348740

Sponsored by: The FreeBSD Foundation


# 3cac4083 16-May-2019 Konstantin Belousov <kib@FreeBSD.org>

rtld_malloc.c: cleanup morepages().

Use roundup2() and rounddown2() instead of inlining them.
Get rid of the fd local variable, use literal -1 for the mmap argument.
Use MAP_FAILED as mmap(2) failur

rtld_malloc.c: cleanup morepages().

Use roundup2() and rounddown2() instead of inlining them.
Get rid of the fd local variable, use literal -1 for the mmap argument.
Use MAP_FAILED as mmap(2) failure indicator.
After that, apply some style.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

show more ...


# 37f0b7f1 16-May-2019 Konstantin Belousov <kib@FreeBSD.org>

Remove more dead definitions from rtld_malloc.c after r347019.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# 7648bc9f 13-May-2019 Alan Somers <asomers@FreeBSD.org>

MFHead @347527

Sponsored by: The FreeBSD Foundation


# 5cac2021 02-May-2019 Konstantin Belousov <kib@FreeBSD.org>

Cleanup for rtld_malloc.c.

- Remove dead and most likely rotten MALLOC_DEBUG, MSTAT, and RCHECK options.
- Remove unused headers.
- Remove one case of undefined behavior where left shift could overf

Cleanup for rtld_malloc.c.

- Remove dead and most likely rotten MALLOC_DEBUG, MSTAT, and RCHECK options.
- Remove unused headers.
- Remove one case of undefined behavior where left shift could overflow.
It is impossible on practice for rtld and libthr consumer.

PR: 237577
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

show more ...


# c2c227a5 03-Feb-2019 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r343571 through r343711.


# d49ca25d 30-Jan-2019 Konstantin Belousov <kib@FreeBSD.org>

Rename rtld-elf/malloc.c to rtld-elf/rtld_malloc.c.

Then malloc.c file name is too generic to use it for libthr.a.

Sponsored by: The FreeBSD Foundation
MFC after: 13 days