public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Hongtao Liu <crazylht@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] hwasan: Check if Intel LAM_U57 is enabled
Date: Thu, 18 Jan 2024 05:22:05 -0800	[thread overview]
Message-ID: <CAMe9rOrt0R9xRbh=LCiaWLP8SSJKQeDBiiD_3Y+pEHCeuoNOFw@mail.gmail.com> (raw)
In-Reply-To: <CAMZc-bwOBLhQLzD1vZX+v758vYuEL1U8=m9okybeNN58RrCp_w@mail.gmail.com>

On Wed, Jan 17, 2024 at 8:51 PM Hongtao Liu <crazylht@gmail.com> wrote:
>
> On Wed, Jan 10, 2024 at 12:47 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > When -fsanitize=hwaddress is used, libhwasan will try to enable LAM_U57
> > in the startup code.  Update the target check to enable hwaddress tests
> > if LAM_U57 is enabled.  Also compile hwaddress tests with -mlam=u57 on
> > x86-64 since hwasan requires LAM_U57 on x86-64.
> I've tested it on lam enabled SRF, and it passed all hwasan testcases
> except below
>
> FAIL: c-c++-common/hwasan/alloca-outside-caught.c   -O0  output pattern test
> FAIL: c-c++-common/hwasan/hwasan-poison-optimisation.c   -O1
> scan-assembler-times bl
> s*__hwasan_tag_mismatch4 1
> FAIL: c-c++-common/hwasan/hwasan-poison-optimisation.c   -O2
> scan-assembler-times bl
> s*__hwasan_tag_mismatch4 1
> FAIL: c-c++-common/hwasan/hwasan-poison-optimisation.c   -O3 -g
> scan-assembler-times bl
> s*__hwasan_tag_mismatch4 1
> FAIL: c-c++-common/hwasan/hwasan-poison-optimisation.c   -Os
> scan-assembler-times bl
> s*__hwasan_tag_mismatch4 1
> FAIL: c-c++-common/hwasan/hwasan-poison-optimisation.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler-times bl
> s*__hwasan_tag_mismatch4 1
> FAIL: c-c++-common/hwasan/hwasan-poison-optimisation.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler-times bl
> s*__hwasan_tag_mismatch4 1
> FAIL: c-c++-common/hwasan/vararray-outside-caught.c   -O0  output pattern test
>
> Basically they're testcase issues, the testcases needs to be adjusted
> for x86/ I'll commit a separate patch for those after this commit is
> upstream.
> Also I've also tested the patch on lam unsupported platforms, all
> hwasan testcases shows unsupported.
> So the patch LGTM.
>
> >
> >         * lib/hwasan-dg.exp (check_effective_target_hwaddress_exec):
> >         Return 1 if Intel LAM_U57 is enabled.
> >         (hwasan_init): Add -mlam=u57 on x86-64.

Pushed.  LAM has been enabled in GCC 13:

[hjl@gnu-cfl-3 tmp]$ gcc -fsanitize=hwaddress -mlam=u57 alloca-outside-caught.c
[hjl@gnu-cfl-3 tmp]$ ./a.out
FATAL: HWAddressSanitizer requires a kernel with tagged address ABI.
[hjl@gnu-cfl-3 tmp]$ strace ./a.out
...
arch_prctl(ARCH_GET_MAX_TAG_BITS, 0x7ffc56267708) = 0
write(2, "FATAL: HWAddressSanitizer requir"..., 69FATAL:
HWAddressSanitizer requires a kernel with tagged address ABI.

I'd like to backport it to GCC 13.

We should mention LAM in changes for GCC 13.

-- 
H.J.

      reply	other threads:[~2024-01-18 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 16:46 H.J. Lu
2024-01-18  4:51 ` Hongtao Liu
2024-01-18 13:22   ` H.J. Lu [this message]

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='CAMe9rOrt0R9xRbh=LCiaWLP8SSJKQeDBiiD_3Y+pEHCeuoNOFw@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=crazylht@gmail.com \
    --cc=gcc-patches@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).