daveagp / java_jail

chroot java jail, and JSON java trace printer
GNU Affero General Public License v3.0
79 stars 32 forks source link

Java Visualizer not working #6

Closed nileshtakale closed 8 years ago

nileshtakale commented 8 years ago

Hi, I followed all the steps on my RHEL 7 64 bit OS to install Java Visualizer, but still it is not working. safeexec is working properly. In Java jail when I execute below command ,

./java/bin/java -cp .:cp:cp/javax.json-1.0.jar:java/lib/tools.jar traceprinter.InMemory < cp/traceprinter/test-input.txt it gives me below output.

{"code":"public class Test { public static void main(String[] args) { int x = 3; x += x; } }","stdin":"","trace":[{"stdout":"","event":"call","line":1,"stack_to_render":[{"func_name":"main:1","encoded_locals":{},"ordered_varnames":[],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"1","frame_id":1}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"step_line","line":1,"stack_to_render":[{"func_name":"main:1","encoded_locals":{},"ordered_varnames":[],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"2","frame_id":2}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"step_line","line":1,"stack_to_render":[{"func_name":"main:1","encoded_locals":{"x":3},"ordered_varnames":["x"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"4","frame_id":4}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"step_line","line":1,"stack_to_render":[{"func_name":"main:1","encoded_locals":{"x":6},"ordered_varnames":["x"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"8","frame_id":8}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"return","line":1,"stack_to_render":[{"func_name":"main:1","encoded_locals":{"x":6,"return":["VOID"]},"ordered_varnames":["x","return"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"9","frame_id":9}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}}],"userlog":"Debugger VM maxMemory: 3513M\n"}

everything is blank inside {}.

I also tried accessing Java Visualizer by http://localhost/java_visualize. but its not working.

Please help.

Thanks.

daveagp commented 8 years ago

Hi,

I'm copying from your email: """ When I access Java Visualizer from browser it is not showing default program which is ClassNameHere

When I click on Visualize Execution button, it says please wait..processing your code and does not processes anything.

I can not see frames on the left side of the screen. """ First, you should just get the command-line test working. Until that works, nothing else can work. When you say "everything is blank inside {}." what do you mean, compared to https://github.com/daveagp/java_jail/blob/master/cp/traceprinter/expected-output.txt ?

nileshtakale commented 8 years ago

Hi David,

Thanks for the quick reply. Yes, the output inside {} is blank as compared to expected-output.txt. I mean I can not see any values inside it, the way they are in expected-output.txt. {"REF","9"} like that. How do I make command-line test working? I configured safeexec and java_jail paths in jv-config.json but still its not working.

Could you please guide me so that I can go ahead?

Thanks, Nilesh

On Sun, Sep 27, 2015 at 12:29 AM, Dave Pritchard notifications@github.com wrote:

Hi,

I'm copying from your email: """ When I access Java Visualizer from browser it is not showing default program which is ClassNameHere

When I click on Visualize Execution button, it says please wait..processing your code and does not processes anything.

I can not see frames on the left side of the screen. """ First, you should just get the command-line test working. Until that works, nothing else can work. When you say "everything is blank inside {}." what do you mean, compared to https://github.com/daveagp/java_jail/blob/master/cp/traceprinter/expected-output.txt ?

— Reply to this email directly or view it on GitHub https://github.com/daveagp/java_jail/issues/6#issuecomment-143520998.

daveagp commented 8 years ago

Actually this is no big deal. We added a feature where the visualizer suppresses args[] if it is an empty array and that's what's happening here.

So let's go back to your other questions: """ When I access Java Visualizer from browser it is not showing default program which is ClassNameHere

When I click on Visualize Execution button, it says please wait..processing your code and does not processes anything.

I can not see frames on the left side of the screen. """

If you do this in Chrome or some other browsers, you can use the Developer Tools to inspect Network traffic and look at the error console. (f12 in Chrome) Open this panel including Network and then re-press the visualize button (see attachment). Are there errors? What is the network reply? image

nileshtakale commented 8 years ago

Hi David,

After turning on debugging in firefox and following above steps I am facing JavaScript errors, please check. Let me know what needs to be done.

Thanks, Nilesh

On Sun, Sep 27, 2015 at 11:52 AM, Dave Pritchard notifications@github.com wrote:

Actually this is no big deal. We added a feature where the visualizer suppresses args[] if it is an empty array and that's what's happening here.

So let's go back to your other questions: """ When I access Java Visualizer from browser it is not showing default program which is ClassNameHere

When I click on Visualize Execution button, it says please wait..processing your code and does not processes anything.

I can not see frames on the left side of the screen. """

If you do this in Chrome or some other browsers, you can use the Developer Tools to inspect Network traffic and look at the error console. (f12 in Chrome) Open this panel including Network and then re-press the visualize button (see attachment). Are there errors? What is the network reply? [image: image] https://cloud.githubusercontent.com/assets/1429912/10123986/7a28d3fe-64fd-11e5-8e0a-69886da0b16c.png

— Reply to this email directly or view it on GitHub https://github.com/daveagp/java_jail/issues/6#issuecomment-143576658.

nileshtakale commented 8 years ago

Hi,

I forgot to send network tab response.

Thanks, Nilesh

On Sun, Sep 27, 2015 at 12:17 PM, Nilesh Takale nileshtakale@gmail.com wrote:

Hi David,

After turning on debugging in firefox and following above steps I am facing JavaScript errors, please check. Let me know what needs to be done.

Thanks, Nilesh

On Sun, Sep 27, 2015 at 11:52 AM, Dave Pritchard <notifications@github.com

wrote:

Actually this is no big deal. We added a feature where the visualizer suppresses args[] if it is an empty array and that's what's happening here.

So let's go back to your other questions: """ When I access Java Visualizer from browser it is not showing default program which is ClassNameHere

When I click on Visualize Execution button, it says please wait..processing your code and does not processes anything.

I can not see frames on the left side of the screen. """

If you do this in Chrome or some other browsers, you can use the Developer Tools to inspect Network traffic and look at the error console. (f12 in Chrome) Open this panel including Network and then re-press the visualize button (see attachment). Are there errors? What is the network reply? [image: image] https://cloud.githubusercontent.com/assets/1429912/10123986/7a28d3fe-64fd-11e5-8e0a-69886da0b16c.png

— Reply to this email directly or view it on GitHub https://github.com/daveagp/java_jail/issues/6#issuecomment-143576658.

daveagp commented 8 years ago

I don't see any errors copied in. Start with the Javascript console errors.

nileshtakale commented 8 years ago

Hi,

There is syntax error, check my second attachments.

Thanks, Nilesh

On Sun, Sep 27, 2015 at 12:54 PM, Dave Pritchard notifications@github.com wrote:

I don't see any errors copied in. Start with the Javascript console errors.

— Reply to this email directly or view it on GitHub https://github.com/daveagp/java_jail/issues/6#issuecomment-143580853.

daveagp commented 8 years ago

There's nothing there. I am not sure you can email attachments in GitHub Issue threads. Try responding on the webpage https://github.com/daveagp/java_jail/issues/6 and attaching your info there directly.

nileshtakale commented 8 years ago

I have sent email attachments to your gmail id. Please check.

On Sun, Sep 27, 2015 at 12:58 PM, Dave Pritchard notifications@github.com wrote:

There's nothing there. I am not sure you can email attachments in GitHub Issue threads. Try responding on the webpage #6 https://github.com/daveagp/java_jail/issues/6 and attaching your info there directly.

— Reply to this email directly or view it on GitHub https://github.com/daveagp/java_jail/issues/6#issuecomment-143581055.

daveagp commented 8 years ago

Please keep your replies on GitHub instead of email if you don't mind. So I see you have a syntax error on line 1 of config.js.php. If you click on that error, you should be able to see what the error is (like, what are the contents of that file). Can you check that?

Also, try refreshing the page and observing the network tab. Right now it only captured the "visualize" action but not the original page load.

nileshtakale commented 8 years ago

Hi,

When I click on Visualize execution facing below error,

[13:13:01.203] Use of getPreventDefault() is deprecated. Use defaultPrevented instead. @ http://192.168.147.10/OnlinePythonTutor/v3/js/jquery-1.8.2.min.js:2

In network tab it goes to the URL http://192.168.147.10/example-code/ , thats it.

On Sun, Sep 27, 2015 at 1:03 PM, Dave Pritchard notifications@github.com wrote:

Please keep your replies on GitHub instead of email if you don't mind. So I see you have a syntax error on line 1 of config.js.php. If you click on that error, you should be able to see what the error is (like, what are the contents of that file). Can you check that?

Also, try refreshing the page and observing the network tab. Right now it only captured the "visualize" action but not the original page load.

— Reply to this email directly or view it on GitHub https://github.com/daveagp/java_jail/issues/6#issuecomment-143581305.

nileshtakale commented 8 years ago

Hi David,

I guess there are few css and javascript errors. I can see in network tab the request goes to http://192.168.147.10/example-code/(Default.java) and in response tab is shows the entire code for class ClassNameHere.

Config.js.php processes jv-config.json, if it fails then it says You will not be able to submit code.

I am facing below script errors,

[13:25:16.540] Error in parsing value for 'filter'. Declaration dropped. @

http://192.168.147.10/OnlinePythonTutor/v3/css/jquery.qtip.css:570

[13:26:51.965] SyntaxError: syntax error @ http://192.168.147.10/config.js.php:1 [13:26:52.036] Unknown property 'box-sizing'. Declaration dropped. @ http://192.168.147.10/ [13:26:52.237] syntax error @ http://192.168.147.10/example-code/(Default).java:1 [13:26:52.238] TypeError: dat.indexOf is not a function @ http://192.168.147.10/jv-frontend.js?8:101

Thanks, Nilesh

On Sun, Sep 27, 2015 at 1:19 PM, Nilesh Takale nileshtakale@gmail.com wrote:

Hi,

When I click on Visualize execution facing below error,

[13:13:01.203] Use of getPreventDefault() is deprecated. Use defaultPrevented instead. @ http://192.168.147.10/OnlinePythonTutor/v3/js/jquery-1.8.2.min.js:2

In network tab it goes to the URL http://192.168.147.10/example-code/ , thats it.

On Sun, Sep 27, 2015 at 1:03 PM, Dave Pritchard notifications@github.com wrote:

Please keep your replies on GitHub instead of email if you don't mind. So I see you have a syntax error on line 1 of config.js.php. If you click on that error, you should be able to see what the error is (like, what are the contents of that file). Can you check that?

Also, try refreshing the page and observing the network tab. Right now it only captured the "visualize" action but not the original page load.

— Reply to this email directly or view it on GitHub https://github.com/daveagp/java_jail/issues/6#issuecomment-143581305.

nileshtakale commented 8 years ago

Hi,

Please let me know what I need to do. Is there issue at my end?

Thanks, Nilesh

daveagp commented 8 years ago

What is the actual content of config.js.php that is transmitted to you over the network? On my machine it looks like this: image

nileshtakale commented 8 years ago

Here is the screenshot config_js_php

daveagp commented 8 years ago

It looks like you don't have php installed, or your webserver's php module is not activated.

nileshtakale commented 8 years ago

Ok. I am sorry but I am not aware of installing php on webserver. In my www folder I only have html module. Could you please provide any reference so that I can move ahead?

daveagp commented 8 years ago

https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1LENP_enUS503US503&ion=1&espv=2&es_th=1&ie=UTF-8#es_th=1&q=rhel%20install%20php

nileshtakale commented 8 years ago

Hi David,

After installing php module now I am facing below error, you can see all the configuration in this screenshot. Please help.

after_php_module

nileshtakale commented 8 years ago

Hi David,

I changed java_safe_ram_maketrace.php and corrected java/bin path. I am able to get rid of java error. But Safeexec is still giving error. Please check screenshot and help.

java_path_correction

daveagp commented 8 years ago

I guess your command-line visualizer is working, but it is not working with your jail. Did you try "Try with safeexec (from java_jail) ... " from the README? Did you follow all the installation steps, particularly (2) and (4)? Did you install and build safeexec?

nileshtakale commented 8 years ago

I did not do "Try with safeexec (from java_jail). But now I did it with

/usr/java_visualizer/safeexec-master/safeexec --chroot_dir . --exec_dir / --share_newnet --nproc 50 --mem 3000000 --nfile 30 --env_vars CLASSPATH=/cp/:/cp/javax.json-1.0.jar:/java/lib/tools.jar --exec /java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

getting below error,

error 13 (Permission denied): execve error

Command exited with non-zero status (1) elapsed time: 0 seconds memory usage: 0 kbytes cpu usage: 0.000 seconds

what to do for this permission error?

daveagp commented 8 years ago

Did you follow steps 2 copying in all of the libraries into subfolders of the jail? I believe that can cause this error. Did you follow every other step in the instructions?

nileshtakale commented 8 years ago

Yes, I followed all the steps. I copied necessary library files in lib64,etc and proc. I did not do anything for /lib and /usr/lib though. My java_jail has 6 folders named java,cp,dev,etc,lib64 and proc.

daveagp commented 8 years ago

What about the more basic hello world example in the safeexec README?

nileshtakale commented 8 years ago

Yes, it does gets executed. I did check that, while installing safeexec. Now after doing some modifications in command and location of the execution getting below error.

/usr/java_visualizer/safeexec-master/safeexec --chroot_dir . --exec_dir / --share_newnet --nproc 50 --mem 3000000 --nfile 30 --env_vars CLASSPATH=/cp/:/cp/javax.json-1.0.jar:/java/lib/tools.jar --exec /usr/java_visualizer/java_jail-master/java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

Error occurred during initialization of VM Could not allocate metaspace: 1073741824 bytes Command exited with non-zero status (1) elapsed time: 1 seconds memory usage: 67224 kbytes cpu usage: 0.000 seconds

daveagp commented 8 years ago

Try increasing --mem

nileshtakale commented 8 years ago

this is weird..

/usr/java_visualizer/safeexec-master/safeexec --chroot_dir . --exec_dir / --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=/cp/:/cp/javax.json-1.0.jar:/java/lib/tools.jar --exec /usr/java_visualizer/java_jail-master/java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

Error:

Could not find or load main class traceprinter.InMemory Command exited with non-zero status (1) elapsed time: 0 seconds memory usage: 0 kbytes cpu usage: 0.052 seconds

daveagp commented 8 years ago

Is your pwd the jail? (I assume so since chroot_dir is . )

Double-check that the file java_jail/cp/traceprinter/InMemory.class exists and is readable by anyone

nileshtakale commented 8 years ago

I'm at / and yes the class exists and readable by anyone.

nileshtakale commented 8 years ago

When I execute the same command from java_jail facing below error,

error 2 (No such file or directory): execve error

Command exited with non-zero status (1) elapsed time: 0 seconds memory usage: 0 kbytes cpu usage: 0.000 seconds root@Sasha-PC:/usr/java_visualizer/java_jail-master#

nileshtakale commented 8 years ago

Could you please tell me why above error is occurring? I tried, but no luck.

daveagp commented 8 years ago

Here's a test between (1) and (2): see if you can get it to work with safeexec but without chroot. Try this from inside of the java_jail directory:

/path/to/safeexec --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec ./java/bin/java traceprinter.InMemory < cp/traceprinter/test-input.txt

PS: I might have a delay in responding to future messages but should get to them eventually

nileshtakale commented 8 years ago

Hi David,

It did work with above command. But as you must be knowing it worked from java_jail from command prompt. How do I make it work from browser?

Below command worked /usr/java_visualizer/safeexec-master/safeexec --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /usr/java_visualizer/java_jail-master/java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

Thanks, Nilesh

daveagp commented 8 years ago

What are your *config.json settings? (don't send me your database password obviously)

nileshtakale commented 8 years ago

I can send you jv-config. Jason. In fact in my earlier messages I sent you the screenshot of it. I have mentioned paths of safeexec and java jail. I'm not using database.

One very basic question. All this activity I'm doing on Ubuntu 15.04 desktop version. Will it work on it? On Sep 29, 2015 22:02, "Dave Pritchard" notifications@github.com wrote:

What are your *config.json settings? (don't send me your database password obviously)

— Reply to this email directly or view it on GitHub https://github.com/daveagp/java_jail/issues/6#issuecomment-144268654.

daveagp commented 8 years ago

The screenshots are just bits and pieces so it would be better if you send the while thing.

It should work fine on a desktop but it will still need an internet connection to get the auxiliary files.

nileshtakale commented 8 years ago

Please check.

config_json

I do have internet connection, so I hope it will work. Since all configuration is done, please let me know what should I do to make it work.

daveagp commented 8 years ago

So looking back actually you don't have it confirmed as fully working in the command line yet. You only got

/usr/java_visualizer/safeexec-master/safeexec --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /usr/java_visualizer/java_jail-master/java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

but this is not using chroot. Try this:

/usr/java_visualizer/safeexec-master/safeexec --chroot_dir /usr/java_visualizer/java_jail-master --exec_dir / --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /java/bin/java traceprinter.InMemory < /cp/traceprinter/test-input.txt

nileshtakale commented 8 years ago

As I told you before executing below command gives me no such file error. Please check.

/usr/java_visualizer/safeexec-master/safeexec --chroot_dir /usr/java_visualizer/java_jail-master --exec_dir / --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /usr/java_visualizer/java_jail-master/java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

no_such_file_error

daveagp commented 8 years ago

Maybe try this. You will need to copy and paste the text output into a file and attach it here... it will be too long for a screenshot.

sudo strace -f /usr/java_visualizer/safeexec-master/safeexec --chroot_dir /usr/java_visualizer/java_jail-master --exec_dir / --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /usr/java_visualizer/java_jail-master/java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

nileshtakale commented 8 years ago

Please check the trace. Could not attach docx/txt, giving errors.

execve("/usr/java_visualizer/safeexec-master/safeexec", ["/usr/java_visualizer/safeexec-ma"..., "--chroot_dir", "/usr/java_visualizer/java_jail-m"..., "--exec_dir", "/", "--share_newnet", "--nproc", "50", "--mem", "30000000", "--nfile", "30", "--env_vars", "CLASSPATH=./cp/:./cp/javax.json-"..., "--exec", "/usr/java_visualizer/javajail-m"..., ...], [/* 17 vars /]) = 0 brk(0) = 0x1c9f000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f582db78000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=85562, ...}) = 0 mmap(NULL, 85562, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f582db63000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\v\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1869392, ...}) = 0 mmap(NULL, 3972864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f582d58d000 mprotect(0x7f582d74d000, 2097152, PROT_NONE) = 0 mmap(0x7f582d94d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7f582d94d000 mmap(0x7f582d953000, 16128, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f582d953000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f582db62000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f582db61000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f582db60000 arch_prctl(ARCH_SET_FS, 0x7f582db61700) = 0 mprotect(0x7f582d94d000, 16384, PROT_READ) = 0 mprotect(0x604000, 4096, PROT_READ) = 0 mprotect(0x7f582db7a000, 4096, PROT_READ) = 0 munmap(0x7f582db63000, 85562) = 0 rt_sigaction(SIGPIPE, {SIG_DFL, [], SA_RESTORER, 0x7f582d5c22f0}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGPIPE, {SIG_DFL, [], SA_RESTORER, 0x7f582d5c22f0}, {SIG_DFL, [], SA_RESTORER, 0x7f582d5c22f0}, 8) = 0 getpid() = 2451 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f582db619d0) = 2452 Process 2452 attached [pid 2451] rt_sigaction(SIGALRM, {0x402137, [ALRM], SA_RESTORER|SA_RESTART, 0x7f582d5c22f0}, {SIG_DFL, [], 0}, 8) = 0 [pid 2451] alarm(60 <unfinished ...> [pid 2452] setrlimit(RLIMIT_AS, {rlim_cur=30000000_1024, rlim_max=30000000_1024} <unfinished ...> [pid 2451] <... alarm resumed> ) = 0 [pid 2452] <... setrlimit resumed> ) = 0 [pid 2451] select(0, NULL, NULL, NULL, {0, 67000} <unfinished ...> [pid 2452] setrlimit(RLIMIT_DATA, {rlim_cur=30000000_1024, rlim_max=30000000_1024}) = 0 [pid 2452] setrlimit(RLIMIT_CORE, {rlim_cur=0, rlim_max=0}) = 0 [pid 2452] setrlimit(RLIMIT_STACK, {rlim_cur=8192_1024, rlim_max=8192_1024}) = 0 [pid 2452] setrlimit(RLIMIT_FSIZE, {rlim_cur=0, rlim_max=0}) = 0 [pid 2452] setrlimit(RLIMIT_CPU, {rlim_cur=10, rlim_max=10}) = 0 [pid 2452] setrlimit(RLIMIT_NOFILE, {rlim_cur=30, rlim_max=30}) = 0 [pid 2452] setrlimit(RLIMIT_NPROC, {rlim_cur=51, rlim_max=51}) = 0 [pid 2452] chdir("/usr/java_visualizer/java_jail-master") = 0 [pid 2452] chroot(".") = 0 [pid 2452] chdir("/") = 0 [pid 2452] setpriority(PRIO_PROCESS, 2452, 16) = 0 [pid 2452] unshare(CLONE_FS|CLONE_FILES|CLONE_NEWNS|CLONE_SYSVSEM|CLONE_NEWUTS|CLONE_NEWIPC) = 0 [pid 2452] setsid() = 2452 [pid 2452] setgid(1000) = 0 [pid 2452] getgid() = 1000 [pid 2452] setgroups(0, []) = 0 [pid 2452] getgroups(0, []) = 0 [pid 2452] setuid(12451) = 0 [pid 2452] getuid() = 12451 [pid 2452] execve("/usr/java_visualizer/java_jail-master/java/bin/java", ["/usr/java_visualizer/javajail-m"..., "traceprinter.InMemory"], [/ 1 var */]) = -1 ENOENT (No such file or directory) [pid 2452] write(2, "error 2 (No such file or directo"..., 37error 2 (No such file or directory): ) = 37 [pid 2452] write(2, "execve error\n", 13execve error ) = 13 [pid 2452] write(2, "\n", 1 ) = 1 [pid 2452] exit_group(1) = ? [pid 2452] +++ exited with 1 +++ <... select resumed> ) = ? ERESTARTNOHAND (To be restarted if no handler) --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2452, si_status=1, si_utime=0, si_stime=0} --- select(0, NULL, NULL, NULL, {0, 40646}) = 0 (Timeout) open("/proc/2452/status", O_RDONLY) = 3 read(3, "Name:\tsafeexec\nState:\tZ (zombie)"..., 8192) = 571 close(3) = 0 wait4(2452, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], WNOHANG|WSTOPPED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 2452 write(2, "Command exited with non-zero sta"..., 40Command exited with non-zero status (1) ) = 40 write(2, "elapsed time: 0 seconds\n", 24elapsed time: 0 seconds ) = 24 write(2, "memory usage: 0 kbytes\n", 23memory usage: 0 kbytes ) = 23 write(2, "cpu usage: 0.000 seconds\n", 25cpu usage: 0.000 seconds ) = 25 setgid(1000) = 0 getgid() = 1000 setgroups(0, []) = 0 getgroups(0, []) = 0 setuid(12451) = 0 getuid() = 12451 getuid() = 12451 getuid() = 12451 geteuid() = 12451 geteuid() = 12451 getgid() = 1000 getgid() = 1000 kill(4294967295, SIGKILL) = 0 close(2) = 0 exit_group(1) = ? +++ exited with 1 +++

daveagp commented 8 years ago

You didn't execute the exact command I gave you:

/usr/java_visualizer/safeexec-master/safeexec --chroot_dir /usr/java_visualizer/java_jail-master --exec_dir / --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /java/bin/java traceprinter.InMemory < /cp/traceprinter/test-input.txt

Specifically you seem to have used the wrong --exec argument. Try it again and let me know.

nileshtakale commented 8 years ago

The below command,

/usr/java_visualizer/safeexec-master/safeexec --chroot_dir /usr/java_visualizer/java_jail-master --exec_dir / --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /java/bin/java traceprinter.InMemory < /cp/traceprinter/test-input.txt

gave me error. -bash: /cp/traceprinter/test-input.txt: No such file or directory

so I gave full path and executed. Let me know.

daveagp commented 8 years ago

It executed correctly? That's great news, so the visualizer is working in the jail. If there's a problem still, it's only configuring the glue to the webserver.

nileshtakale commented 8 years ago

No it didn't. Let me explain you.

after the bash error, I modified the command as follows,

/usr/java_visualizer/java_jail-master# /usr/java_visualizer/safeexec-master/safeexec --chroot_dir /usr/java_visualizer/java_jail-master --exec_dir / --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

this gave me error,

/java/bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory Command exited with non-zero status (127) elapsed time: 0 seconds memory usage: 0 kbytes cpu usage: 0.000 seconds

after this I again modified the command as follows,

/usr/java_visualizer/java_jail-master# /usr/java_visualizer/safeexec-master/safeexec --chroot_dir /usr/java_visualizer/java_jail-master --exec_dir / --share_newnet --nproc 50 --mem 30000000 --nfile 30 --env_vars CLASSPATH=./cp/:./cp/javax.json-1.0.jar:./java/lib/tools.jar --exec /usr/java_visualizer/java_jail-master/java/bin/java traceprinter.InMemory < /usr/java_visualizer/java_jail-master/cp/traceprinter/test-input.txt

this gave me error,

error 2 (No such file or directory): execve error

Command exited with non-zero status (1) elapsed time: 0 seconds memory usage: 0 kbytes cpu usage: 0.000 seconds

and the out put of strace -f command I have already provided.

daveagp commented 8 years ago

It looks like libpthread.so.0 is missing from your jail. Find it on your hard drive (maybe "sudo find / | grep libpthread") and put a copy into the corresponding subfolder of your jail, then try again.

nileshtakale commented 8 years ago

It is there. file

daveagp commented 8 years ago

Can you show me the output of "sudo find / | grep libpthread"

nileshtakale commented 8 years ago

Please check libpthread