From patchwork Tue Jan 23 06:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhongt X-Patchwork-Id: 1889521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=A0CQj/T2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TJyJM0xVNz1yS7 for ; Tue, 23 Jan 2024 17:45:07 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 039A1385843A for ; Tue, 23 Jan 2024 06:45:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by sourceware.org (Postfix) with ESMTPS id D6D773858D32 for ; Tue, 23 Jan 2024 06:44:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D6D773858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D6D773858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705992284; cv=none; b=d8EeMwoHkCpXi0K7lX0o7KC3T++FHLld1/r8ro2nWRg6XPUNdvwz472SHvZrMaXqkTcTuxZ9UVg5SkCpkaLoS/aoRz1i13y9qMPFu+nnZI5oxGQWj8XUi0gi6yDmuVQj3hS/kslTd/CCq9J3CbEyTi4+AyxP/d5gxp19onaRqr4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705992284; c=relaxed/simple; bh=BcWIid2VPgZR4ow9c6V7BtRE+2bj0tYw6mcofFLGSCc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=pZtSwtzOz2B14G9cyzpUh2CbZCTdOIRw0604Q+d7xIL5K1w3a08nLlU6qPZfmsnS9Le10cq2mIzJ5+TjeMXrJFR2hWXcbJ5vflkrarWOjII5FK4lYcVloTo3eKTaUgDqJIafneMkgjlwpmlZKiCztsCyAQpmNWiCftUI8bBFFQ8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705992283; x=1737528283; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BcWIid2VPgZR4ow9c6V7BtRE+2bj0tYw6mcofFLGSCc=; b=A0CQj/T2h2v+qOlgHYjHfT5Vqnhlrq/w2V2DToipZWOmPphKlKs6wogu EqHeTXMpGnJr7nQXV70Z0s/+YmPbuzHjUFkF+hMNJi5lgsaKRwaak1ZTd qGjFxBQ+438q2Z6UgVxExxZcs8lKOzBol0fol0XFbP/E2H9+tsvWuEQsc X+jGltegAj4coHa6fqLMbpg+OC71TrxVaCXMilhk+YfvcjtpDUFurmJYN 0P4Taqo4U+iFGCPlLmhFkEJVAUh24KHS8khkn4IiP7jbRE5IfKpBbrx6U 2nNGMcCoPXKXrBczcg/weUf2qG4on8iB+ME7LfcycIqzUeiuQ/1qGilG3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="8103216" X-IronPort-AV: E=Sophos;i="6.05,213,1701158400"; d="scan'208";a="8103216" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 22:44:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,213,1701158400"; d="scan'208";a="1486205" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orviesa003.jf.intel.com with ESMTP; 22 Jan 2024 22:44:38 -0800 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 5583510056F9; Tue, 23 Jan 2024 14:44:36 +0800 (CST) From: liuhongt To: gcc-patches@gcc.gnu.org Cc: crazylht@gmail.com, hjl.tools@gmail.com Subject: [PATCH 1/2] Adjust hwasan testcase for x86 target. Date: Tue, 23 Jan 2024 14:42:35 +0800 Message-Id: <20240123064236.1827190-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org 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. Ok for trunk? 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. --- 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\]*.*" } */