git: 75d7ca8a10a5 - stable/13 - Enforce that vdso does not contain runtime relocations
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 02 Jan 2022 19:08:20 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=75d7ca8a10a5a15b70a35a628a06ceef8cdf9e78
commit 75d7ca8a10a5a15b70a35a628a06ceef8cdf9e78
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-12-01 00:35:26 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-01-02 16:43:02 +0000
Enforce that vdso does not contain runtime relocations
(cherry picked from commit d49b75d0d67f86265cfe9b8c83d3749c4a8d3e14)
---
sys/conf/files.amd64 | 4 ++--
sys/tools/amd64_ia32_vdso.sh | 7 +++++++
sys/tools/amd64_vdso.sh | 7 +++++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index 48ca59089ca1..9eed2470c720 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -14,13 +14,13 @@ include "conf/files.x86"
#
elf-vdso.so.o standard \
dependency "$S/amd64/amd64/sigtramp.S assym.inc $S/tools/amd64_vdso.sh" \
- compile-with "env AWK='${AWK}' NM='${NM}' LD='${LD}' CC='${CC}' OBJCOPY='${OBJCOPY}' S='${S}' sh $S/tools/amd64_vdso.sh" \
+ compile-with "env AWK='${AWK}' NM='${NM}' LD='${LD}' CC='${CC}' OBJCOPY='${OBJCOPY}' ELFDUMP='${ELFDUMP}' S='${S}' sh $S/tools/amd64_vdso.sh" \
no-implicit-rule before-depend \
clean "elf-vdso.so.o elf-vdso.so.1 vdso_offsets.h sigtramp.pico"
#
elf-vdso32.so.o optional compat_freebsd32 \
dependency "$S/amd64/ia32/ia32_sigtramp.S ia32_assym.h $S/tools/amd64_ia32_vdso.sh" \
- compile-with "env AWK='${AWK}' NM='${NM}' LD='${LD}' CC='${CC}' OBJCOPY='${OBJCOPY}' S='${S}' sh $S/tools/amd64_ia32_vdso.sh" \
+ compile-with "env AWK='${AWK}' NM='${NM}' LD='${LD}' CC='${CC}' OBJCOPY='${OBJCOPY}' ELFDUMP='${ELFDUMP}' S='${S}' sh $S/tools/amd64_ia32_vdso.sh" \
no-implicit-rule before-depend \
clean "elf-vdso32.so.o elf-vdso32.so.1 vdso_ia32_offsets.h ia32_sigtramp.pico"
#
diff --git a/sys/tools/amd64_ia32_vdso.sh b/sys/tools/amd64_ia32_vdso.sh
index 7ef630dbaac5..d03249dd4940 100644
--- a/sys/tools/amd64_ia32_vdso.sh
+++ b/sys/tools/amd64_ia32_vdso.sh
@@ -46,6 +46,13 @@ then
exit 1
fi
+if [ -n "$(${ELFDUMP} -d elf-vdso32.so.1 | \
+ ${AWK} '/DT_REL.*SZ/{print "RELOCS"}')" ]
+then
+ echo "elf-vdso32.so.1 contains runtime relocations" 1>&2
+ exit 1
+fi
+
${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
-o elf-vdso32.so.o -I. -I"${S}" -include opt_global.h \
-DVDSO_NAME=elf_vdso32_so_1 -DVDSO_FILE=elf-vdso32.so.1 \
diff --git a/sys/tools/amd64_vdso.sh b/sys/tools/amd64_vdso.sh
index 0bb351192407..8b9871e86802 100644
--- a/sys/tools/amd64_vdso.sh
+++ b/sys/tools/amd64_vdso.sh
@@ -55,6 +55,13 @@ then
exit 1
fi
+if [ -n "$(${ELFDUMP} -d elf-vdso.so.1 | \
+ ${AWK} '/DT_REL.*SZ/{print "RELOCS"}')" ]
+then
+ echo "elf-vdso.so.1 contains runtime relocations" 1>&2
+ exit 1
+fi
+
${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
-o elf-vdso.so.o -I. -I"${S}" -include opt_global.h \
-DVDSO_NAME=elf_vdso_so_1 -DVDSO_FILE=elf-vdso.so.1 \