git: b0e0b4e7b379 - main - Enforce that vdso does not consume too much from the shared page

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 06 Dec 2021 18:48:28 UTC
The branch main has been updated by kib:

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

commit b0e0b4e7b3795e9beb0cddcfd75261cc9327b5b0
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-11-18 01:20:08 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-12-06 18:47:30 +0000

    Enforce that vdso does not consume too much from the shared page
    
    Reviewed by:    emaste
    Discussed with: jrtc27
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 month
    Differential revision:  https://reviews.freebsd.org/D32960
---
 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 \