summaryrefslogtreecommitdiffstats
path: root/core/includes
diff options
context:
space:
mode:
authorSimon Rettberg2022-12-12 14:39:43 +0100
committerSimon Rettberg2022-12-12 14:39:43 +0100
commit7f8ab242890b24eddac876d7489462c0e6902a9b (patch)
treedd5dc90f9493fa589afb55bdb829e8d15774018a /core/includes
parent[slx-issue] Fix math for overlong strings (diff)
downloadmltk-7f8ab242890b24eddac876d7489462c0e6902a9b.tar.gz
mltk-7f8ab242890b24eddac876d7489462c0e6902a9b.tar.xz
mltk-7f8ab242890b24eddac876d7489462c0e6902a9b.zip
[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.
Diffstat (limited to 'core/includes')
-rw-r--r--core/includes/chroot.inc15
1 files changed, 15 insertions, 0 deletions
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 <unistd.h>
+ 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"