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\]*.*" } */ From patchwork Tue Jan 23 06:42:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhongt X-Patchwork-Id: 190752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp156151dyi; Mon, 22 Jan 2024 22:45:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7BGP3l+M/CKdPgFMewvwMpEy0jojEyz4xFaobCvl26ryYWDuj+SERk/Y39rAF+I5huYoM X-Received: by 2002:ac8:7d04:0:b0:42a:4a6d:8b00 with SMTP id g4-20020ac87d04000000b0042a4a6d8b00mr477743qtb.30.1705992326098; Mon, 22 Jan 2024 22:45:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705992326; cv=pass; d=google.com; s=arc-20160816; b=lThGPUwfInQVy9m1+qN3GKJZ84499Jnm1znob2OcTKsF82rqucik9cxrjJsGMbYz2Y oll6UMGJ04Jcffeo49x3JeXvcOAWxIgQd2C/6qeEDDVAbWbUlXCQWT3VqbaGoy28FLJy Cz1oH7ZPc3W9vuPqFk4PErHmUq5RzzXGo1GY/c+nxv+/qS3VxyJ3T0aJ6J9tlv9Wl3dw qKaDN3UjZjcw20UVG8TVb5QaeVajBq+FQCh7cCC0/XWz+OlUOG9CrE2KExLkZkneKBkH mR5AsFCGUq3PwuLOcW1I9/dPQEN7Lb+LEvCM2W9soqfgTh/U30QjFtGrHghuXpxY+k61 hEAw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=QGggBtFpqTIcqqUM1GHckHxxocPp9pQsG5tbw0ok28c=; fh=ChXOctppJn0KECDRINafwUY5xHRufGHaa0Ju9pddrcQ=; b=evV+m25n9shWmxDl1hAx5uc1PXvRMhcq2rOgQOMK7tUrak33NHIChRzK4R3fUzU5q+ Ouwjx5zk9BadmS8Yrz8VdmBcmNySNsRkl79OwD8oLfmpmRVyPDbwB6d8vRYkSC5dnM19 BOaLhLfpgdxQJSBts+2WeDPXgTVyWV1rEsYHh+rt/KQlLbhIhhOXJQKQBgCdLkdVtD6Q lLrFRzrpWIRSt8VQcffl2kgY0hDPAvCszWzedF2BWJ7tEVtawWD5Jh0yqpFGbDXp+t3U pcsiRyI66LNDnpRLKf/EiUF4L2mfFsnwjWo0Q1WfdtCznjt5PJq/zaF4uQ7+I/Lm8nKQ JjIg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c+ih+m17; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id d12-20020ac85d8c000000b0042a1be95af3si7356792qtx.672.2024.01.22.22.45.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 22:45:26 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c+ih+m17; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 CBB853858436 for ; Tue, 23 Jan 2024 06:45:25 +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 43F9F3858D20 for ; Tue, 23 Jan 2024 06:44:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 43F9F3858D20 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 43F9F3858D20 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=1705992281; cv=none; b=bSs7Yp3vIGiDm0v3e75oIGIXnV1EHaaNY0yOsnzR7vCBjmpwO76rjsQh3vpqjGZDO/eV9xZohcJ4/pTEnVYhsHILSfvtR89PX8l1aghAxCmgIT3n8gqEylsbD6fZVX+qu9F3FlFcjolQdvrOy9+1qsPw8P6+PcNBKNXdqj3m544= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705992281; c=relaxed/simple; bh=qElxfzHjIR4fZmFoNQfDKrj5YtI74pqXfrhAXiuPI0A=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=iT025a0fPU1bhhTsqm4Gcqk41EvbmTrOrQf7gIRZTgk8k+KYeAuSohT7q/RbwDqnZsjYC7q/CDPYAag+P+w4PA7+THCTDSbNSpdMgz3GDKfkMi+jKoHITMtBEyT5dWJTfnmgrmS0cFWF80us4VG3hnJz0tS0ByogBqdfeM9GeJw= 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=1705992280; x=1737528280; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qElxfzHjIR4fZmFoNQfDKrj5YtI74pqXfrhAXiuPI0A=; b=c+ih+m17Mw5QIYwptTnXa6CnDsjR6OlRmU80q02nGcKmYx/l/chL4f+U D8ApJs1P1+PTDGxr+g9HrmakJFdJtOtPjMOHyYd5VtnnRbNZdoN5LRxR4 JX9v/HyGFxCD+xtXak+DokrvDdRINgobBXkiT56C/+Je4RuCmQrlylPZ5 da1j/6qHJvAT2zVOdki9dPNMsm0ZYrz7PZ7nfAsIXUHcn730ODy7qAV6K o7K2Ytg18G74v7+eFdmQ1Pgi5h+DOyyQuygh/W8jqR2Arh1ETNDdE0hAo Zd83Y1VkTM6mT5qWltVIMb4LTKF4KGXyMDi+auI8NNz8KTbDhbRNO91uF Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="8103215" X-IronPort-AV: E=Sophos;i="6.05,213,1701158400"; d="scan'208";a="8103215" 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:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,213,1701158400"; d="scan'208";a="1486204" 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 57F4910056FA; 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 2/2] [x86] Enable -mlam=u57 by default when compiled with -fsanitize=hwaddress. Date: Tue, 23 Jan 2024 14:42:36 +0800 Message-Id: <20240123064236.1827190-2-hongtao.liu@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240123064236.1827190-1-hongtao.liu@intel.com> References: <20240123064236.1827190-1-hongtao.liu@intel.com> 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: 1788862609070855369 X-GMAIL-MSGID: 1788862609070855369 Ready push to trunk. gcc/ChangeLog: * config/i386/i386-options.cc (ix86_option_override_internal): Enable -mlam=u57 by default when compiled with -fsanitize=hwaddress. --- gcc/config/i386/i386-options.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index b6f634e9a32..e66a58ed926 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -2189,6 +2189,15 @@ ix86_option_override_internal (bool main_args_p, && opts->x_ix86_abi != DEFAULT_ABI) error ("%<-mabi=%s%> not supported with %<-fsanitize=thread%>", abi_name); + /* Hwasan is supported with lam_u57 only. */ + if (opts->x_flag_sanitize & SANITIZE_HWADDRESS) + { + if (ix86_lam_type == lam_u48) + warning (0, "%<-mlam=u48%> is not compatible with Hardware-assisted " + "AddressSanitizer, override to %<-mlam=u57%>"); + ix86_lam_type = lam_u57; + } + /* For targets using ms ABI enable ms-extensions, if not explicit turned off. For non-ms ABI we turn off this option. */