From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80107.outbound.protection.outlook.com [40.107.8.107]) by sourceware.org (Postfix) with ESMTPS id 439D6385828E for ; Tue, 5 Jul 2022 06:30:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 439D6385828E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=Syrmia.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Syrmia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D16cDsRozFTP4AERwGV9K2upvSkgvbEvDP/DT4fzELf7b7tcA4y3ZDW8P8MOfq+jSckwEfyVJ7GWbon/r047ysp8G+5C3LVF59AkzrA0KBhPNMDqQfKctGWe7U0qA5x95RcrJkBjPyYnotTG+T1AgWe42AIxeFPUk3Mzoz0bzgO7wTV+eFD7h1ubixJqWR4jXbI5qpG/4uIHzpQgjlEfyxl2GcARy9MvlJV5Cl4rU4BurCZHI9CDJbUdm83ZRme4d/FGKzX0/x8Rm/MBK7nXt8s1dvqZCkCbwJEHbVSkZOsy8zGFRssnOXdiVrHfXXHVR/3xH++wtonRNTd2PiaB7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IG0KlZ4pGeKD9EI4T1QbF1aJKSx6nmSWHaS+tLkX/eQ=; b=P9yFoz2PUzmd2znxG7jcUvJLa9IxrjprRtj8PySoTF6WHzg1f8lcAp5iIV6lt65T9YpeGHHHSc+qMX7do5em9rlD3l6MuIR0d3MJvrsD6Q+oYcxrOfMjGPrqzzIZyWJTtVV97XJRwFCXfVhqIAPya7g5peUEg7sGpKK/2DnB7PfQIO/z5o3/JP5l4y5mfHKJPPlaSIWQXqSI8kBFtS42UIfeubvpHCEjaso5MuhrmqRS3Gc/COyDBtHkJpy3Mxt8ZSqJ9DySqLuwEPALBdIMqUc1osNSsy7qF0dT/6nTDY4RhM82tfdsfcjcVvvmC7sr9QTz7tuhJ9S3Zs7GiqQ6IQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IG0KlZ4pGeKD9EI4T1QbF1aJKSx6nmSWHaS+tLkX/eQ=; b=txGOaBJfaIFcSzFEpiy79N7X1I31IaLJgudzvovxuSvHkWvumQq8psSPWUa+ifChWZ83Ya+kDfeMjdlvnwuaeGx4FHhTVjFsJsrSv8AQ4fZ4m2C16fVSUIHeNEAEBzVqFPOaBjDZT3lMEFpDi8R2i+jVaVA8XsxRwD7URqYGJOY= Received: from AM0PR03MB4882.eurprd03.prod.outlook.com (2603:10a6:208:fb::17) by VI1PR0301MB6672.eurprd03.prod.outlook.com (2603:10a6:800:17f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21; Tue, 5 Jul 2022 06:30:50 +0000 Received: from AM0PR03MB4882.eurprd03.prod.outlook.com ([fe80::3926:6805:c765:27ec]) by AM0PR03MB4882.eurprd03.prod.outlook.com ([fe80::3926:6805:c765:27ec%7]) with mapi id 15.20.5395.020; Tue, 5 Jul 2022 06:30:50 +0000 From: Dimitrije Milosevic To: Xi Ruoyao , "gcc-patches@gcc.gnu.org" CC: Djordje Todorovic Subject: Re: [PATCH] Mips: Enable asynchronous unwind tables with both ASAN and TSAN Thread-Topic: [PATCH] Mips: Enable asynchronous unwind tables with both ASAN and TSAN Thread-Index: AQHYcn4I0I45Pn2LTE2LxMfdNXuhBa02/brFgAysSgCAAB860IAGaEyAgCRMDQiAAMGiAIAASkP0 Date: Tue, 5 Jul 2022 06:30:50 +0000 Message-ID: References: <7e4db89fea59f636afd7abce981cc625d940b5cd.camel@xry111.site> In-Reply-To: <7e4db89fea59f636afd7abce981cc625d940b5cd.camel@xry111.site> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: 998965fb-c3e6-dbe4-c951-24aead5d058c authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=Syrmia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 67c7aa69-2d4d-49d9-f4fe-08da5e4fe767 x-ms-traffictypediagnostic: VI1PR0301MB6672:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DX69FSv2JlNG7GfIN9lGMX+PAov9Bw/YVzg2SyI6EIEgx53dIZgGLXBHvBxB3SCqtqELlQf+XJ/Zd48QQ7Nho0ea8Cu7bRG1Ffw58uRNm/1qm0FZ5SGFAwAsgSRYWpqt6iaRn+9WmlwPdgeRZ+FbutaYSBfN9WwC9AZN6T3e31fwmffbtuCwVAHQysZQfUmdUpwoPNCrh2pRSq54EpMoXYr+QafHv2Btvf8bKHzHW+MLCp3kKjQQULsWGa9Cb3PZ+I/qHxFvhLF/BApGdE9RV9+/FQoYBXpW3oc1KyyrZ4Cdp9smqN4Je9Tz9o5ljoaLED55AfltZIQyhgxtj37COZaIpYCQrNjDAqsKObUI3SkOzlgVnRNetHtNI47tMqu9/gxj5R60jOPtbrAUtEy1/58QWszw9KcFUTBldHTRh5uj2EUx15QoZzrNYg7OclruSQsEJQPCH4UybWo/q97qSHW6kSCJqUNIrjzbW6aoMBvrgqMDvZ+/KqTqc02nfexHBDIB2eBWBNyUT/Lrm1988ehoQjGAg3IRSchEeA+aAUnYCwZjscH8nC1ApKXoNBsSzlhAHFnuMf2mXTvHKP7KcaJpzrM72sFj24Ypo0yH4ozYel9Da6fMCpAARJeT4lUhlroAf4PMWCd7eUVEbYSNB9ALxU1u1Ns8cu0NchMLRJTerM5RW62onroL0ZSCSGOmpnawH+K6uefY8k3Vp2fxHnqLgNYpojCFCb8/F2NqqBhXxlw+X/ExpAgml4izTZ4m3M+Bim2Xci6kgwk7dllmbE8yaiAvYFS7XOt8a61dzgUdezofP0lh/vugR+jnrwjY x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR03MB4882.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(39830400003)(376002)(396003)(346002)(366004)(38100700002)(86362001)(38070700005)(122000001)(76116006)(64756008)(4326008)(66556008)(66946007)(66476007)(110136005)(316002)(55016003)(91956017)(66446008)(8676002)(5660300002)(52536014)(8936002)(186003)(107886003)(83380400001)(9686003)(71200400001)(478600001)(26005)(53546011)(7696005)(6506007)(33656002)(41300700001)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?Kaadiozy5udetSi4MbPJmPiFriFttqXZQ/TLUT1TOGw5Qs8XzTIj2rb2x9?= =?iso-8859-1?Q?7GZXJs+XrH2oobcvKJl+HpE9/I3HiM/bWO8mI3llu6QUZ+gIKWCODjGgQW?= =?iso-8859-1?Q?CFu3/4P3HpqjZLA7BBnSz+heFTVmRXU4aoh3sDdXxDTGKic8LUwPc2upnh?= =?iso-8859-1?Q?dlh6Hw1fbvT/F0NHknCEotEoA0Le8BpmLWOlkjCgC9XOujsPaEdRSKwUKj?= =?iso-8859-1?Q?NLCuAfPMrNkZPGdKtrx6fNbLL+IXfVVtc/pZb4oE1Wm/a2+/d1FlTPfM/T?= =?iso-8859-1?Q?4kJZtdUj6g6SObIMBVo3B68q8nJOZh6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Q?/YjuaWtW5GJoA0BZzcdzTTMvAu9QW4V74NUYcimbYAwcPsf5kT9DZwgkSb?= =?iso-8859-1?Q?z5Impr3OmqlE6py6dU88ZzpakiX/1OVTmHmjSQiiwOXyPBlBgbRKm8KsiH?= =?iso-8859-1?Q?t4/cnqBcODfejudJK0lMiCu044gaI54uNy0DkN2Gx7T7rEE7Pa9tS1tg9w?= =?iso-8859-1?Q?QQmEcfT1N4CXgyGYiBWbv3Ca6iFvljrWt2RJ5Hc5LvC+q73N8dVuDNMbYG?= =?iso-8859-1?Q?MRiSYi2UWy+B9bTVOD3/yWA3NGZa1BHzEoKFQupyiqjaQefLTn13AH3LoX?= =?iso-8859-1?Q?bRcwRQ48tQygI4y1pLpX32E+l6Muy+01RprxWzsd9Aowh8PMm0kW5wYB6L?= =?iso-8859-1?Q?k91Pt1Yd4sjv9oLT90bciaU1ejmi3XMfN+YrVPxfJUWmp9xzGEWGnY35+M?= =?iso-8859-1?Q?4FidT3U5NUxOvKHQORRpTYIu2kxxSEZb3IfoNidXVL9hWmIlpQOAJC2g?= =?iso-8859-1?Q?=3D=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR03MB4882.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67c7aa69-2d4d-49d9-f4fe-08da5e4fe767 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2022 06:30:50.3654 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Jw8lf6HwHJ645yvEZhI8bUjAc5hC7DHVUytytnIvtCxrnvBrxEc+0j5N26LnefkdXsBL2gFf/AqyRTPnso4yjuiEjZ6/6UKDmI98L1HvwW4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0301MB6672 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2022 06:30:57 -0000 Hi Xi.=0A= Correct, I am using a simulator.=0A= Here are my changes:=0A= =0A= diff --git a/libsanitizer/configure.tgt b/libsanitizer/configure.tgt=0A= index fb89df4935c..6855a6ca9e7 100644=0A= --- a/libsanitizer/configure.tgt=0A= +++ b/libsanitizer/configure.tgt=0A= @@ -55,6 +55,10 @@ case "${target}" in=0A= arm*-*-linux*)=0A= ;;=0A= mips*-*-linux*)=0A= + if test x$ac_cv_sizeof_void_p =3D x8; then=0A= + TSAN_SUPPORTED=3Dyes=0A= + TSAN_TARGET_DEPENDENT_OBJECTS=3Dtsan_rtl_mips64.lo=0A= + fi=0A= ;;=0A= aarch64*-*-linux*)=0A= if test x$ac_cv_sizeof_void_p =3D x8; then=0A= =0A= Nit: Updated the code in gcc/config/mips/mips.cc a little bit, but no funct= ional=0A= change compared to your version.=0A= =0A= diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc=0A= index 8a55d2fb8f7..4ccc9e75482 100644=0A= --- a/gcc/config/mips/mips.cc=0A= +++ b/gcc/config/mips/mips.cc=0A= @@ -20118,13 +20118,12 @@ mips_option_override (void)=0A= /* -fsanitize=3Daddress needs to turn on -fasynchronous-unwind-tables=0A= in order for tracebacks to be complete but not if any=0A= -fasynchronous-unwind-table were already specified. */=0A= - /* FIXME: TSAN could also utilize -fasynchronous-unwind-tables, but=0A= - should be first enabled for MIPS64.=0A= - FIXME: HWSAN could also utilize -fasynchronous-unwind-tables, but,=0A= + /* FIXME: HWSAN could also utilize -fasynchronous-unwind-tables, but,=0A= currently, it is only available on AArch64.=0A= FIXME: We would also like to check if -ffreestanding is passed in.=0A= However, it is only available in C-ish frontends. */=0A= - if ((flag_sanitize & SANITIZE_USER_ADDRESS)=0A= + if (((flag_sanitize & SANITIZE_USER_ADDRESS)=0A= + || (TARGET_64BIT && (flag_sanitize & SANITIZE_THREAD)))=0A= && !global_options_set.x_flag_asynchronous_unwind_tables)=0A= flag_asynchronous_unwind_tables =3D 1;=0A= =0A= =0A= =0A= From: Xi Ruoyao =0A= Sent: Tuesday, July 5, 2022 3:54 AM=0A= To: Dimitrije Milosevic ; gcc-patches@gcc.g= nu.org =0A= Cc: Djordje Todorovic =0A= Subject: Re: [PATCH] Mips: Enable asynchronous unwind tables with both ASAN= and TSAN =0A= =A0=0A= On Mon, 2022-07-04 at 14:28 +0000, Dimitrije Milosevic wrote:=0A= > On Saturday, June 11, 2022 2:03 PM, Xi wrote:=0A= > > Just tried TSAN_SUPPORTED=3Dyes with asynchronous unwind tables=0A= > > enabled,=0A= > > but I got some strange test failures for tls_race.c:=0A= > > =0A= > > FAIL: c-c++-common/tsan/tls_race.c=A0=A0 -O0=A0 output pattern test=0A= > > Output was:=0A= > > ThreadSanitizer: CHECK failed: tsan_platform_linux.cpp:452=0A= > > "((thr_end)) <=3D ((tls_addr + tls_size))" (0xffec35f8c0,=0A= > > 0xffec35f784) (tid=3D748216)=0A= > > =A0=A0=A0 #0 __tsan::CheckUnwind()=0A= > > ../../../../gcc/libsanitizer/tsan/tsan_rtl.cpp:627=0A= > > (libtsan.so.2+0xa30ec)=0A= > > =A0=A0=A0 #1 __sanitizer::CheckFailed(char const*, int, char const*,=0A= > > unsigned long long, unsigned long long)=0A= > > ../../../../gcc/libsanitizer/sanitizer_common/sanitizer_termination.=0A= > > cpp:86 (libtsan.so.2+0xeb8cc)=0A= > > =A0=A0=A0 #2 __tsan::ImitateTlsWrite(__tsan::ThreadState*, unsigned lon= g,=0A= > > unsigned long)=0A= > > ../../../../gcc/libsanitizer/tsan/tsan_platform_linux.cpp:452=0A= > > (libtsan.so.2+0xa0cac)=0A= > > =A0=A0=A0 #3 __tsan::ThreadStart(__tsan::ThreadState*, unsigned int,=0A= > > unsigned long long, __sanitizer::ThreadType)=0A= > > ../../../../gcc/libsanitizer/tsan/tsan_rtl_thread.cpp:197=0A= > > (libtsan.so.2+0xc0e88)=0A= > > =A0=A0=A0 #4 __tsan_thread_start_func=0A= > > ../../../../gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1009=0A= > > (libtsan.so.2+0x3e5dc)=0A= > > =A0=A0=A0 #5 start_thread /sources/glibc-2.35/nptl/pthread_create.c:442= =0A= > > (libc.so.6+0xc75f4)=0A= > > =0A= > > I've tried to diagnose the root cause but failed.=0A= > =0A= > Hi Xi, thanks for looking into this. I've tried running the testsuite=0A= > on a cross-toolchain (as I do not currently have access to a physical=0A= > machine)=0A= > for a MIPS64R6 and the test passes successfully. Could you please=0A= > verify that the test fails solely based on this change?=0A= =0A= I guess you mean you are running MIPS64R6 target code with qemu?=A0 I'm=0A= not 100% sure because maybe something is wrong in my system.=A0 I'm now=0A= retrying on gcc230.fsffrance.org (an EdgeRouter 4 in Cfarm) but building=0A= GCC on it is really slow.=0A= =0A= The changes I've tested:=0A= =0A= diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc=0A= index 5eb845960e1..a7f0580e9ba 100644=0A= --- a/gcc/config/mips/mips.cc=0A= +++ b/gcc/config/mips/mips.cc=0A= @@ -20115,10 +20115,11 @@ mips_option_override (void)=0A= =A0=A0=A0=A0=A0=A0=A0=A0 target_flags |=3D MASK_64BIT;=0A= =A0=A0=A0=A0 }=0A= =A0=0A= -=A0 /* -fsanitize=3Daddress needs to turn on -fasynchronous-unwind-tables = in=0A= -=A0=A0=A0=A0 order for tracebacks to be complete but not if any=0A= -=A0=A0=A0=A0 -fasynchronous-unwind-table were already specified.=A0 */=0A= -=A0 if (flag_sanitize & SANITIZE_USER_ADDRESS=0A= +=A0 /* For -fsanitize=3Daddress or -fsanitize=3Dthread, it's needed to tur= n=0A= +=A0=A0=A0=A0 on -fasynchronous-unwind-tables in order for tracebacks=0A= +=A0=A0=A0=A0 to be complete but not if any -fasynchronous-unwind-table=0A= +=A0=A0=A0=A0 were already specified.=A0 */=0A= +=A0 if (flag_sanitize & (SANITIZE_USER_ADDRESS | SANITIZE_THREAD)=0A= =A0=A0=A0=A0=A0=A0 && !global_options_set.x_flag_asynchronous_unwind_tables= )=0A= =A0=A0=A0=A0 flag_asynchronous_unwind_tables =3D 1;=0A= =A0=0A= diff --git a/libsanitizer/configure.tgt b/libsanitizer/configure.tgt=0A= index fb89df4935c..52546bbe4e3 100644=0A= --- a/libsanitizer/configure.tgt=0A= +++ b/libsanitizer/configure.tgt=0A= @@ -55,6 +55,9 @@ case "${target}" in=0A= =A0=A0 arm*-*-linux*)=0A= =A0=A0=A0=A0=A0=A0=A0=A0 ;;=0A= =A0=A0 mips*-*-linux*)=0A= +=A0=A0=A0=A0=A0=A0 if test x$ac_cv_sizeof_void_p =3D x8; then=0A= +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 TSAN_SUPPORTED=3Dyes=0A= +=A0=A0=A0=A0=A0=A0 fi=0A= =A0=A0=A0=A0=A0=A0=A0=A0 ;;=0A= =A0=A0 aarch64*-*-linux*)=0A= =A0=A0=A0=A0=A0=A0=A0=A0 if test x$ac_cv_sizeof_void_p =3D x8; then=0A= -- =0A= Xi Ruoyao =0A= School of Aerospace Science and Technology, Xidian University=