schwarze
2c7f023e4f
remove a stray line accidentally left behind in rev. 1.120;
patch from Hiltjo Posthuma <hiltjo at codemadness dot org>
5 years ago
otto
bb2903ad65
Refactor "find the right pool" code into a function. ok djm@ tb@
5 years ago
jmc
a53bba0f97
fold the contents of malloc.conf.5 into malloc.3 and sysctl.2,
now that there is essentially no malloc.conf;
text tweaked by deraadt; ok otto deraadt
5 years ago
otto
1bb7064e52
Introducing malloc_usable_size() was a mistake. While some other
libs have it, it is a function that is considered harmful, so:
Delete malloc_usable_size(). It is a function that blurs the line
between malloc managed memory and application managed memory and
exposes some of the internal workings of malloc. If an application
relies on that, it is likely to break using another implementation
of malloc. If you want usable size x, just allocate x bytes. ok
deraadt@ and other devs
5 years ago
deraadt
cc1a839b83
Saw a mention somewhere a while back that the gotdata() function in
here could creates non-uniformity since very short fetches of 0 would
be excluded. blocks of 0 are just as random as any other data, including
blocks of 4 4 4.. This is a misguided attempt to identify errors from the
entropy churn/gather code doesn't make sense, errors don't happen.
ok bcook
5 years ago
guenther
c0572c7336
Fix compilation on alpha, where DEF_WEAK() really must be paired with
PROTO_NORMAL(). Problem noted by deraadt@
5 years ago
otto
ed5636e718
Implement malloc_usable_size(); ok millert@ deraadt@ and jmc@ for the man page
5 years ago
otto
0f57426e31
zap last remains of malloc.conf; prompted by and ok jmc@
5 years ago
otto
d64a9a14b6
rm FILES section; prompted by Janne Johansson
5 years ago
otto
da41229758
Use the new vm.malloc_conf sysctl; ok millert@ deraadt@
5 years ago
otto
e4341e950b
Implement C11's aligned_alloc(3). ok guenther@
5 years ago
martijn
085b73b968
As per POSIX, when str{,r}chr is comparing it should convert c to a char.
The C implementation of str{,r}chr are not linked to the build, because
assembly implementations are used, but change to code for easier reference.
At least the i386 and amd64 are checked and seem to do the correct thing.
Found thanks to the csh any/strchr change.
minor pointers and OK millert@
5 years ago
jmc
c1931faa11
explicitly mention local processes; from geoff hill
ok nicm
5 years ago
deraadt
68d7aa0670
delete volatile intended to silence whiny old compilers around vfork.
This variable is only used in the parent context so there is no issue.
ok kettenis
5 years ago
djm
468ab01728
constrain fractional part to [0-9] (less confusing to static analysis); ok ian@
6 years ago
denis
f814382efe
Add a missing header when compiling with -DDEBUG
With advice from jca@
OK jca@ millert@
6 years ago
otto
dbc5faf4ac
sys/uio.h is not used anymore
6 years ago
otto
79b103c901
fix MALLOC_STATS; spotted by and ok semarie@
6 years ago
bcook
becf8cef00
ensure SYS_getrandom and GRND_NONBLOCK are both defined before using getrandom(2)
Based on discussion here https://github.com/libressl-portable/openbsd/pull/82
Suggested fix from jsing@
6 years ago
deraadt
d6aeb76165
use _ALIGN() which is uhm a bit OpenBSD-specific, but it means we
don't need to use sys/param.h at all, guess which one i believe is
greater namespace polution
ok otto
6 years ago
deraadt
02c2718077
Use _MAX_PAGE_SHIFT, rather than #ifdef mips64
ok guenther kettenis
6 years ago
nicm
2c571a29e6
Fix function argument names, from Abel Abraham Camarillo Ojeda via jmc@.
6 years ago
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@
6 years ago
zhuk
8d93985924
It's the imsg_compose(3) who accepts 'fd' argument, not imsg_create(3).
6 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.
6 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@
6 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@
6 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
6 years ago
otto
d5460018ef
's' should include 'f'; from Jacqueline Jolicoeur
6 years ago
millert
97fa8ef41e
Don't let close(2) clobber errno. Some calls were already protected
but not all. From Peter J. Philipp.
6 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@
6 years ago
schwarze
7fd11d9f24
Add STANDARDS: denis@ spotted that it was missing.
OK deraadt@ jca@ jmc@
6 years ago
otto
437fad2669
do not return f() where f is a void function; loop var type fix
6 years ago
otto
09620f7263
Use dprintf instead of snprintf/write
6 years ago
otto
3b6bc929b8
Make delayed free non-optional and make F do an extensive double free check.
ok tb@ tedu@
6 years ago