Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EasySandbox tests are not passing in Fedora after compliation #7

Open
p0ryae opened this issue Apr 4, 2023 · 1 comment
Open

EasySandbox tests are not passing in Fedora after compliation #7

p0ryae opened this issue Apr 4, 2023 · 1 comment

Comments

@p0ryae
Copy link

p0ryae commented Apr 4, 2023

gcc version: 9.1.0 (have tried 12.x)
g++ version: 9.1.0(have tried 12.x)
make version: 4.4.1 (have tried 3.82)

Logs when compiling initially using make:

gcc -c -fPIC -std=c99 -g -Wall -D_BSD_SOURCE   EasySandbox.c
In file included from /usr/include/unistd.h:25,
                 from EasySandbox.c:40:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -c -fPIC -std=c99 -g -Wall -D_BSD_SOURCE   malloc.c
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from malloc.c:24:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -shared -o EasySandbox.so EasySandbox.o malloc.o -ldl
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test01 t/test01.c -lm
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test02 t/test02.c -lm
In file included from /usr/include/unistd.h:25,
                 from t/test02.c:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test03 t/test03.c -lm
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from t/test03.c:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test04 t/test04.c -lm
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from t/test04.c:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test05 t/test05.c -lm
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from t/test05.c:5:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test06 t/test06.c -lm
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from t/test06.c:4:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test07 t/test07.c -lm
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from t/test07.c:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test08 t/test08.c -lm
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdlib.h:26,
                 from t/test08.c:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
g++ -g -Wall -D_BSD_SOURCE  -o t/test09 t/test09.cpp -lm
In file included from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/c++config.h:524,
                 from /usr/local/include/c++/9.1.0/iostream:38,
                 from t/test09.cpp:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
g++ -g -Wall -D_BSD_SOURCE  -o t/test10 t/test10.cpp -lm
In file included from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/c++config.h:524,
                 from /usr/local/include/c++/9.1.0/iostream:38,
                 from t/test10.cpp:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
g++ -g -Wall -D_BSD_SOURCE  -o t/test11 t/test11.cpp -lm
In file included from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/c++config.h:524,
                 from /usr/local/include/c++/9.1.0/iostream:38,
                 from t/test11.cpp:4:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
g++ -g -Wall -D_BSD_SOURCE  -o t/test12 t/test12.cpp -lm
In file included from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/c++config.h:524,
                 from /usr/local/include/c++/9.1.0/iostream:38,
                 from t/test12.cpp:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test13 t/test13.c -lm
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from t/test13.c:3:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
g++ -g -Wall -D_BSD_SOURCE  -o t/test14 t/test14.cpp -lm
In file included from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/local/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/c++config.h:524,
                 from /usr/local/include/c++/9.1.0/iostream:38,
                 from t/test14.cpp:4:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -std=c99 -g -Wall -D_BSD_SOURCE   -o t/test15 t/test15.c -lm
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from t/test15.c:1:
/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

Compile successfully finishes however without any errors (only warnings present). But the tests don't pass. The following is the log when running the tests:

./runalltests.sh t/test01 t/test02 t/test03 t/test04 t/test05 t/test06 t/test07 t/test08 t/test09 t/test10 t/test11 t/test12 t/test13 t/test14 t/test15
Executing t/test01...failed (exit code mismatch, expected 0, got 139)
Executing t/test02...1a2
> Hello, world
failed (output mismatch, expected [<<entering SECCOMP mode>>
Hello, world], got [<<entering SECCOMP mode>>])
Executing t/test03...failed (exit code mismatch, expected 137, got 139)
Executing t/test04...1a2
> 500500
failed (output mismatch, expected [<<entering SECCOMP mode>>
500500], got [<<entering SECCOMP mode>>])
Executing t/test05...1a2
> Hello, world
failed (output mismatch, expected [<<entering SECCOMP mode>>
Hello, world], got [<<entering SECCOMP mode>>])
Executing t/test06...failed (exit code mismatch, expected 137, got 139)
Executing t/test07...1a2
> 59
failed (output mismatch, expected [<<entering SECCOMP mode>>
59], got [<<entering SECCOMP mode>>])
Executing t/test08...failed (exit code mismatch, expected 0, got 139)
Executing t/test09...1a2
> Hello, C++ world
failed (output mismatch, expected [<<entering SECCOMP mode>>
Hello, C++ world], got [<<entering SECCOMP mode>>])
Executing t/test10...1a2
> Hello from the constructor!
failed (output mismatch, expected [<<entering SECCOMP mode>>
Hello from the constructor!], got [<<entering SECCOMP mode>>])
Executing t/test11...failed (exit code mismatch, expected 137, got 139)
Executing t/test12...1a2,3
> Here we are in main()
> Hello from the destructor!
failed (output mismatch, expected [<<entering SECCOMP mode>>
Here we are in main()
Hello from the destructor!], got [<<entering SECCOMP mode>>])
Executing t/test13...1a2
> Hello from the destructor!
failed (output mismatch, expected [<<entering SECCOMP mode>>
Hello from the destructor!], got [<<entering SECCOMP mode>>])
Executing t/test14...1a2
> 500500
failed (output mismatch, expected [<<entering SECCOMP mode>>
500500], got [<<entering SECCOMP mode>>])
Executing t/test15...1a2
> Radius is 1.128379
failed (output mismatch, expected [<<entering SECCOMP mode>>
Radius is 1.128379], got [<<entering SECCOMP mode>>])
15 test(s) failed
make: *** [Makefile:31: runtests] Error 1
@p0ryae
Copy link
Author

p0ryae commented Apr 5, 2023

Seems like newer libseccomp versions start to freak out the sandbox as a whole. Testing on a CentOS 7 server with libseccomp-2.3.1 installed doesn't throw any errors and all tests pass. Anything newer then libseccomp-2.4 throws an error. Trying my own custom sandbox also throws the "Bad System Call" error on newer libseccomp, but functions perfectly on older.

Downgrading the linux kernel is currently the best solution for the current state of EasySandbox.

Lastly, the deprecation warning during compilation can be safely ignored on newer glibc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant