freebsd-dev/libexec/rtld-elf
Ed Maste 29e3a06510 rtld: fix SysV hash function overflow
Quoting from https://maskray.me/blog/2023-04-12-elf-hash-function:

The System V Application Binary Interface (generic ABI) specifies the
ELF object file format. When producing an output executable or shared
object needing a dynamic symbol table (.dynsym), a linker generates a
.hash section with type SHT_HASH to hold a symbol hash table. A DT_HASH
tag is produced to hold the address of .hash.

The function is supposed to return a value no larger than 0x0fffffff.
Unfortunately, there is a bug. When unsigned long consists of more than
32 bits, the return value may be larger than UINT32_MAX. For instance,
elf_hash((const unsigned char *)"\xff\x0f\x0f\x0f\x0f\x0f\x12") returns
0x100000002, which is clearly unintended, as the function should behave
the same way regardless of whether long represents a 32-bit integer or
a 64-bit integer.

Reviewed by:	kib, Fangrui Song
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39517
2023-04-12 12:44:34 -04:00
..
aarch64 rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call" 2023-01-04 14:55:00 -08:00
amd64 sys/param.h: Add _WANT_P_OSREL 2023-02-15 02:43:18 +02:00
arm rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call" 2023-01-04 14:55:00 -08:00
i386 rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call" 2023-01-04 14:55:00 -08:00
powerpc rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call" 2023-01-04 14:55:00 -08:00
powerpc64 rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call" 2023-01-04 14:55:00 -08:00
riscv rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call" 2023-01-04 14:55:00 -08:00
rtld-libc Have rtld query the page size from the kernel 2022-04-07 15:37:37 +01:00
tests
debug.c
debug.h
libmap.c rtld: fix typo in comment 2022-10-17 17:10:03 +03:00
libmap.conf
libmap.h rtld-elf/libmap.h: style declarations 2022-09-19 01:49:41 +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 sys/param.h: Add _WANT_P_OSREL 2023-02-15 02:43:18 +02:00
rtld_lock.c rtld: style the rest of rtld_lock.c 2022-09-04 07:28:02 +03:00
rtld_lock.h
rtld_malloc.c rtld-elf/paths.h: Make it usable outside rtld 2021-10-21 03:08:54 +03:00
rtld_malloc.h
rtld_paths.h libcasper: Move helper libraries from /lib/casper to /lib. 2023-03-29 15:04:28 -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
rtld_utrace.h
rtld.1 rtld: add support for the $LIB token 2022-11-11 12:06:30 +02:00
rtld.c rtld: fix SysV hash function overflow 2023-04-12 12:44:34 -04:00
rtld.h rtld: fix SysV hash function overflow 2023-04-12 12:44:34 -04:00
Symbol.map
xmalloc.c