freebsd-dev/libexec/rtld-elf
Jessica Clarke becd9908be rtld-elf: Fix leaks and wild frees in origin_subst
55abf23dd3 inverted the value passed to origin_subst_one when rolling
up the existing code into a loop. If the first token is found ($ORIGIN),
this results in a wild free of part of strtab. Processing the second
token works fine and will act how the first should have regardless of
whether found, allocating memory for the string without freeing.
Processing subsequent tokens however will then leak, regardless of
whether found, as they will also believe they need to allocate memory
and can't free the string.

Found by:	CHERI
Reviewed by:	kib, markj
Fixes:		55abf23dd3 ("rtld: make token substitution table-driven")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D35792
2022-07-12 17:47:47 +01:00
..
aarch64 TLS: Use <machine/tls.h> for libc and rtld. 2021-12-09 13:23:05 -08:00
amd64 TLS: Use <machine/tls.h> for libc and rtld. 2021-12-09 13:23:05 -08:00
arm rtld-elf: Remove libsoft support 2022-01-06 22:44:07 -07:00
i386 TLS: Use <machine/tls.h> for libc and rtld. 2021-12-09 13:23:05 -08:00
powerpc TLS: Use <machine/tls.h> for libc and rtld. 2021-12-09 13:23:05 -08:00
powerpc64 TLS: Use <machine/tls.h> for libc and rtld. 2021-12-09 13:23:05 -08:00
riscv TLS: Use <machine/tls.h> for libc and rtld. 2021-12-09 13:23:05 -08:00
rtld-libc Have rtld query the page size from the kernel 2022-04-07 15:37:37 +01:00
tests rtld/tests: Avoid function name conflict with libc opendir() 2021-07-06 10:51:57 +01:00
debug.c libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
debug.h Use rtld_putstr() instead of write() for the rtld msg() macro 2019-06-26 15:43:26 +00:00
libmap.c rtld-elf/paths.h: Make it usable outside rtld 2021-10-21 03:08:54 +03:00
libmap.conf Move libmap.conf to libexec/rtld-elf/ 2018-09-18 00:25:00 +00:00
libmap.h rtld: constify most variables holding references to the environment values 2021-08-17 15:06:08 +03:00
Makefile rtld: Do not install libmap.conf when installing the COMPAT32 version 2021-10-13 14:42:08 +02:00
Makefile.depend
map_object.c Have rtld query the page size from the kernel 2022-04-07 15:37:37 +01:00
rtld_lock.c rtld: initialize default dlerror_seen_val as true 2021-05-13 02:31:29 +03:00
rtld_lock.h rtld_lock.h: add some comments about versioning of struct RtldLockInfo 2021-04-11 11:16:13 +03:00
rtld_malloc.c rtld-elf/paths.h: Make it usable outside rtld 2021-10-21 03:08:54 +03:00
rtld_malloc.h Add header file missed in r343564. 2019-01-29 22:45:24 +00:00
rtld_paths.h rtld-elf: Remove libsoft support 2022-01-06 22:44:07 -07:00
rtld_printf.c rtld: add rtld_fdprintfx() 2021-11-13 19:33:13 +02:00
rtld_printf.h rtld: add rtld_fdprintfx() 2021-11-13 19:33:13 +02:00
rtld_tls.h Remove sparc64 specific parts of rtld-elf. 2020-02-26 18:49:25 +00:00
rtld_utrace.h Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
rtld.1 rtld.1: Fix misplaced text 2022-02-25 11:16:35 -05:00
rtld.c rtld-elf: Fix leaks and wild frees in origin_subst 2022-07-12 17:47:47 +01:00
rtld.h Have rtld query the page size from the kernel 2022-04-07 15:37:37 +01:00
Symbol.map rtld dl_iterate_phdr(): dlpi_tls_data is wrong 2021-04-06 03:23:08 +03:00
xmalloc.c Make p_vaddr % p_align == p_offset % p_align for (some) TLS segments. 2020-04-04 22:37:50 +00:00