otto
e06d7bccfa
use consistent style for for loop in unmap(), no functional change
6 years ago
otto
be36452872
keep in sync with ld.so malloc.c
6 years ago
jmc
b78237bf7e
word fix; from edgar pettijohn
6 years ago
otto
22e454653c
- An error in the multithreaded case could print the wrong function name
- Start with a full page of struct region_info's
- Save an mprotect in the init code: allocate 3 pages with none and
make the middle page r/w instead of a r/w allocation and two calls to make the
guard pages none
6 years ago
otto
fbdda17fd8
- do not junk pages returned by free_bytes(), all freed chunks are already
junked
- freezero(): only clear requested size
6 years ago
otto
d471572632
Zap the rotor, it was a wrong idea. Cluebat applied by kshe who
came also up with this diff. Simple, no bias and benchmarks show the extra
random calls disappear in te measurement noise.
6 years ago
otto
a1c70a667c
Move to ffs(3) for bitmask scanning. I played with this earlier,
but at that time ffs function calls were generated instead of the
compiler inlining the code. Now that ffs is marked protected in
libc this is handled better. Thanks to kshe who prompted me to
look at this again.
6 years ago
guenther
5c76f998f2
Instead of trying to handle ffs() with the normal rename-mark-hidden-and-alias
dance, mark it protected. This works better for both gcc and clang: gcc
blocks overriding of internal calls, while clang permits inlining again.
ok otto@
6 years ago
deraadt
3bfb6d03b3
Adjust references for sysctl(3) to sysctl(2)
6 years ago
otto
bb8baa37e1
optimization and some cleanup; mostly from kshe (except the unmap() part)
6 years ago
otto
58ab079478
Only init chunk_info once, plus some moving of code to group related functions.
6 years ago
otto
28aa9f8c65
step one in avoiding unneccesary init of chunk_info;
some cleanup; tested by sthen@ on a ports build
6 years ago
tedu
8b61b5765d
memcpy from the right place. at this point, the used variable is not
relevant. from Mark Karpilovskij.
ok millert
6 years ago
millert
e1517c2cb0
Fix one possible buffer overflow and one underflow. Also some minor
cleanups. From Jan Kokemueller. OK deraadt@
6 years ago
guenther
ef03f4da40
Move __cxa_thread_atexit* to its own .c file to avoid pulling the code
(w/ _dlctl reference) into static executables. It's all Mark's code so
put his preferred copyright on it.
ok kettenis@
6 years ago
kettenis
0566b09422
Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.
ok guenther@, deraadt@, jca@
7 years ago
zhuk
8d93985924
It's the imsg_compose(3) who accepts 'fd' argument, not imsg_create(3).
7 years ago
kettenis
29bb9a950c
Remove DEF_STRONG(__cxa_thread_atexit_impl). This produces an unwanted
_libc___cxa_thread_atexit_impl reference on gcc architectures that breaks
the build.
7 years ago
kettenis
901caa2734
Implement __cxa_thread_atexit to support C++11 thread_local scope. The
interface is also made available as __cxa_thread_atexit_impl to satisfy the
needs of GNU libstdc++.
ok guenther@, millert@
7 years ago
guenther
06875abb1a
clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"
to builtins like mem{set,cpy,move} and __stack_smash_handler. So, when
building with clang, instead mark those as protected visibility to get rid
of the PLT relocations. We can't take the address of them then, but that's
ok: it's a build-time error not a run-time error.
ok kettenis@
7 years ago
tb
3bd9248dcf
GNU ld has prefixed the contents of .gnu.warning.SYMBOL sections
with "warning: " since 2003, so the messages themselves need not
contain the prefix anymore.
From Scott Cheloha
ok jca, deraadt
7 years ago
otto
d5460018ef
's' should include 'f'; from Jacqueline Jolicoeur
7 years ago
millert
97fa8ef41e
Don't let close(2) clobber errno. Some calls were already protected
but not all. From Peter J. Philipp.
7 years ago
jsing
edffe314c0
Restore a return that was inadvertently removed from freezero() in r1.234,
which results in an internal double free when internal functions are not
in use.
ok otto@
7 years ago
schwarze
7fd11d9f24
Add STANDARDS: denis@ spotted that it was missing.
OK deraadt@ jca@ jmc@
7 years ago
otto
437fad2669
do not return f() where f is a void function; loop var type fix
7 years ago
otto
09620f7263
Use dprintf instead of snprintf/write
7 years ago
otto
3b6bc929b8
Make delayed free non-optional and make F do an extensive double free check.
ok tb@ tedu@
7 years ago
otto
4a127addf3
mapalign returns MAP_FAILED for failuer; from George Koehler
7 years ago
otto
d1f95e32d7
check double free before canary for chunks; ok millert@
7 years ago
schwarze
371b65730c
New POSIX xlocale implementation written from scratch.
Complete in the sense that all POSIX *locale(3) and *_l(3) functions
are included, but in OpenBSD, we of course only really care about
LC_CTYPE and we only support ASCII and UTF-8.
With important help from kettenis@, guenther@, and jca@.
Repeated testing in ports bulk builds by naddy@.
Additional testing by jca@, sebastia@, dcoppa@, and others.
OK kettenis@ dcoppa@, and guenther@ on an earlier version.
Riding guenther@'s libc/librthread major bump.
7 years ago
schwarze
909afec908
delete pointless .Tn ASCII found by jca@ with mandoc -Tlint
7 years ago
jca
74793c8931
Mention strtok_r in STANDARDS
POSIX 2001 instead of POSIX.1c suggested by millert@ and jmc@, ok jmc@
7 years ago
otto
83cbddd78e
two MALLOC_STATS only tweaks; one from David CARLIER, the other found by clang
7 years ago
guenther
f3645329ae
Use sendsyslog() directly instead of syslog_r() for the "backwards memcpy"
messages, to avoid pulling in piles of other machinery unnecessarily
problem observed by schwarze@
ok deraadt@ millert@
7 years ago
guenther
2f8ee43fe4
Minimize #includes, particularly to avoid thread_private.h
ok tedu@
7 years ago
schwarze
932461687c
add missing and correct misspelled names, most in NAME sections;
found with regress/usr.bin/mandoc/db/dbm_dump;
OK jmc@
7 years ago
jmc
2ee2396122
zap trailing whitespace;
7 years ago
tedu
bce15ce0c1
rework the page a bit, clarify a few things, maybe better wording
7 years ago
otto
131bcbfdc1
one more instance of the previous commit; also initialize ->offset to a
definite value in the size == 0 case
7 years ago
otto
4a550fa72d
Only access offset if canaries are enabled *and* size > 0, otherwise offset
is not initialized. Problem spotted by Carlin Bingham; ok phessler@ tedu@
7 years ago
millert
c212aadd9a
The 0x (or 0X) prefix in base 16 is optional so only skip over the
prefix if the character following it is a valid hex char. The C99
standard is clear that given the string "0xy" zero should be returned
and endptr set to point to the "x". OK deraadt@ espie@
7 years ago
tb
5d484dd9ea
void functions don't return 0
From Klemens Nanni
7 years ago
dlg
b4e0da4e31
port the RBT code to userland by making it part of libc.
src/lib/libc/gen/tree.c is a copy of src/sys/kern/subr_tree.c, but with
annotations for symbol visibility. changes to one should be reflected
in the other.
the malloc debug code that uses RB code is ported to RBT.
because libc provides the RBT code, procmap doesn't have to reach into
the kernel and build subr_tree.c itself now.
mild enthusiasm from many
ok guenther@
7 years ago
deraadt
d37bfa62a2
no need for branding in .Nd line
7 years ago
millert
f55fd6c814
Don't fall back to heapsort() if we would otherwise switch to
insertion sort (when the number of elements is < 7).
7 years ago
naddy
0f79902411
move sha224_initial_hash_value[] under !SHA2_SMALL; ok deraadt@ millert@
7 years ago
millert
fe11de237e
Support swapping 32-bit aligned elements on 64-bit platforms.
Previously they would be swapped a byte at a time when sizeof(int)
!= sizeof(long). Idea from FreeBSD.
7 years ago
millert
2476875a0e
Document that qsort falls back to heapsort() if the recursion depth
exceeds 2 lg N and add a reference to the introsort paper.
7 years ago
millert
e83742917d
Use David Musser's introsort algorithm to fall back to heapsort(3)
when the recursion depth reaches 2*lg(n + 1). This avoids quicksort's
quadratic behavior for pathological input without appreciably
changing the average run time.
7 years ago