https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112644

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tamar Christina <tnfch...@gcc.gnu.org>:

https://gcc.gnu.org/g:0debaceb11dee9781f9a8b320cb5893836324878

commit r14-8660-g0debaceb11dee9781f9a8b320cb5893836324878
Author: Tamar Christina <tamar.christ...@arm.com>
Date:   Wed Jan 31 14:50:33 2024 +0000

    hwasan: instrument new memory and string functions [PR112644]

    Recent libhwasan updates[1] intercept various string and memory functions.
    These functions have checking in them, which means there's no need to
    inline the checking.

    This patch marks said functions as intercepted, and adjusts a testcase
    to handle the difference.  It also looks for HWASAN in a check in
    expand_builtin.  This check originally is there to avoid using expand to
    inline the behaviour of builtins like memset which are intercepted by
    ASAN and hence which we rely on the function call staying as a function
    call.  With the new reliance on function calls in HWASAN we need to do
    the same thing for HWASAN too.

    HWASAN and ASAN don't seem to however instrument the same functions.

    Looking into
libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc
    it looks like the common ones are memset, memmove and memcpy.

    The rest of the routines for asan seem to be defined in
    compiler-rt/lib/asan/asan_interceptors.h however compiler-rt/lib/hwasan/
    does not have such a file but it does have
    compiler-rt/lib/hwasan/hwasan_platform_interceptors.h which it looks like
is
    forcing off everything but memset, memmove, memcpy, memcmp and bcmp.

    As such I've taken those as the final list that hwasan currently supports.
    This also means that on future updates this list should be cross checked.

    [1]
https://discourse.llvm.org/t/hwasan-question-about-the-recent-interceptors-being-added/75351

    gcc/ChangeLog:

            PR sanitizer/112644
            * asan.h (asan_intercepted_p): Incercept memset, memmove, memcpy
and
            memcmp.
            * builtins.cc (expand_builtin): Include HWASAN when checking for
            builtin inlining.

    gcc/testsuite/ChangeLog:

            PR sanitizer/112644
            * c-c++-common/hwasan/builtin-special-handling.c: Update testcase.

    Co-Authored-By: Matthew Malcomson <matthew.malcom...@arm.com>

Reply via email to