From 7f8ab242890b24eddac876d7489462c0e6902a9b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 12 Dec 2022 14:39:43 +0100 Subject: [chroot] Add preload lib crap for close_range For some reason in our chroot we get a permission denied for close_range calls, which breaks the vmware 17 installer. Add a shim that falls back to close instead. --- core/includes/chroot.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'core/includes') diff --git a/core/includes/chroot.inc b/core/includes/chroot.inc index 334cc094..7856fd19 100644 --- a/core/includes/chroot.inc +++ b/core/includes/chroot.inc @@ -146,9 +146,24 @@ chroot_gen_autoexec() { # system environment! # # # ####################################################### + export LD_PRELOAD=/bla.so echo "chroot started successfully." EOF + # Preload bullshit for close_range + gcc -xc - -o "${CHROOT_MOUNTDIR}/bla.so" -shared <<-PUFF + #include + int close_range(unsigned int a, unsigned int b, int c) + { + if (b - a > 1000) b = a + 1000; + for (unsigned int i = a; i < b; ++i) { + close(i); + } + return 0; + } + PUFF + [ -s "${CHROOT_MOUNTDIR}/bla.so" ] || exit 12 + # dump the piped input to it cat >> "${CHROOT_MOUNTDIR}/autoexec.bat" -- cgit v1.2.3-55-g7522