public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tnfchris at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/112644] [14 Regression] Some of the hwasan testcase fail after the recent merge
Date: Fri, 01 Dec 2023 10:40:33 +0000	[thread overview]
Message-ID: <bug-112644-4-MTiwSFDEyt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112644-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Matthew has been working on this and so far has concluded:

Summary of main problem:

New libhwasan runtime libraries have added interceptors for various mem*, str*
functions (and I think others -- I do not have full list).

With old runtime libraries these were not intercepted, and we emitted inline
instrumentation to accommodate.
Removing our instrumentation is fine (though with the caveat that we need to
ensure we have the full list of functions which are now intercepted).

However, the libraries hard-code the choice to abort on error, which means the
HWASAN_OPTIONS environment variable can no longer be used to ensure recover on
error (-fsanitize-recover=hwaddress option).

Changes I believe should happen:
- LLVM upstream libsanitizer code be changed to allow recovery -- AFAIK there
is no functional loss from using ErrorAction::Recover in the checking.
- We find the list of functions which are now instrumented, and update
asan_instrumented_p accordingly (plus a testcase or two for this).

The first one was discussed on the LLVM discourse and it was deemed a bug
https://discourse.llvm.org/t/hwasan-question-about-the-recent-interceptors-being-added/75351/4
and a PR made to fix it https://github.com/llvm/llvm-project/pull/74000

Once that's merged we can re-sync and we need to update the list of intercepted
functions in asan_intercepted_p (in gcc/asan.h).  One of the reasons for the
change is that LLVM now replaces calls to e.g. memset with __hwasan_memset to
avoid later passes optimizing the call.  It looks like we need to do that for
GCC as well.

Matthew will be away for a while so will take over the patch from him in
stage-4.

  parent reply	other threads:[~2023-12-01 10:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21  1:01 [Bug sanitizer/112644] New: " pinskia at gcc dot gnu.org
2023-11-21  1:01 ` [Bug sanitizer/112644] " pinskia at gcc dot gnu.org
2023-11-21  1:04 ` pinskia at gcc dot gnu.org
2023-11-21  1:10 ` pinskia at gcc dot gnu.org
2023-11-21 10:26 ` jakub at gcc dot gnu.org
2023-11-22 11:19 ` tnfchris at gcc dot gnu.org
2023-11-22 11:20 ` jakub at gcc dot gnu.org
2023-12-01 10:40 ` tnfchris at gcc dot gnu.org [this message]
2023-12-01 10:41 ` tnfchris at gcc dot gnu.org
2023-12-05 10:18 ` tnfchris at gcc dot gnu.org
2024-01-29 17:26 ` tnfchris at gcc dot gnu.org
2024-01-31 14:49 ` cvs-commit at gcc dot gnu.org
2024-01-31 14:50 ` cvs-commit at gcc dot gnu.org
2024-01-31 14:52 ` cvs-commit at gcc dot gnu.org
2024-01-31 14:54 ` tnfchris at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112644-4-MTiwSFDEyt@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).