Discussion:
How to check error log of ASAN in Linux for an xyz.o file?
(too old to reply)
Karthigaasri Thirunavukkarasu
2016-09-15 13:04:10 UTC
Permalink
I use Open Suse Linux 13.2 with GCC and I am trying to implement ASAN tool. When I used the tool for xyz.c file I get a separate log by using "export ASAN_OPTIONS=log_path=PATH" but it's not working in the case of xyz.o file.

Steps I did are:
1. Included -fsanitize=address flag in compile and link part and then generated vos.o by building the same

2. After I run vos.o and start executing further what we do is kill the image once it is done..

We usually dont have a stop kind of thing in vos.o! We used to kill the image once it's done executing. For example - like creation of ipsecd.o in StrongSwan, we execute vos.o which will start ipsec as a process in the system.

After killing the vos.o image,I am wondering where can I find the error log generated by the address sanitizer tool.

Is it because I missed something or is it because we kill the image once we are done?

Can you help me with this?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Alexander Potapenko' via address-sanitizer
2016-09-15 14:35:55 UTC
Permalink
If I'm understanding you correctly, by xyz.o you're referring to an
executable, not an object file, correct? We don't have per-object file
logs.
Normally ASan won't write anything to the log unless an error happens.
You can add verbosity=1 to your ASAN_OPTIONS to enforce the log
creation.

On Thu, Sep 15, 2016 at 3:04 PM, Karthigaasri Thirunavukkarasu
Post by Karthigaasri Thirunavukkarasu
I use Open Suse Linux 13.2 with GCC and I am trying to implement ASAN tool. When I used the tool for xyz.c file I get a separate log by using "export ASAN_OPTIONS=log_path=PATH" but it's not working in the case of xyz.o file.
1. Included -fsanitize=address flag in compile and link part and then generated vos.o by building the same
2. After I run vos.o and start executing further what we do is kill the image once it is done..
We usually dont have a stop kind of thing in vos.o! We used to kill the image once it's done executing. For example - like creation of ipsecd.o in StrongSwan, we execute vos.o which will start ipsec as a process in the system.
After killing the vos.o image,I am wondering where can I find the error log generated by the address sanitizer tool.
Is it because I missed something or is it because we kill the image once we are done?
Can you help me with this?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
For more options, visit https://groups.google.com/d/optout.
--
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Karthigaasri Thirunavukkarasu
2016-09-16 03:00:15 UTC
Permalink
I wanted to know where that log is getting stored..Can partiparticular path be specified? Is it getting generated or not? Where exactly should I give that ASANOPTIONS?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Karthigaasri Thirunavukkarasu
2016-09-16 04:19:26 UTC
Permalink
I wanted to know where that log is getting stored..Can particular path be specified? Is it getting generated or not? Where exactly should I give that ASANOPTIONS?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Karthigaasri Thirunavukkarasu
2016-09-16 11:30:47 UTC
Permalink
As you say it is executable file...I want to to know how to track it with ASAN?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Alexander Potapenko' via address-sanitizer
2016-09-16 11:41:40 UTC
Permalink
Consider ./xyz is the name of your executable file, which has been
compiled and linked with -fsanitize=address.
Please note that you don't need to export ASAN_OPTIONS when compiling
the binary (that's how I understood your first letter).

Then you can invoke it as follows:

$ ASAN_OPTIONS=log_path=foo ./xyz

Here "foo" is the prefix of the log file name (it can also contain the
path, e.g. /path/to/foo). The actual log file will look like foo.97300
(where 97300 is the process PID).
Note that unless there's an error in ./xyz that ASan can report, that
log file won't be created. Only when an error happens the report is
written to foo.<pid>
If you want to check that the log path is correct, you can invoke your
executable as follows:

$ ASAN_OPTIONS=log_path=foo:verbosity=1 ./xyz

This way ASan will immediately create the log file and write some
debugging info to it.

On Fri, Sep 16, 2016 at 1:30 PM, Karthigaasri Thirunavukkarasu
Post by Karthigaasri Thirunavukkarasu
As you say it is executable file...I want to to know how to track it with ASAN?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
For more options, visit https://groups.google.com/d/optout.
--
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Karthigaasri Thirunavukkarasu
2016-09-16 12:53:38 UTC
Permalink
Thank you so much ☺ It's working...
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Karthigaasri Thirunavukkarasu
2016-09-17 07:43:55 UTC
Permalink
Thank you again for your valuable insight...Can you help me with how to analyse the error that is being reported by ASAN in GCC?

Though I use verbosity where exactly should I look for is not clear...So can you please give me some insights on how to analyse?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Alexander Potapenko' via address-sanitizer
2016-09-17 07:58:24 UTC
Permalink
May I ask you to post the actual report you want to analyze?

sent from phone

On Sep 17, 2016 9:43 AM, "Karthigaasri Thirunavukkarasu" <
Post by Karthigaasri Thirunavukkarasu
Thank you again for your valuable insight...Can you help me with how to
analyse the error that is being reported by ASAN in GCC?
Though I use verbosity where exactly should I look for is not clear...So
can you please give me some insights on how to analyse?
--
You received this message because you are subscribed to the Google Groups
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Karthigaasri Thirunavukkarasu
2016-09-20 04:31:30 UTC
Permalink
==6211== ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000622314 at pc 0x417fee bp 0x7fff2e146300 sp 0x7fff2e1462f8
READ of size 4 at 0x000000622314 thread T0
#0 0x417fed in main example_GlobalOutOfBounds.cc:4
#1 0x7f1c10d2a76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
#2 0x417ef4 (a.out+0x417ef4)
0x000000622314 is located 4 bytes to the right of global variable 'global_array (example_GlobalOutOfBounds.cc)' (0x622180) of size 400
Shadow bytes around the buggy address:
0x1000000c4410: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x1000000c4460: 00 00[f9]f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
0x1000000c4470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c44a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c44b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap righ redzone: fb
Freed Heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
==6211== ABORTING



Consider this as my log..how should I analyse this?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Alexander Potapenko' via address-sanitizer
2016-09-20 09:23:51 UTC
Permalink
There's plenty of information directly readable from this report.
As one can see, the bug is at line 4 of example_GlobalOutOfBounds.cc
(that's stack frame #0). The program is reading 4 bytes behind the
global variable called "global_array" of size 400.
The shadow dump won't tell you more in this case, but from it you can
see that the shadow byte corresponding to the memory being read is at
0x1000000c4462, and that memory is marked as "Global redzone".
ASan pads global variables with redzones exactly to be able to detect
out-of-bound accesses behind them.

On Tue, Sep 20, 2016 at 6:31 AM, Karthigaasri Thirunavukkarasu
Post by Karthigaasri Thirunavukkarasu
==6211== ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000622314 at pc 0x417fee bp 0x7fff2e146300 sp 0x7fff2e1462f8
READ of size 4 at 0x000000622314 thread T0
#0 0x417fed in main example_GlobalOutOfBounds.cc:4
#1 0x7f1c10d2a76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
#2 0x417ef4 (a.out+0x417ef4)
0x000000622314 is located 4 bytes to the right of global variable 'global_array (example_GlobalOutOfBounds.cc)' (0x622180) of size 400
0x1000000c4410: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x1000000c4460: 00 00[f9]f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
0x1000000c4470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c4490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c44a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000000c44b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap righ redzone: fb
Freed Heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
==6211== ABORTING
Consider this as my log..how should I analyse this?
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
For more options, visit https://groups.google.com/d/optout.
--
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...