Indu Bhagat <[email protected]> writes:
> Add new command line option -fsanitize-memtag-mode with three possible
> values:
> - sync (default)
> - async
> - asymm
> This allows the user to select the fault conveyance model when using MTE
> instructions for their applications.
Not sure about the name "asymm": it doesn't say which way it's
asymmetrical. Maybe syncread would have been more explicit.
But I agree we should go with what Clang has established.
> This option is not (sanity checked) processed in GCC at all currently. If bad
> args / unsupported args are passed, ld will complain.
>
> TBD:
> - This option is not checked / processed in GCC at all currently.
> - asymm is not specified in Memtag ABI...
> - clang has -fsanitize-memtag-mode=<value>
> Sets default MTE mode to 'sync' (default) or 'async'
>
> gcc/ChangeLog:
>
> * doc/invoke.texi: Document -fsanitize-memtag-mode.
>
> ---
> [New in RFC V2]
> ---
> gcc/doc/invoke.texi | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index de651183a703..b33585430e6a 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -18032,6 +18032,18 @@ Use Memory Tagging Extension instructions instead of
> instrumentation to allow
> the detection of memory errors. This option is available only on those
> AArch64
> architectures that support Memory Tagging Extensions.
>
> +@opindex -fsanitize-memtag-mode
> +@item -fsanitize-memtag-mode=@r{[}sync@r{|}async@r{|}asymm@r{]}
> +Control the fault conveyance model of MTE instructions. Mismatched logical
> and
> +allocation tags are detected during a load/store operation.
We'd need to phrase this in a way that isn't AArch64-specific.
Users might also not be familiar with the terms "logical tags" and
"allocation tags".
Otherwise this LGTM part from a nit:
> In @code{sync}
> +mode, exceptions are precise, providing the exact instruction where the fault
> +occurred, and the exact faulting address. The @code{aysnc} mode allows
> +imprecise detection that a fault has occurred, at the benefit of increased
s/at the benefit/with the benefit/
Thanks,
Richard
> +performance over the synchronous mode. The @code{asymm} mode provides
> +synchronous checking on memory reads, and asynchronous checking of memory
> +writes. The selection of fault conveyance model does not alter code
> +generation.
> +
> @opindex fsanitize=pointer-compare
> @item -fsanitize=pointer-compare
> Instrument comparison operation (<, <=, >, >=) with pointer operands.