[Bug sanitizer/82501] AddressSanitizer does not handle negative offset for first global variable
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 21 13:02:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82501
--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
I started working on this, but it's not easy to register dummy global
variables. If I see correctly, global vars are emitted into assembly here:
#0 assemble_variable (decl=<var_decl 0x7ffff7feeab0 global3>, top_level=0,
at_end=1, dont_output_data=0) at /home/marxin/Programming/gcc/gcc/varasm.c:2271
#1 0x0000000000fe1502 in varpool_node::assemble_decl (this=<varpool_node *
const 0x7ffff6b0b000 "global3"/0>) at
/home/marxin/Programming/gcc/gcc/varpool.c:586
#2 0x000000000090d12d in output_in_order () at
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2369
#3 symbol_table::compile (this=0x7ffff6990100) at
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2609
#4 0x000000000090f54d in symbol_table::compile (this=0x7ffff6990100) at
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2788
#5 symbol_table::finalize_compilation_unit (this=0x7ffff6990100) at
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2788
#6 0x0000000000cf4164 in compile_file () at
/home/marxin/Programming/gcc/gcc/toplev.c:480
#7 0x0000000000798e80 in do_compile () at
/home/marxin/Programming/gcc/gcc/toplev.c:2170
#8 toplev::main (this=0x7fffffffd90e, argc=<optimized out>, argv=<optimized
out>) at /home/marxin/Programming/gcc/gcc/toplev.c:2305
#9 0x00000000015db48d in main (argc=20, argv=0x7fffffffda08) at
/home/marxin/Programming/gcc/gcc/main.c:39
Will it be needed to check that a variable is asan_protect_global (decl) and if
it's first variable in a section then emit a dummy global variable here? It's
crucial to put the dummy variable at the very beginning of each section.
More information about the Gcc-bugs
mailing list