Comments (19)
Thanks for reporting.
Yes, I met the same problem in Ubuntu 11.04 just now. I will debug it in two days or more later.
I guess the problem may be inside the libsandbox. If so, it is not easy to handle. But I will try.
from moodle-local_onlinejudge.
Hi,
Can you help me to test the latest code and report the result? It maybe fixed this bug. Thanks
from moodle-local_onlinejudge.
I all works OK by now! I've made a few changes to the default permission on policy.c because if not the tests wouldn't run OK (I think it was the write permission or so). I've tested it with simple programs and all seem to be working just OK!
Thank you very much.
from moodle-local_onlinejudge.
Thank you for testing and report.
PS. I just fixed another important bug, don't forget to update.
from moodle-local_onlinejudge.
when I compling the local sandbox environment in an CentOS 5.5 (x86) in a virtual machine, The make tries to run the runtest.sh, show 错误 2. Why could it happen?
Detecting syscalls...
INIT_SYSCALLS: 122, 45, 45, 243, 45, 45,
ALLOWED_SYSCALLS: 197, 54, 192, 3, 45, 91, 125,
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -I ./libsandbox/src -c policy.c
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -D POLICY3 -I ./libsandbox/src -o sand sand.o policy.o ./libsandbox/libsandbox.a
./runtest.sh 1 stdin_test < /dev/null
make: *** [stdin] 错误 2
from moodle-local_onlinejudge.
Could you follow the FAQ at https://github.com/hit-moodle/moodle-local_onlinejudge/wiki and post outputs here? Thanks
from moodle-local_onlinejudge.
I followed the FAQ at https://github.com/hit-moodle/moodle-local_onlinejudge/wiki.
Outputs:
[root@sei sand]# uname -a
Linux sei.edu.cn 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 i686 i386 GNU/Linux
[root@sei sand]# cc -v
使用内建 specs。
目标:i386-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
线程模型:posix
gcc 版本 4.1.2 20080704 (Red Hat 4.1.2-50)
[root@sei sand]# make clean
make -C libsandbox clean
make[1]: Entering directory /var/www/html/moodle/local/onlinejudge/judge/sandbox/sand/libsandbox' rm -rf doc rm -f src/platform.o src/sandbox.o src/symbols.o libsandbox.a libsandbox.so \ libsandbox.so.0.2.17 make[1]: Leaving directory
/var/www/html/moodle/local/onlinejudge/judge/sandbox/sand/libsandbox'
rm -f _.o *test detector 223 policy.c
rm -f sand
[root@sei sand]# make
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 --static -o stdin_test testcase/stdin.c
make -C libsandbox libsandbox.a
make[1]: Entering directory /var/www/html/moodle/local/onlinejudge/judge/sandbox/sand/libsandbox' cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -shared -fPIC -pthread -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITH_NATIVE_MONITOR -D WITHOUT_TSC_COUNTER -I src -c -o src/platform.o src/platform.c cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -shared -fPIC -pthread -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITH_NATIVE_MONITOR -D WITHOUT_TSC_COUNTER -I src -c -o src/sandbox.o src/sandbox.c src/sandbox.c: In function ‘__sandbox_tracer’: src/sandbox.c:1030: 警告:标号 ‘next’ 定义后未使用 cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -shared -fPIC -pthread -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITH_NATIVE_MONITOR -D WITHOUT_TSC_COUNTER -I src -c -o src/symbols.o src/symbols.c ar rcvs libsandbox.a src/platform.o src/sandbox.o src/symbols.o a - src/platform.o a - src/sandbox.o a - src/symbols.o make[1]: Leaving directory
/var/www/html/moodle/local/onlinejudge/judge/sandbox/sand/libsandbox'
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -I ./libsandbox/src -c policy_print.c
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -I ./libsandbox/src -c sand.c
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -I ./libsandbox/src -o detector sand.o policy_print.o ./libsandbox/libsandbox.a
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 --static -o 223 223.c
./detect.sh
Detecting syscalls...
INIT_SYSCALLS: 122, 45, 45, 243, 45, 45,
ALLOWED_SYSCALLS: 197, 54, 192, 3, 45, 91, 125,
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -I ./libsandbox/src -c policy.c
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -D POLICY3 -I ./libsandbox/src -o sand sand.o policy.o ./libsandbox/libsandbox.a
./runtest.sh 1 stdin_test < /dev/null
make: ** [stdin] 错误 2
from moodle-local_onlinejudge.
Could you run strace ./stdin_test
and post the output?
from moodle-local_onlinejudge.
OK, it output:
[root@sei sand]# strace ./stdin_test
execve("./stdin_test", ["./stdin_test"], [/* 38 vars */]) = 0
uname({sys="Linux", node="sei.ynu.edu.cn", ...}) = 0
brk(0) = 0x8c93000
brk(0x8c93cb0) = 0x8c93cb0
set_thread_area({entry_number:-1 -> 6, base_addr:0x8c93830, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
brk(0x8cb4cb0) = 0x8cb4cb0
brk(0x8cb5000) = 0x8cb5000
fstat64(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 6), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f79000
read(0,
"\n", 4096) = 1
read(0,
"\n", 4096) = 1
read(0,
"\n", 4096) = 1
read(0,
"\n", 4096) = 1
read(0, 0xb7f79000, 4096) = ? ERESTARTSYS (To be restarted)
[root@sei sand]#
from moodle-local_onlinejudge.
Did you break the program by ctrl+c? Use ctrl+D instead pls.
from moodle-local_onlinejudge.
Yes, I do. Try ctrl+D, Outputs are:
[root@sei sand]# strace ./stdin_test
execve("./stdin_test", ["./stdin_test"], [/* 38 vars */]) = 0
uname({sys="Linux", node="sei.ynu.edu.cn", ...}) = 0
brk(0) = 0x80e6000
brk(0x80e6cb0) = 0x80e6cb0
set_thread_area({entry_number:-1 -> 6, base_addr:0x80e6830, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
brk(0x8107cb0) = 0x8107cb0
brk(0x8108000) = 0x8108000
fstat64(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 6), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f76000
read(0, "", 4096) = 0
exit_group(0) = ?
from moodle-local_onlinejudge.
Then try this:
make policy.c
./detector -l memory=2000000000 223 < /dev/null
echo $?
from moodle-local_onlinejudge.
[root@sei sand]# make policy.c
make -C libsandbox libsandbox.a
make[1]: Entering directory /var/www/html/moodle/local/onlinejudge/judge/sandbox/sand/libsandbox' cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -shared -fPIC -pthread -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITH_NATIVE_MONITOR -D WITHOUT_TSC_COUNTER -I src -c -o src/platform.o src/platform.c cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -shared -fPIC -pthread -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITH_NATIVE_MONITOR -D WITHOUT_TSC_COUNTER -I src -c -o src/sandbox.o src/sandbox.c src/sandbox.c: In function ‘__sandbox_tracer’: src/sandbox.c:1030: 警告:标号 ‘next’ 定义后未使用 cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -shared -fPIC -pthread -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITH_NATIVE_MONITOR -D WITHOUT_TSC_COUNTER -I src -c -o src/symbols.o src/symbols.c ar rcvs libsandbox.a src/platform.o src/sandbox.o src/symbols.o r - src/platform.o r - src/sandbox.o r - src/symbols.o make[1]: Leaving directory
/var/www/html/moodle/local/onlinejudge/judge/sandbox/sand/libsandbox'
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -I ./libsandbox/src -c policy_print.c
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -I ./libsandbox/src -c sand.c
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 -D SANDBOX -D NDEBUG -D WITH_NATIVE_TRACER -D WITHOUT_TSC_COUNTER -I ./libsandbox/src -o detector sand.o policy_print.o ./libsandbox/libsandbox.a
cc -m32 -Wall -ansi -std=gnu99 -g0 -O3 --static -o 223 223.c
./detect.sh
Detecting syscalls...
INIT_SYSCALLS: 122, 45, 45, 243, 45, 45,
ALLOWED_SYSCALLS: 197, 54, 192, 3, 45, 91, 125,
[root@sei sand]# ./detector -l memory=2000000000 223 < /dev/null
122
45
45
243
45
45
223
197
54
192
3
197
192
192
45
192
192
91
91
125
192
from moodle-local_onlinejudge.
You did not post the output of echo $?
which is important
from moodle-local_onlinejudge.
[root@sei sand]# echo $?
6
from moodle-local_onlinejudge.
Yep. I believe that if you run ./223 < /dev/null
, you will get SIGSEGV.
Does your system have some restriction about memory usage. 223.c tries to use 1GB memory. It is ok on my ubuntu, debian and centos 5.5. I don't know why it does not work on yours. You can edit 223.c and change the HEAP_ALLOC_SIZE to a smaller size, such as 128MB or so. Perhaps it works.
from moodle-local_onlinejudge.
Yes, you are right. I changed the HEAP_ALLOC_SIZE to 128MB. it's OK. Thanks!
./runtest.sh 7 return1_test
All testcases are OK
from moodle-local_onlinejudge.
The menory for my CentOS 5.5 virtual machine is 512MB.
from moodle-local_onlinejudge.
Just learned about sunner's fix. I have indeed released an updated version of libsandbox to tackle the very issue. To avoid further code branching, I would recommend an upgrade of the libsandbox code distributed with this project from 0.2.17 to 0.2.18. The latest version of libsandbox is available at https://sourceforge.net/projects/libsandbox/.
from moodle-local_onlinejudge.
Related Issues (20)
- 提交的代码判断报错受限函数
- 判断提交的代码时提示函数受限 HOT 7
- libsandbox compilation error,The plug-in cannot run properly
- Consider adding github actions support - it's free and very useful.
- install.xml not valid.
- Missing Privacy API
- missing thirdpartylibs.xml file.
- Moodle uses sentence case.
- Incorrect location for class and violation of frankenstyle naming rules.
- assign_feedback plugin should be submitted separately to plugins db
- $onlinejudge is no-object in mod/assign/feedback/onlinejudge/locallib.php HOT 3
- 安装问题 HOT 13
- Error when compling C files through sandbox HOT 7
- 安装问题 HOT 2
- Sandbox Compilation Error
- [!] frontend: assignfeedback plugin settings is glitched (cpu and memory range loading) HOT 1
- [!] deprecated usage of implode
- review issues HOT 1
- Core Dumped During Sandbox Compilation[!] HOT 2
- A Question About Its Usage HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moodle-local_onlinejudge.