Indu Bhagat <indu.bha...@oracle.com> writes: > [...] > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index ffde9df85fd3..de651183a703 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -17079,6 +17079,14 @@ and @option{-fsanitize=kernel-hwaddress}. > To disable instrumentation of builtin functions use > @option{--param hwasan-instrument-mem-intrinsics=0}. > > +@item memtag-instrument-stack > +Enable MTE tagging of statically sized stack-allocated variables. This kind > of > +code generation is enabled by default when using @option{-fsanitize=memtag}. > + > +@item memtag-instrument-allocas > +Enable MTE tagging of dynamically sized stack-allocated variables. This > kind of > +code generation is enabled by default when using @option{-fsanitize=memtag}. > +
Since this is a target-independent parameter, it might be better to use something more neutral than "MTE", such as "hardware memory tagging". Same elsewhere. > [...] > diff --git a/gcc/opts.cc b/gcc/opts.cc > index 86c6691ecec4..00db662c32ef 100644 > --- a/gcc/opts.cc > +++ b/gcc/opts.cc > [...] > @@ -2780,6 +2788,13 @@ common_handle_option (struct gcc_options *opts, > SET_OPTION_IF_UNSET (opts, opts_set, > param_hwasan_instrument_allocas, 0); > } > + /* Memtag sanitizer implies HWASAN but with tags always generated by > the > + hardware randomly. */ > + if (opts->x_flag_sanitize & SANITIZE_MEMTAG) > + { > + SET_OPTION_IF_UNSET (opts, opts_set, > + param_hwasan_random_frame_tag, 1); > + } Does this have any effect in practice? The default seems to be 1, so I would expect this to be a nop. The pattern elsewhere in the sanitiser code seems to be to use SET_OPTION_IF_UNSET only to turn features off. Thanks, Richard