Bug 59275 - Document environment variables used by the sanitizers
Summary: Document environment variables used by the sanitizers
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: sanitizer (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2013-11-24 16:14 UTC by Tobias Burnus
Modified: 2013-12-02 05:54 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2013-11-24 16:14:12 UTC
I think invoke.texi should at least mention that the environment variables LSAN_OPTIONS, TSAN_OPTIONS and ASAN_OPTIONS.  (And none for ubsan.)

Better would be if there were a full support, but I admit that that's a rather long list, of supported values:

COMMON:
malloc_context_size
strip_path_prefix
fast_unwind_on_fatal
fast_unwind_on_malloc
symbolize
handle_ioctl
log_path
detect_leaks
leak_check_at_exit
allocator_may_return_null

LSAN:
use_registers
use_globals
use_stacks
use_tls
use_unaligned
report_objects
resolution
max_leaks
verbosity
log_pointers
log_threads
exitcode
suppressions

TSAN:
enable_annotations
suppress_equal_stacks
suppress_equal_addresses
suppress_java
report_bugs
report_thread_leaks
report_destroy_locked
report_signal_unsafe
report_atomic_races
force_seq_cst_atomics
strip_path_prefix
suppressions
print_suppressions
print_benign
exitcode
halt_on_error
log_path
atexit_sleep_ms
verbosity
profile_memory
flush_memory_ms
flush_symbolizer_ms
stop_on_start
external_symbolizer_path
history_size
io_sync
allocator_may_return_null

ASAN:
quarantine_size
verbosity
redzone
debug
report_globals
check_initialization_order
replace_str
replace_intrin
mac_ignore_invalid_free
asan/asan_rtl.cc:  ParseFlag(str, &f->detect_stack_use_after_return,
uar_stack_size_log
max_malloc_fill_size
malloc_fill_byte
exitcode
allow_user_poisoning
sleep_before_dying
handle_segv
allow_user_segv_handler
use_sigaltstack
check_malloc_usable_size
unmap_shadow_on_exit
abort_on_error
print_stats
print_legend
atexit
disable_core
allow_reexec
print_full_thread_history
poison_heap
alloc_dealloc_mismatch
use_stack_depot
strict_memcmp
strict_init_order
Comment 1 Kostya Serebryany 2013-11-24 16:19:06 UTC
Not all of these options are "supported" -- some are for internal use only
and may change or disappear at any time.
The supported ones are described here: 
https://code.google.com/p/address-sanitizer/wiki/Flags
https://code.google.com/p/thread-sanitizer/wiki/Flags

Note that these flags may change too, and so if you document them in gcc docs, 
someone will need to keep the docs in sync with the updates.
Comment 2 Tobias Burnus 2013-11-24 16:26:45 UTC
Partial list for ASAN; linking to it might be an option:
  https://code.google.com/p/address-sanitizer/wiki/Flags#Run-time_flags

Seemingly, there is no list for LSAN/TSAN.

The URL above lists part of the common options, missing are:
  symbolize
  handle_ioctl
  detect_leaks
  leak_check_at_exit
  allocator_may_return_null
and most of the ASAN options, missing are
  allow_reexec
  atexit
  check_malloc_usable_size
  debug
  malloc_fill_byte
  max_malloc_fill_size
  poison_heap
  print_full_thread_history
  print_legend
  print_stats
  replace_intrin
  replace_str
  report_globals
  unmap_shadow_on_exit
  use_sigaltstack
  use_stack_depot
Comment 3 Tobias Burnus 2013-11-24 16:28:11 UTC
(In reply to Kostya Serebryany from comment #1)
> https://code.google.com/p/thread-sanitizer/wiki/Flags

Seems as if the page has changed. Currently, invoke.texi points to:
http://code.google.com/p/data-race-test/wiki/ThreadSanitizer
Comment 4 Kostya Serebryany 2013-11-24 16:32:25 UTC
> Seems as if the page has changed. Currently, invoke.texi points to:
> http://code.google.com/p/data-race-test/wiki/ThreadSanitizer

Link to data-race-test was never correct. 
This is the old and unsupported version of the tool -- it was never part of gcc
or llvm.
Comment 5 Tobias Burnus 2013-11-30 09:11:16 UTC
Author: burnus
Date: Sat Nov 30 09:11:13 2013
New Revision: 205548

URL: http://gcc.gnu.org/viewcvs?rev=205548&root=gcc&view=rev
Log:
2013-11-30  Tobias Burnus  <burnus@net-b.de>

        PR sanitizer/59275
        * doc/invoke.texi (-fsanitize=address,leak): Mention the
        * associated
        environment variable and link to a list with flags.
        (-fsanitize=thread): Ditto and update link.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/invoke.texi
Comment 6 Tobias Burnus 2013-11-30 09:18:45 UTC
Close as sufficiently FIXED.

However, on the Wiki side, one should add the missing items, cf. comment 2, to ASAN/TSAN - and LSAN completely misses a flag description.

Kostya: What's the best way to get them added to the Wiki pages?
Comment 7 Kostya Serebryany 2013-12-02 05:54:29 UTC
(In reply to Tobias Burnus from comment #6)
> Close as sufficiently FIXED.
> 
> However, on the Wiki side, one should add the missing items, cf. comment 2,
> to ASAN/TSAN - and LSAN completely misses a flag description.
> 
> Kostya: What's the best way to get them added to the Wiki pages?
lsan flags are now documented at
https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer
All ASAN/TSAN flags that we wanted to document are already documented 
on their wikis.