From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2078) id 870363858D28; Thu, 25 Jan 2024 04:42:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 870363858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706157773; bh=8bgx/87Rrl9VBsXm7he2bKQbs9vEolH81SfaRaTQTwE=; h=From:To:Subject:Date:From; b=K3E/6ExXEkplNQU0CMl/EQjpnq/Mknbm5c+R+mDVDdtLkRw4UnjUwgSP4VAeKm7m8 BVcH44i3geYrKKM7ye2dx/SvMkhE3Cd+dwkYeZ93D4OV52rgBBRwCxwfkdq1X2FGDT 0vi+f3TjR8qvdBxbFpD2YSD9mEN8p+wPMJKgANpw= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: hongtao Liu To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8409] Adjust hwasan testcase for x86 target. X-Act-Checkin: gcc X-Git-Author: liuhongt X-Git-Refname: refs/heads/master X-Git-Oldrev: 6ff54cc0be8dfa9d9bd5922ec65e86c9eb644711 X-Git-Newrev: 025b8f5eb71d1b774eb0bd44876093aab853b899 Message-Id: <20240125044253.870363858D28@sourceware.org> Date: Thu, 25 Jan 2024 04:42:53 +0000 (GMT) List-Id: https://gcc.gnu.org/g:025b8f5eb71d1b774eb0bd44876093aab853b899 commit r14-8409-g025b8f5eb71d1b774eb0bd44876093aab853b899 Author: liuhongt Date: Tue Jan 23 13:35:39 2024 +0800 Adjust hwasan testcase for x86 target. There're 2 cases: 1. hwasan-poison-optimisation.c is supposed to scan call to __hwasan_tag_mismatch4, and x86 have different mnemonic(call) from aarch64(bl), so adjust testcase to scan either call or bl. 2. alloca-outside-caught.c/vararray-outside-caught.c are supposed to scan mismatched tags and expected the tag corresponding to out-of-bounds memory is 00, but for x86 the continous stack is allocated by other local variable/array which is assigned with a different tag, but still there're mismatches. So adjust testcase to scan XX/XX instead of XX/00. gcc/testsuite/ChangeLog: * c-c++-common/hwasan/alloca-outside-caught.c: Adjust testcase. * c-c++-common/hwasan/hwasan-poison-optimisation.c: Ditto. * c-c++-common/hwasan/vararray-outside-caught.c: Ditto. Diff: --- gcc/testsuite/c-c++-common/hwasan/alloca-outside-caught.c | 2 +- gcc/testsuite/c-c++-common/hwasan/hwasan-poison-optimisation.c | 2 +- gcc/testsuite/c-c++-common/hwasan/vararray-outside-caught.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/c-c++-common/hwasan/alloca-outside-caught.c b/gcc/testsuite/c-c++-common/hwasan/alloca-outside-caught.c index 6f3825bee7c..f31484a2613 100644 --- a/gcc/testsuite/c-c++-common/hwasan/alloca-outside-caught.c +++ b/gcc/testsuite/c-c++-common/hwasan/alloca-outside-caught.c @@ -20,6 +20,6 @@ main () } /* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */ -/* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/00.* \\(ptr/mem\\) in thread T0.*" } */ +/* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/\[\[:xdigit:\]\]\[\[:xdigit:\]\].* \\(ptr/mem\\) in thread T0.*" } */ /* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */ /* { dg-output "SUMMARY: HWAddressSanitizer: tag-mismatch \[^\n\]*.*" } */ diff --git a/gcc/testsuite/c-c++-common/hwasan/hwasan-poison-optimisation.c b/gcc/testsuite/c-c++-common/hwasan/hwasan-poison-optimisation.c index 2d6bab4c578..48cf88744eb 100644 --- a/gcc/testsuite/c-c++-common/hwasan/hwasan-poison-optimisation.c +++ b/gcc/testsuite/c-c++-common/hwasan/hwasan-poison-optimisation.c @@ -22,7 +22,7 @@ main () } /* { dg-final { scan-tree-dump-times "ASAN_POISON" 1 "asan1" } } */ -/* { dg-final { scan-assembler-times "bl\\s*__hwasan_tag_mismatch4" 1 } } */ +/* { dg-final { scan-assembler-times "(?:bl|call)\\s*__hwasan_tag_mismatch4" 1 } } */ /* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */ /* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/00 \\(ptr/mem\\) in thread T0.*" } */ /* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */ diff --git a/gcc/testsuite/c-c++-common/hwasan/vararray-outside-caught.c b/gcc/testsuite/c-c++-common/hwasan/vararray-outside-caught.c index 35a344def42..743a894ede9 100644 --- a/gcc/testsuite/c-c++-common/hwasan/vararray-outside-caught.c +++ b/gcc/testsuite/c-c++-common/hwasan/vararray-outside-caught.c @@ -17,6 +17,6 @@ main () } /* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */ -/* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/00 \\(ptr/mem\\) in thread T0.*" } */ +/* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/\[\[:xdigit:\]\]\[\[:xdigit:\]\].*\\(ptr/mem\\) in thread T0.*" } */ /* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */ /* { dg-output "SUMMARY: HWAddressSanitizer: tag-mismatch \[^\n\]*.*" } */