git: 5db5c6c87a75 - main - rtld: use generated map file to check for some leaks from libc into rtld
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Feb 2024 01:54:48 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=5db5c6c87a75f8b1871f021726fc4697253ae5cf
commit 5db5c6c87a75f8b1871f021726fc4697253ae5cf
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-02-28 23:40:41 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-29 01:49:02 +0000
rtld: use generated map file to check for some leaks from libc into rtld
Reviewed by: brooks, emaste (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44136
---
libexec/rtld-elf/Makefile | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index cc40b839024f..37c3840538d5 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -79,6 +79,25 @@ MAPFILE= ld-elf.so.1.map
LDFLAGS+= -Wl,-Map=${MAPFILE} -Wl,--cref
CLEANFILES+= ${MAPFILE}
+afterbuild:
+ @if grep __libsys_interposing ${MAPFILE} >/dev/null ; then \
+ echo "libsys_interposing leaked" 1>&2 ; \
+ exit 1 ; \
+ fi
+ @if grep __libc_interposing ${MAPFILE} >/dev/null ; then \
+ echo "libc_interposing leaked" 1>&2 ; \
+ exit 1 ; \
+ fi
+ @if grep xlocale ${MAPFILE} >/dev/null ; then \
+ echo "xlocale leaked" 1>&2 ; \
+ exit 1 ; \
+ fi
+ @if grep fprintf ${MAPFILE} >/dev/null ; then \
+ echo "stdio leaked" 1>&2 ; \
+ exit 1 ; \
+ fi
+
+
# Since moving rtld-elf to /libexec, we need to create a symlink.
# Fixup the existing binary that's there so we can symlink over it.
beforeinstall: