summaryrefslogtreecommitdiffstats
path: root/core/includes/chroot.inc
diff options
context:
space:
mode:
Diffstat (limited to 'core/includes/chroot.inc')
-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"