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

asan crashes in jni #58

Closed
ramosian-glider opened this issue Aug 31, 2015 · 6 comments
Closed

asan crashes in jni #58

ramosian-glider opened this issue Aug 31, 2015 · 6 comments

Comments

@ramosian-glider
Copy link
Member

Originally reported on Google Code with ID 58

What steps will reproduce the problem?
My code uses jni to access hadoop hdfs file. it seems asan is not compatible with code
in jvm.

What is the expected output? What do you see instead?
asan crashes.

What version of the product are you using? On what operating system?
llvm 3.1, centos 6.2, java 1.7

Please provide any additional information below.
the crash message is attached.

Reported by huas.su on 2012-03-29 09:10:08


- _Attachment: [asan.java.txt](https://storage.googleapis.com/google-code-attachments/address-sanitizer/issue-58/comment-0/asan.java.txt)_
@ramosian-glider
Copy link
Member Author

Hi!
Could you give steps to reproduce the problem? Is it possible to somehow symbolize
the stack trace (e.g, what stack trace do you get under gdb if you compile with "-g")?
Also, it would be great if you provide the whole stderr when you run your test with
ASAN_OPTIONS=verbosity=2. Currently we see problems when C++ libraries compiled with
ASan are called from Java, but it's probably not the case here.

Reported by [email protected] on 2012-03-29 13:45:05

@ramosian-glider
Copy link
Member Author

Two more things to do:

1. Run the program under strace -f
2. Run the program with ASAN_OPTIONS=sleep_before_dying=100. When the program crashes,
dump the contents of /proc/<PID>/maps (PID is printed between "=="s in the log).
You can also try to run gdb -p <PID> and look at the stack trace there, but the top
frames are most probably originating from Java, so it won't help much (I may be mistaking).

Reported by ramosian.glider on 2012-03-29 14:26:40

@ramosian-glider
Copy link
Member Author

we don't have enough information to proceed. 

Reported by konstantin.s.serebryany on 2012-04-09 22:42:24

  • Status changed: Invalid

@ramosian-glider
Copy link
Member Author

Hi, I have a similar problem as the one that was reported, with the same error line:

ASAN:SIGSEGV
ERROR: AddressSanitizer crashed on unknown address 0x000000000008

In my case, I am trying to start a Java program that calls into a native library, which
I would like to check for illegal memory accesses. However, ASan crashes shortly after
starting the JVM (maybe that is what was stated in comment #1 ?).

AFAIK, SIGSEGV is used internally by the JVM (I am using sun/oracle jdk 1.6+1.7). There
is some option to "reduce signal usage" (-Xrs), but SIGSEGV cannot be deactivated.

Is there some solution/hint how it would be possible to handle/ignore SIGSEGV?

Reported by polygox on 2013-03-17 22:25:10

@ramosian-glider
Copy link
Member Author

You can disable the asan SEGV handler (ASAN_OPTIONS=handle_segv=0), but it will hardly
help you. 

asan can not be used with jni unless you rebuild the JVM binary (you need the main
binary to be linked with asan run-time) or somehow else inject the asan run-time 
into the process at startup time. (You may try LD_PRELOAD, but you are on your own)

Reported by konstantin.s.serebryany on 2013-03-18 04:13:53

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:12:58

  • Labels added: ProjectAddressSanitizer

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

No branches or pull requests

1 participant