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: 190753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp156163dyi; Mon, 22 Jan 2024 22:45:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoTq5IaGwqAukCURoNPkg+k8Z7z6cyIF8ErHWrJH9Y+lycFaejCHD6ruqceAaxNzOYsR1z X-Received: by 2002:a05:620a:284b:b0:783:85cb:a741 with SMTP id h11-20020a05620a284b00b0078385cba741mr7547378qkp.31.1705992328522; Mon, 22 Jan 2024 22:45:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705992328; cv=pass; d=google.com; s=arc-20160816; b=oFqu9GfviU05NJwh9HRcqyccICbyxHPfGMCEtX3Bux/EAnqBvfqF+JV47Y50EV9oEo IkEXQSjBHRWow+S7WITXGif+mRl1iUZllMegcp+go/TBsljPPCiwKdfs5idG31fRsRXA LerCKXvC0hJF0OdB651Bd8JLpCtkT4yUlWSkvZiNB1vzDY/hUIlBG2txnkOoxt13OGtr R1bzyw5YhYROJGdrzo2SLUkYRImE5ezJWDKT+Xw6r2fJxmpzUZYrYYb1h62JbZpdBqX/ q1EQ2cp5LzJ10vf8VNg64pKWmrL/xSWeAdlNqPfAYTgACnTvtzNptzZbX9dufn4O8LCq wCKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=lXE7oNa4xD1GmAcEQHM42Qpf4rMeRJWMTOI7LqB7ae0=; fh=ChXOctppJn0KECDRINafwUY5xHRufGHaa0Ju9pddrcQ=; b=tx5k7bic0EEvQJ40cxjMNifMYoJqLVg4vjy1bCe7EK5ghbxXQYYEemc77xJYkjtmVJ 1mUkW5w1sHIJdZcHK8G+OjOeUBNxm3oK+S6oblTiUdKCvupGYi1C67guECPTYzWhNp/l EpRgVFvkSJRfQLeOq8qr6eGLMBzcRjxthX8NaNao0PTV0KqiypEZoT5aFWXWx/vfWrt4 cTe6FZY0l5SoPZJpoLEJjuGMPkmKGeVEoMZqm9k6JLybnZKso7BmmGnBSRRa20EYFq/t AovDMjv6O0mwkeugqDbgaPd5WllIUFznkz7Nbe920lRgK9k5Q54rfb0agXsDw3umfn0H /q8g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="A0CQj/T2"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f19-20020a05620a15b300b007839e6d373esi4048976qkk.442.2024.01.22.22.45.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 22:45:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="A0CQj/T2"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 37259385843B for ; Tue, 23 Jan 2024 06:45:28 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788862611890887053 X-GMAIL-MSGID: 1788862611890887053 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\]*.*" } */