git: 4d0b07d001a5 - stable/13 - Enforce that vdso does not consume too much from the shared page

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 02 Jan 2022 19:08:19 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=4d0b07d001a55cde50797f3e462a9c32826a028e

commit 4d0b07d001a55cde50797f3e462a9c32826a028e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-11-18 01:20:08 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-01-02 16:43:01 +0000

    Enforce that vdso does not consume too much from the shared page
    
    (cherry picked from commit b0e0b4e7b3795e9beb0cddcfd75261cc9327b5b0)
---
 sys/tools/amd64_ia32_vdso.sh | 6 ++++++
 sys/tools/amd64_vdso.sh      | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/sys/tools/amd64_ia32_vdso.sh b/sys/tools/amd64_ia32_vdso.sh
index 15ad866b4471..7ef630dbaac5 100644
--- a/sys/tools/amd64_ia32_vdso.sh
+++ b/sys/tools/amd64_ia32_vdso.sh
@@ -40,6 +40,12 @@ ${LD} --shared -Bsymbolic -soname="elf-vdso32.so.1" \
    --hash-style=sysv --fatal-warnings --strip-all \
    -o elf-vdso32.so.1 ia32_sigtramp.pico
 
+if [ "$(wc -c elf-vdso32.so.1 | ${AWK} '{print $1}')" -gt 2048 ]
+then
+    echo "elf-vdso32.so.1 too large" 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 6a4111ffabc8..0bb351192407 100644
--- a/sys/tools/amd64_vdso.sh
+++ b/sys/tools/amd64_vdso.sh
@@ -49,6 +49,12 @@ ${LD} --shared -Bsymbolic -soname="elf-vdso.so.1" \
    --hash-style=sysv --fatal-warnings --strip-all \
    -o elf-vdso.so.1 sigtramp.pico
 
+if [ "$(wc -c elf-vdso.so.1 | ${AWK} '{print $1}')" -gt 2048 ]
+then
+    echo "elf-vdso.so.1 too large" 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 \