What you need to run Haskell in prison

I want to run a simple Haskell program from a closed environment that I create myself. The following Haskell program I want to run is:

import System.IO

main = do
    hPutStrLn stderr "test standard error!"
    hPutStrLn stdout "test standard out!"

It just prints a string to stderr and stdout, works great outside of prison. The code compiles as follows:

ghc -O2 --make -static -optc-static -optl-static $MAINHS -optl-pthread -o bin/run_ai

I get the run_ai executable that runs the program, as I said, this works great outside the prison. Below is the material that is put in jail, and I think that something is missing there, because when I run the program in jail, it does absolutely nothing, it does not even exit, and error / output dumps are not set at all.

mkdir -p lib64 lib bin

cp /bin/sh bin/

# Binaries
cp /lib64/ld-linux-x86-64.so.2 lib64/

cp /lib/x86_64-linux-gnu/libpthread.so.0 lib/
cp /lib/x86_64-linux-gnu/libc.so.6 lib/
cp /lib/x86_64-linux-gnu/libdl.so.2 lib/
cp /lib/x86_64-linux-gnu/librt.so.1 lib/
cp /lib/x86_64-linux-gnu/libm.so.6 lib/
cp /lib/x86_64-linux-gnu/libtinfo.so.5 lib/
cp /lib/x86_64-linux-gnu/libutil.so.1 lib/
cp /usr/lib/x86_64-linux-gnu/libffi.so.6 lib/
cp /usr/lib/x86_64-linux-gnu/libgmp.so.10 lib/
cp /usr/lib/libgmp.so.3 lib/

, , , Haskell , , . , Haskell, . -, Haskell?

, : /- ?

+4
1

strace -e

, .

+3

All Articles