From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2048.outbound.protection.outlook.com [40.107.20.48]) by sourceware.org (Postfix) with ESMTPS id 1CCBF386180A for ; Thu, 15 Apr 2021 09:54:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1CCBF386180A Received: from AM5PR0402CA0017.eurprd04.prod.outlook.com (2603:10a6:203:90::27) by DB6PR0801MB1640.eurprd08.prod.outlook.com (2603:10a6:4:39::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Thu, 15 Apr 2021 09:54:08 +0000 Received: from AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:90:cafe::98) by AM5PR0402CA0017.outlook.office365.com (2603:10a6:203:90::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Thu, 15 Apr 2021 09:54:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT009.mail.protection.outlook.com (10.152.16.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Thu, 15 Apr 2021 09:54:08 +0000 Received: ("Tessian outbound 81a4524e9a48:v90"); Thu, 15 Apr 2021 09:54:07 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 183e44c88c9ddd94 X-CR-MTA-TID: 64aa7808 Received: from e662397a56f3.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C819989D-9A82-4F58-8E5D-03DB19ACD4AB.1; Thu, 15 Apr 2021 09:53:59 +0000 Received: from FRA01-MR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e662397a56f3.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 15 Apr 2021 09:53:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOSqqO0HY1CGX62Gl4zA76apiPHiLq+malp+fEx+vRodW39Fty0G/IX5tJYOkhbxQDzMnhk9aARLz9LKsyPaYLkVMrd1SiL52V+GiGXbnVXTWIZbgAmFCz6PJhHjLOdMqQYaSwBdvAwEKLba04ewvHYKeUHn0OSTv5Y6oKhV88VNnjMHg9Tx8wfx4ZUTwe9yQiRGnZxKodYo7lHJh70HbEwslvVNSozRvv6KtUq30FZO3/hst2i7036qy4v8yvkamjfZjUzV2y6JgNCyHf+IPrPvyYEtqnr3hlg3Y2agJFgN3Dr7BDFu1W6XbOuKW7b6ACywK4FBRaOCZoEZLDsEZQ== 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-SenderADCheck; bh=0GgCRzKWwiLoSeebGIgOW5mjSQJW6JUtMXWCAqgFCfo=; b=J/ymXndZGhdq52aJ/4ll4fge9kKCYAac/IqMpZG3NdJSsVmEo4vpHSAYp20j5FveFFowt0t62srCfLYG9RHCNyYr661yHf2NMOrYmwLQ8pI7AEIythxOQ588xOBlKefIPhWF5GXeAqNMYwFvhm4tLo7gZ16Tp9U2XC9lH2G/cOv31CrQbc2cyQ3SF1XJS82eNT/ChiiwcPaw2zxNAvz8hDsOC1LINZmWD2NUbzFe/Vc9v5zkMwA5jH/IBibBCC5Y23tWPDRm3cjrLeFiCaL4N4yDYeO9bQws+V5zNKUZtfrHTjk7pgDKeG8DQ04Mwh8wimNNxoKhAykHbzqYhrDVug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PR2PR08MB4844.eurprd08.prod.outlook.com (2603:10a6:101:1d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.18; Thu, 15 Apr 2021 09:53:57 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::c99f:671d:bb2c:f20b]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::c99f:671d:bb2c:f20b%7]) with mapi id 15.20.4020.023; Thu, 15 Apr 2021 09:53:57 +0000 Date: Thu, 15 Apr 2021 10:53:54 +0100 From: Szabolcs Nagy To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v2 02/14] elf: Add a DTV setup test [BZ #27136] Message-ID: <20210415095354.GY23289@arm.com> References: <0b160a0060cd209a33496da51f915258ec5dd9a5.1618301209.git.szabolcs.nagy@arm.com> <39b15115-d8e2-2af2-a588-62c4c4f94b35@linaro.org> Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <39b15115-d8e2-2af2-a588-62c4c4f94b35@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: LO4P123CA0050.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::19) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by LO4P123CA0050.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21 via Frontend Transport; Thu, 15 Apr 2021 09:53:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 105f5bb7-96f6-4502-9171-08d8fff46993 X-MS-TrafficTypeDiagnostic: PR2PR08MB4844:|DB6PR0801MB1640: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4125;OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: bxeNke9iaelJUedxs7qvKmPdLcuFCZBQFFa6qE5L7I83N4FEcX3j0uXrURW29qCgPwKqv2o5weSMg2J4TpPrTzpsGuTVMSvGLnKWP368ZoqWrGoikXSUayPDm3GqMXdZXmq9vV8OJ41+BATEAkFfiQTkQO301ZFrwAMwW23VaRawEurx//sNjJ/kCScTvnHqVzVGMd9xPLzHodM/NZ8Bx25KIP4H75fK8BzIbMG82pMRYK/St2ukq4dGXdPCqcO22KLY95ttZlaBIYw3S5tcx1+WC3IGqteQynO9fjTehTtRTYTgBuuuzcqmSBmYGo18hf+BWuLF9WgWCC+//Zj4p0sFz/gpiQA0aNYTca1mCfDDZzfddG8VQCYJ/M/qWFi2sk/sGzvYnVHdURJbs83K7b957/GT1zoRDhZceK6cZ/eHWjj8D/eTpllQMTejC1lpKuj9OegYCdWWVu2AO/4IzDava6C/Nu08yXmpouFyVkN+h3QozRhXsFwKmBW9NYjMK0HDUf02szzD3SaqBJCucJgeI2lWB/uQYnNUw3quRCcXlqt6dRhonTnudAmZ1pZi9AlGe0VsEmZ1gATmQfbivuLrTmB6CM2s4MNjb+2xPlfIJvCiP+K3Rk4LUPBapjcBxH1e8yKH9zuPOhOiSOfWRqVT+EhATCXuvLBv1MLjyF4= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39850400004)(2616005)(956004)(8676002)(16526019)(8886007)(55016002)(66476007)(66556008)(83380400001)(66946007)(66576008)(44832011)(478600001)(36756003)(5660300002)(1076003)(235185007)(33656002)(8936002)(52116002)(316002)(2906002)(6916009)(86362001)(7696005)(38100700002)(33964004)(4326008)(44144004)(38350700002)(186003)(26005)(53546011)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?eHNjc1VTMnZ2cDF1dzI1emxJR0RQbGQ4OUZrVWR2NTJ2UnN0YzAyMklDRE9K?= =?utf-8?B?Sk5sYXU2M3BNVStuOE9WN1o3YUtaQmRmNW5BMjBUY2hsUDN3RGVxMHNLMTAw?= =?utf-8?B?Qzl6RlVMcVl0aDJkNWVmVmozY3RlY0I4MTFCMmhSSTg3dTBCNmxmQUFoMUJu?= =?utf-8?B?REtIbGJ6UGRDK0NwaEQ1OWgrYnhNbHhSVUZqTk9BcDNmMUtlYUlNMmVkNEty?= =?utf-8?B?V2VFUElNQlFJaWYxaTNkeFdVbit5UjRHZW1wbllGaldUT29ZT2UwVi8rWDdF?= =?utf-8?B?cUpuUlV3eGtqWmZueThqQ2pwSDNKMlZPTytQMGw1TzltSUE4a0d2Z2pZTnlK?= =?utf-8?B?cHNJNVQvU2lEL0xzUHJ1OGZqWldWNXJFVWJPNDQyTkV1b1AyMndiZkdQK2wr?= =?utf-8?B?SFhKbEJaN1V6VVJ0UDVINis4dE04WXg0amJzbHkyY3ptR21PSTVjM1FiaDNT?= =?utf-8?B?dVJHbVlUNXJXYVlGemlBamlGNldVNmJQdGh0LzVLNjEvOWVFcGRtSG9LSFU4?= =?utf-8?B?NVg0M0RuVTkrTzk5bFY2ZnJnNU8xUTZqdmVNWUVLK2MxM3ZjL0czZ3hiSnBr?= =?utf-8?B?YXlHOUlmTWlxdTI3SHdKL3hyalBYM1JUa1NFaDFlaTF3Z09ZODZHVkJVR2s5?= =?utf-8?B?ekViS0hEQVkwZHVTc1d2eDRhalFCVnpFNkJjSVhrWmdQQXIrcG9OZHNXcldv?= =?utf-8?B?SGV6SGt1a0h5Q0p1VXlXbDc0NGJOamtKTzFnWCtiRElQNFo0ci9oVnBnWG8z?= =?utf-8?B?ellvb3gyQWhlOGhTM25Bak9PSXBIc1ArUGhIOWZSaVpVRTg5NU44cjB3QlQ0?= =?utf-8?B?VXRCOGJQcWJwUEtmNEorMkRPeEFYUkIvQ04wWk0zSFUzbmlFYndpVklLNWpM?= =?utf-8?B?NVZEa0NzWDJkUGh4eWxaQ1lYZmExMTNxd0NOWktkNGVCLzVFbWtLNk5IbzBH?= =?utf-8?B?TUFWcGVWRDN4VjAxeXRybmhsYTBCaUhaMjA5MEVxOEhQK0pVeTEvK0Zud2l4?= =?utf-8?B?SGpTdUMyZTBRNnFLeXNFQzk4WDdienlVNDVhYmlGN2FGZmRPU0lCMWZtYXBJ?= =?utf-8?B?eGYxVk0yV1Vzam9TbE9KNUZPeVE1dW1wdGlUZ094VFVzQmt4N3BrTUc0N1ZY?= =?utf-8?B?U1pudjNoS0hYdEpLK2U3dFN0U3VsYXpmUDR3SnpJWXlHb002a1dOd0VSOGdM?= =?utf-8?B?RWQ3MGFLT3hYc2FPSnN1a3JFYS94VUZDUHNsNlZhTjl3ZzZFZ0d4Q0NmN0pV?= =?utf-8?B?aENOSjEwSG5GZzcxZ0Z4RVdYcGpjR3JZOUFES0NnWGl0czhoL2d2M3BwT25w?= =?utf-8?B?S0tDWmNCT0toRjc4WGpqd282aG1HYnZJS1BCNVFhQjc3bmNaSDV1Q005ZUow?= =?utf-8?B?eUpvL3V6U3Q3SEVpRzFQVGJxY2JvbXJsYUU5Y3BhbE5DVUIybzN0T0NKaHBW?= =?utf-8?B?U2RrK3NiWnVqcVpOK3hiWVp1aENHbXpjZ1llc3N1RlVUaFFFUnFDakxSeDRa?= =?utf-8?B?bXJDYlR0a1YzOU9mbXFXem9sa3BhY0VpTCtvVVk4dllHcDF2eFk5amIvTTlO?= =?utf-8?B?cU4rWWJXbUMzd2U5S2xaU1FGVmw1d1d5T1RPdFRtTmZhTUdTYndnNUpFL3Nk?= =?utf-8?B?VG5JdU9ZVU1NRTN4VzNaNi9abEZpVDE1TUpES1NDSSt2bE02THMramVYMW5o?= =?utf-8?B?dUJYK2EvSEVnQ0RpcUFqY2VKbkNKSU5LYmJnWG0zekVvblcyc1RoL0VuVFVG?= =?utf-8?Q?/av2+Gg4oLzKGxLIG5MwABpKsvRhS7MM+JRWgAx?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4844 Original-Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 1d336825-d87f-4bd3-cbde-08d8fff462b2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: koK0VC4FbKT3ffP0Yggc9PQp+vc75N3pUTf0gwv6iuV+3RhOiTbzra+mq7gJEwJJDHy3w3QGP4Q/wfn0Me008ywGjtYpIuRCQ5V8ako4+bJrouHHiJXxlAltOVbNs7L7yYcmuVaC70sH8x/ULimY9n7/xKq8PtL+yYcLPUOheWqdNs0ATRyJPs3j8FzfM38SKscy9Bch25WKVnDzJSWj6D74f6SyIqqHx6gr9zZfbRQtSU/RzhUAA7pQ8xN3Ln+19hGYv5q3X1FfozkqQnLTABty8qgdBEUCIIyL/5eQU8NJE4wILKRi6Hp3gABsHjUNeE3pax+GOIi2H9U/w2M3EK8OCbDwydmxm1Yw9UFBG7yyo2+tEjvxmi+4IiaNZ6P/QHMjRZG7MG/fp9tyR5psPwdYfrN1siYM4C6xxLo7NGektakrdMtwwh+6tbUgbEKToNkuTdhcwtYm8iE8f5hZITiQdOkQsFvlfitb08RLaAZtU0Sb24NdbE7E0Jx9qmV2engFA050punjXYGY+ifFug7cVEHCSz6QsW8juiydytTp1sPns4pkh4N4Bz0QCl+VT0dBkuCxm58S9JIjUzPla0Z7/CwtB5ApP/icB6kF2HaT+13/1dsxU+RPhEskhrCWfRN+0wnsKaKeg7TfrCpczbtFsZcrFVx+iseg1aWDP1I= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(346002)(396003)(376002)(136003)(39850400004)(46966006)(36840700001)(356005)(316002)(33656002)(82310400003)(36860700001)(44832011)(81166007)(66576008)(2616005)(8886007)(83380400001)(26005)(4326008)(82740400003)(16526019)(8676002)(2906002)(7696005)(8936002)(70586007)(235185007)(956004)(186003)(47076005)(1076003)(86362001)(33964004)(44144004)(336012)(53546011)(6862004)(5660300002)(70206006)(36756003)(55016002)(478600001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2021 09:54:08.0458 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 105f5bb7-96f6-4502-9171-08d8fff46993 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1640 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Apr 2021 09:54:16 -0000 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline The 04/14/2021 15:06, Adhemerval Zanella wrote: > On 13/04/2021 05:18, Szabolcs Nagy via Libc-alpha wrote: > > The test dlopens a large number of modules with TLS, they are reused > > from an existing test. > > > > The test relies on the reuse of slotinfo entries after dlclose, without > > bug 27135 fixed this needs a failing dlopen. With a slotinfo list that > > has non-monotone increasing generation counters, bug 27136 can trigger. > > > > -- > > v2: > > - moved from nptl/ to elf/ > > - dlopen a different set of existing modules. > > - code style fixes (!= NULL etc). > > - moved after bug fix patch > > LGTM, with just a small suggestion below? > > Reviewed-by: Adhemerval Zanella thanks > > +{ > > + char buf[100]; > > + snprintf (buf, sizeof buf, "tst-tls-manydynamic%02dmod.so", i); > > + mod[i] = xdlopen (buf, RTLD_LAZY); > > +} > > Maybe xasprintf here? committed with this change, but made a mistake committed patches are attached. --C7zPtVaVf+AK4Oqc Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-elf-Fix-missing-include-in-test-case-BZ-27136.patch" >From 52290d8c04569615fb011ee286d52dc5147afbd7 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 15 Apr 2021 09:57:10 +0100 Subject: [PATCH] elf: Fix missing include in test case [BZ #27136] Broken test was introduced in commit 8f85075a2e9c26ff7486d4bbaf358999807d215c elf: Add a DTV setup test [BZ #27136] --- elf/tst-tls20.c | 1 + 1 file changed, 1 insertion(+) diff --git a/elf/tst-tls20.c b/elf/tst-tls20.c index ac5f8c8d39..9977ec8032 100644 --- a/elf/tst-tls20.c +++ b/elf/tst-tls20.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include -- 2.17.1 --C7zPtVaVf+AK4Oqc Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-elf-Add-a-DTV-setup-test-BZ-27136.patch" >From 8f85075a2e9c26ff7486d4bbaf358999807d215c Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 31 Dec 2020 12:24:38 +0000 Subject: [PATCH] elf: Add a DTV setup test [BZ #27136] The test dlopens a large number of modules with TLS, they are reused from an existing test. The test relies on the reuse of slotinfo entries after dlclose, without bug 27135 fixed this needs a failing dlopen. With a slotinfo list that has non-monotone increasing generation counters, bug 27136 can trigger. Reviewed-by: Adhemerval Zanella --- elf/Makefile | 10 ++++- elf/tst-tls20.c | 98 ++++++++++++++++++++++++++++++++++++++++++ elf/tst-tls20mod-bad.c | 2 + 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 elf/tst-tls20.c create mode 100644 elf/tst-tls20mod-bad.c diff --git a/elf/Makefile b/elf/Makefile index de659655dc..c531470ede 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -222,7 +222,8 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \ tst-audit14 tst-audit15 tst-audit16 \ tst-single_threaded tst-single_threaded-pthread \ tst-tls-ie tst-tls-ie-dlmopen argv0test \ - tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask + tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \ + tst-tls20 # reldep9 tests-internal += loadtest unload unload2 circleload1 \ neededtest neededtest2 neededtest3 neededtest4 \ @@ -344,6 +345,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ libmarkermod2-1 libmarkermod2-2 \ libmarkermod3-1 libmarkermod3-2 libmarkermod3-3 \ libmarkermod4-1 libmarkermod4-2 libmarkermod4-3 libmarkermod4-4 \ + tst-tls20mod-bad # Most modules build with _ISOMAC defined, but those filtered out # depend on internal headers. @@ -1922,3 +1924,9 @@ $(objpfx)tst-rtld-help.out: $(objpfx)ld.so fi; \ (exit $$status); \ $(evaluate-test) + +# Reuses tst-tls-many-dynamic-modules +tst-tls20mod-bad.so-no-z-defs = yes +$(objpfx)tst-tls20: $(libdl) $(shared-thread-library) +$(objpfx)tst-tls20.out: $(objpfx)tst-tls20mod-bad.so \ + $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so) diff --git a/elf/tst-tls20.c b/elf/tst-tls20.c new file mode 100644 index 0000000000..ac5f8c8d39 --- /dev/null +++ b/elf/tst-tls20.c @@ -0,0 +1,98 @@ +/* Test dtv setup if entries don't have monotone increasing generation. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include + +#define NMOD 100 +static void *mod[NMOD]; + +static void +load_fail (void) +{ + /* Expected to fail because of a missing symbol. */ + void *m = dlopen ("tst-tls20mod-bad.so", RTLD_NOW); + if (m != NULL) + FAIL_EXIT1 ("dlopen of tst-tls20mod-bad.so succeeded\n"); +} + +static void +load_mod (int i) +{ + char *buf = xasprintf ("tst-tls-manydynamic%02dmod.so", i); + mod[i] = xdlopen (buf, RTLD_LAZY); + free (buf); +} + +static void +unload_mod (int i) +{ + if (mod[i] != NULL) + xdlclose (mod[i]); + mod[i] = NULL; +} + +static void +access (int i) +{ + char *buf = xasprintf ("tls_global_%02d", i); + dlerror (); + int *p = dlsym (mod[i], buf); + printf ("mod[%d]: &tls = %p\n", i, p); + if (p == NULL) + FAIL_EXIT1 ("dlsym failed: %s\n", dlerror ()); + ++*p; + free (buf); +} + +static void * +start (void *a) +{ + for (int i = 0; i < NMOD; i++) + if (mod[i] != NULL) + access (i); + return 0; +} + +static int +do_test (void) +{ + int i; + + for (i = 0; i < NMOD; i++) + { + load_mod (i); + /* Bump the generation of mod[0] without using new dtv slot. */ + unload_mod (0); + load_fail (); /* Ensure GL(dl_tls_dtv_gaps) is true: see bug 27135. */ + load_mod (0); + /* Access TLS in all loaded modules. */ + pthread_t t = xpthread_create (0, start, 0); + xpthread_join (t); + } + for (i = 0; i < NMOD; i++) + unload_mod (i); + return 0; +} + +#include diff --git a/elf/tst-tls20mod-bad.c b/elf/tst-tls20mod-bad.c new file mode 100644 index 0000000000..c1aed8ea7d --- /dev/null +++ b/elf/tst-tls20mod-bad.c @@ -0,0 +1,2 @@ +void missing_symbol (void); +void f (void) {missing_symbol ();} -- 2.17.1 --C7zPtVaVf+AK4Oqc--