diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2019-06-19 12:20:47 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2019-06-21 13:04:02 +0100 |
commit | 65365aa856e5a258329dc350b02bbb51f84b4c16 (patch) | |
tree | 41b87c9af496cfda18bb854e3166f3ca002a080d /config.sub | |
parent | 24865428034f44d9fffe6b2d9a318e1bd507c63a (diff) | |
download | gdb-65365aa856e5a258329dc350b02bbb51f84b4c16.zip gdb-65365aa856e5a258329dc350b02bbb51f84b4c16.tar.gz gdb-65365aa856e5a258329dc350b02bbb51f84b4c16.tar.bz2 |
libctf: drop mmap()-based CTF data allocator
This allocator has the ostensible benefit that it lets us mprotect() the
memory used for CTF storage: but in exchange for this it adds
considerable complexity, since we have to track allocation sizes
ourselves for use at freeing time, note whether the data we are storing
was ctf_data_alloc()ed or not so we know if we can safely mprotect()
it... and while the mprotect()ing has found few bugs, it *has* been the
cause of more than one due to errors in all this tracking leading to us
mprotect()ing bits of the heap and stuff like that.
We are about to start composing CTF buffers from pieces so that we can
do usage-based optimizations on the strtab. This means we need
realloc(), which needs nonportable mremap() and *more* tracking of the
*original* allocation size, and the complexity and bureaucracy of all of
this is just too high for its negligible benefits.
Drop the whole thing and just use malloc() like everyone else. It knows
better than we do when it is safe to use mmap() under the covers,
anyway.
While we're at it, don't leak the entire buffer if ctf_compress_write()
fails to compress it.
libctf/
* ctf-subr.c (_PAGESIZE): Remove.
(ctf_data_alloc): Likewise.
(ctf_data_free): Likewise.
(ctf_data_protect): Likewise.
* ctf-impl.h: Remove declarations.
* ctf-create.c (ctf_update): No longer call ctf_data_protect: use
ctf_free, not ctf_data_free.
(ctf_compress_write): Use ctf_data_alloc, not ctf_alloc. Free
the buffer again on compression error.
* ctf-open.c (ctf_set_base): No longer track the size: call
ctf_free, not ctf_data_free.
(upgrade_types): Likewise. Call ctf_alloc, not ctf_data_alloc.
(ctf_bufopen): Likewise. No longer call ctf_data_protect.
Diffstat (limited to 'config.sub')
0 files changed, 0 insertions, 0 deletions