ioi / isolate

Sandbox for securely executing untrusted programs
Other
1.04k stars 154 forks source link

Problem compiling cg2 branch code #128

Closed sairamkumar-zessta closed 1 year ago

sairamkumar-zessta commented 1 year ago

Steps i am following to use cg2 branch

  1. Installing the required dependencies - libcap-dev and libsystemd-dev and then moving into the isolate directory and doing make install

gcc -o isolate-cg-keeper isolate-cg-keeper.o config.o util.o /usr/bin/ld: isolate-cg-keeper.o: in function main': isolate-cg-keeper.c:(.text+0x65e): undefined reference tosd_notify' collect2: error: ld returned 1 exit status make: *** [Makefile:35: isolate-cg-keeper] Error 1

gollux commented 1 year ago

Are you sure that make does not print any error messages above?

sairamkumar-zessta commented 1 year ago

Are you sure that make does not print any error messages above? We are trying to run the isolate from the docker file with the below command and when we are building a image we are getting the below issue RUN apt-get update && apt-get install -y git make build-essential libcap-dev libsystemd-dev && git clone --branch cg2 https://github.com/ioi/isolate.git && cd ./isolate && make install

#0 22.94 Cloning into 'isolate'...
#0 24.06 make: pkg-config: No such file or directory
#0 24.06 make: pkg-config: No such file or directory
#0 24.06 gcc -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-unused-result -Wno-missing-field-initializers -Wstrict-prototypes -Wmissing-prototypes -D_GNU_SOURCE -DVERSION='"1.10.1"' -DYEAR='"2023"' -DBUILD_DATE='"2023-06-26"' -DBUILD_COMMIT='"v1.10.1-27-g11e4313"' -c -o isolate.o isolate.c
#0 24.13 gcc -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-unused-result -Wno-missing-field-initializers -Wstrict-prototypes -Wmissing-prototypes -D_GNU_SOURCE -c -o util.o util.c
#0 24.17 gcc -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-unused-result -Wno-missing-field-initializers -Wstrict-prototypes -Wmissing-prototypes -D_GNU_SOURCE -c -o rules.o rules.c
#0 24.20 gcc -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-unused-result -Wno-missing-field-initializers -Wstrict-prototypes -Wmissing-prototypes -D_GNU_SOURCE -c -o cg.o cg.c
#0 24.23 gcc -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-unused-result -Wno-missing-field-initializers -Wstrict-prototypes -Wmissing-prototypes -D_GNU_SOURCE -DCONFIG_FILE='"/usr/local/etc/isolate"' -c -o config.o config.c
#0 24.26 gcc  -o isolate isolate.o util.o rules.o cg.o config.o -lcap
#0 24.27 gcc -std=gnu99 -Wall -Wextra -Wno-parentheses -Wno-unused-result -Wno-missing-field-initializers -Wstrict-prototypes -Wmissing-prototypes -D_GNU_SOURCE  -c -o isolate-cg-keeper.o isolate-cg-keeper.c
#0 24.30 gcc  -o isolate-cg-keeper isolate-cg-keeper.o config.o util.o 
#0 24.31 /usr/bin/ld: isolate-cg-keeper.o: in function `main':
#0 24.31 isolate-cg-keeper.c:(.text+0x583): undefined reference to `sd_notify'
#0 24.31 collect2: error: ld returned 1 exit status
#0 24.31 make: *** [Makefile:35: isolate-cg-keeper] Error 1
------
ERROR: failed to solve: executor failed running [/bin/sh -c apt-get update && apt-get install -y git make build-essential libcap-dev libsystemd-dev  && git clone --branch cg2 https://github.com/ioi/isolate.git && cd ./isolate && make install]: exit code: 2
gollux commented 1 year ago

This is the culprit: #0 24.06 make: pkg-config: No such file or directory

You are missing pkg-config.

sourav-zessta commented 1 year ago

This is the culprit: #0 24.06 make: pkg-config: No such file or directory

You are missing pkg-config.

We are facing this issue when we are switching to cg2 version.

Previously we have worked with cg1 version the above docker run command worked fine with the master branch and we have not faced this missing pkg-config error.

sourav-zessta commented 1 year ago

This is the culprit: #0 24.06 make: pkg-config: No such file or directory

You are missing pkg-config.

We are facing this issue when we are switching to cg2 version.

Previously we have worked with cg1 version the above docker run command worked fine.

Can you please help us with the setup of cg2 , like what are the steps we have to follow @gollux

sadfun commented 1 year ago

Just apt-get install pkg-config?

sairamkumar-zessta commented 1 year ago

Thank you for the suggestion provided earlier. I was able to successfully build the image using the docker run command: RUN apt-get update && apt-get install -y git make build-essential libcap-dev libsystemd-dev pkg-config && git clone --branch cg2 https://github.com/ioi/isolate.git && cd ./isolate && make install However, I encountered an issue while attempting to create a sandbox using the command: isolate --cg --init --box-id=600 The error message I received was: Cannot open /run/isolate/cgroup: No such file or directory

gollux commented 1 year ago

You have to start the isolate.service via systemd first.

Sorry, there is not much documentation in the cg2 branch yet.

sairamkumar-zessta commented 1 year ago

You have to start the isolate.service via systemd first.

Sorry, there is not much documentation in the cg2 branch yet.

Thank you for your support.