From patchwork Fri Oct 28 16:39:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 59586 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38929382EA01 for ; Fri, 28 Oct 2022 16:41:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38929382EA01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666975269; bh=OAhBKPl7XRlJ/Rprj7AGlo4QpBqZhZyMizT6L1rb9R0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=qfMUtdzEGG8lRRZyqiDjWoDWc3yn1V5sP26a1Lem2+a8VGlA52bqhm/YmwRbJbNx1 rckxj8CXvH2/Co6TcI/u1r80CctQcCjL91Whop3ioltkmrYunlNPuD/ktiG3NCzmdp /wJcO7pZQx0YFOSq/en3KEJr+e2BZsK8CpN4fQEE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20077.outbound.protection.outlook.com [40.107.2.77]) by sourceware.org (Postfix) with ESMTPS id 786ED382EA18 for ; Fri, 28 Oct 2022 16:40:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 786ED382EA18 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=H6QMyRlMS269pMAV5IME2wbxFx8QFz6sdQgaw2Fz+GiZ6Dc420fcVae88BrQnqV+Mmc1/weVLnYddFkCuEK+C0NBjP+ShWesK9ben7EX8J4hyeh6nIJhUk+T56feWp1J8Qfq0D3dzYk3d4PcbBLWQvmmL20oR96kcdl1sI2QXazDEhpilohxiNPdVF9PS+IFSSefCcAsCwVI206prQ5JdcPA0VRhDL934bjEk2cYLaigX5YohizLeq90c6dkD4JP7puv8h/KSrrFkYuF4eIuLkfWUNebAbwsnvGEIHRkGyEQKGjpqLeaNrv6yidICJqtLffCh4D5bMEBzTL2qt0iqw== ARC-Message-Signature: i=2; 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=OAhBKPl7XRlJ/Rprj7AGlo4QpBqZhZyMizT6L1rb9R0=; b=PoQ10I3Wd7fe+FozCNcAM8uOYGbH/b2KMoImbq08kz6nLuN92kFRfcdhag5NaQ40IuO4LbUozw5x+f6laByMhLLzggeR4j/ds1mqxjCht9DLbnL3fgZSqpahmFXVzjRE1PrakoHRCn6sd67GFedRTzWI+hf1NOJ3XQJilXEhn+qtYXEDrLFVnSp13J/ySODAqwjoofGryyuea7mGlrYL/CIG058JjWbmxDfvigV1gHD1TRmkfiF2rKCfB5KbnuT7LOckiSDlIqYWJo2keibmKmil0UO3lstOQAY8i7Vu/NNhyAXjYlrzUCZkL65nyLS6wcy2mtLseFXhZJ80KoqSJg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from AS9PR06CA0072.eurprd06.prod.outlook.com (2603:10a6:20b:464::10) by AS8PR08MB6550.eurprd08.prod.outlook.com (2603:10a6:20b:31b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14; Fri, 28 Oct 2022 16:40:06 +0000 Received: from AM7EUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:464:cafe::b1) by AS9PR06CA0072.outlook.office365.com (2603:10a6:20b:464::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.29 via Frontend Transport; Fri, 28 Oct 2022 16:40:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT008.mail.protection.outlook.com (100.127.141.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Fri, 28 Oct 2022 16:40:06 +0000 Received: ("Tessian outbound aeae1c7b66fd:v130"); Fri, 28 Oct 2022 16:40:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4620b24ae92df8ea X-CR-MTA-TID: 64aa7808 Received: from 77b2abc5e1fd.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E04B1BC1-7426-4359-B77F-4A8893E57300.1; Fri, 28 Oct 2022 16:39:59 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 77b2abc5e1fd.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 28 Oct 2022 16:39:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d5qjYVebChhmFzWY/T95cbMAZoFrMRQuniYxv+TyXoDfR1cHzOSVB0nRn40tMo7cDbXFvdMd9zidL1iGBdtnikjTD08vnSJgiLVzRWbYM1jboap4JBUei8g32+ESNdpSiosEjp6EbatJk/RoLrNNVqcNBoelbjvfmsdjay9MNK0jWeWi8v62dP434+jMz9xr+fNZAoGgtRxreKioSi3GNgKtHaacfAeF5xd3k9zNxIM9Hohssc2YSi2kunHHjVF0wLGlpuGFjuHpCR2mk46lnqumJhBlzsTIj20TbOc6kxgxNAeF6GSkrwQZzgGLkz00rF4Ozl/IjHtRXVKj9mP11Q== 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=OAhBKPl7XRlJ/Rprj7AGlo4QpBqZhZyMizT6L1rb9R0=; b=mTIPbMbq7l90BrHbXXrm/T8zEAYAT67gPaWKLdGfDYzzRyVQ1NsAIoz1qb2WZl2OjwBgR420BlHZYEUGybyf2aJMi+s7Gm+zCqsjRxLY4+BJucGVFlesy8UzzndPc/Th/srij1uk7GPQyg0QHUtLVqjqQjbJOGEIwqLIgdd4jeWREkfYrP/vaMXHiS+gRQbdDHcyJo/VW9KPbhbX39dp5k+X9+x07kF6YIljU3lEC4i7Bquv7YnnlkZOuI9H4e3+pM+jS5R+zfCVnEyUEHqbx3qyfsm54eCgdZdrOTbVsZfyFdvQUcELFGfKUs2gAcPXh9sYK9nW8NEnoCIejnlzsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM5PR0601CA0080.eurprd06.prod.outlook.com (2603:10a6:206::45) by PAVPR08MB9860.eurprd08.prod.outlook.com (2603:10a6:102:2f4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Fri, 28 Oct 2022 16:39:58 +0000 Received: from AM7EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:0:cafe::a2) by AM5PR0601CA0080.outlook.office365.com (2603:10a6:206::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Fri, 28 Oct 2022 16:39:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT056.mail.protection.outlook.com (100.127.140.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5769.14 via Frontend Transport; Fri, 28 Oct 2022 16:39:58 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 28 Oct 2022 16:39:57 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 28 Oct 2022 16:39:57 +0000 To: Subject: [PATCH v2 1/4] Fix OOB read in stdlib thousand grouping parsing [BZ #29727] Date: Fri, 28 Oct 2022 17:39:57 +0100 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT056:EE_|PAVPR08MB9860:EE_|AM7EUR03FT008:EE_|AS8PR08MB6550:EE_ X-MS-Office365-Filtering-Correlation-Id: e7cd5dcd-50c5-44dd-8dac-08dab9031215 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: f+7tiv6i8Kx9HJ0RVNVB/mxay3ISgyD6OVecCbkuhKqw8gWQvnDwsE7efNkDww24GcagjbEGdIGVBrUL4keQJf0vaJUrvdEsLv/I8yDA6x62VHhYJ68m0MKc0V8qEcbbGI+A82xxxi2GZLdlWOwP91t5FuvDgwCyKwxvxmc567wFXtPnBFybpoL+RYCHnT9ckP23uiY2n++AWDkYtX/T/mu5zX7oXx0YIpbDTGco2Wr/EM7xWwK/5SzmHOhKTUhNVd6tdJS99zXti4MScYAd2+oqZNF5OAicKevEiA8jHFz4pU1Pt1qebPRfbZ6MIg+FxI3NH001DxhWj4+8xZbRVdnV4ch5xxjHdx+ljXwmYw5PVPnD39lkThuwHVsT8BJl7S2AyrkA4YU00FdDxKo6f+w2HreFaqyS1HJJJ7/jukpeW5RuXT8ZWVSXSglTjhf4w/C0B7vK8Bhz6xFsF8S1CE191Ak7q0nAUBVz04jCxw8o/p3Xfa57LIXcVpFCqEGGcbR7MwB8M0TGReP33i8TZ4wVaB+77HQ3u75CzcWig8whQgIoBBiTCFn0r5OlN2ttLa38dpH0AilagUr0ZYtvMm6mn0WS+adOhX2AykThkSaHsMCsuUQsk4Ch1XwH5BCKDJpXiXo3VyBRPexmtRPMRYmlX6Qk8aKXxPcFPLmjgFlJhyt8VrFd9p4/U9MKsaQBKdUzAmIx97A2BsraWszoYYoE5Fs/mmOvp4NRYQ0/akEMcx3Ic0IHIw35HUAf4Lal6Sqwr+ObAxDY2F92CbWRvesqsx/FC2oUl0Ukxqzov0wYj35nfngISpGZMq70Y9zi X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(396003)(376002)(136003)(346002)(451199015)(46966006)(40470700004)(36840700001)(478600001)(26005)(36756003)(7696005)(316002)(8676002)(6916009)(36860700001)(86362001)(356005)(83380400001)(426003)(40460700003)(336012)(40480700001)(2616005)(47076005)(81166007)(186003)(82310400005)(8936002)(2906002)(41300700001)(82740400003)(44832011)(70206006)(5660300002)(70586007)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9860 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 37c5d3d0-eb27-45e3-5a0d-08dab9030d07 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m07VesJ1PtwTZSYgAKeXnTowVEVWaEyczQnTca4FNVsE1NVzxuVEwxGzNLyUKfCeb11T6zX3GUXt8Ejvg+xx9iBjMTQWotl5XbPbPJlG2yXc4+L9eEKNEGPhROYhFeivaM5bOZvVUP13zVYq7rEwQzCR/WA/b5rT8bJ9fU+ZLOjKKe+7GqVg0NHh962EPfBBsFaw56WpKYvuo6KvdmVc3q1//e7dv3K4XUX4MhZuOfJpkWuUs70WcxU2GfI0+/Upjfo1eRHxhodp+lMG4dPZFqW64PV30gS8S3Vxvl7gC/kxxzbmRvRxpp1NkEwvdXowV1xoEWBURkMtUf2QZlnKAmxvLQE6RYvUhH37OUfoD4ogS9kDrOrmuhdmlZUYgWT32VMacujqr5cjBkl1tOCS0JGF/aiXj9rKwow8HavY/gcf/uP79o1FCwiNu57QXQf89Q0yZRcY2hFw4HVxdDzLZkorOrTJM0wHrh6yjvjqbksxohELMmm87DohRpGMuEeoY3hHi2brsFxxR5usv+FeTdKLARi9OpibH5YZb8Wzn9iafL3H0JCqBNcgZpJmsfNXhBLvXj3dpHjENfkCgjeB23D/ERAyOy+KJX53XZCbWJ33Z85kaEot5Q2mNfsaDQfv/wSRKrlnJkor99hjaQj0l0NWiKZzHf0ZA1GPEx6LadFV/RF0hu73FNnkpR5ler/39DMWdEial0bNUic2LaIBSH1LxNoPoy41u9u+H1RwQiYOYUr5nGaNA7MX6WCnPEiM/3aGa534N7qztbZFq5/bVA== 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:(13230022)(4636009)(346002)(39860400002)(376002)(396003)(136003)(451199015)(46966006)(36840700001)(40470700004)(40480700001)(36756003)(316002)(82740400003)(86362001)(81166007)(70586007)(6916009)(70206006)(44832011)(40460700003)(36860700001)(26005)(478600001)(83380400001)(426003)(336012)(7696005)(82310400005)(5660300002)(2616005)(8936002)(41300700001)(8676002)(47076005)(2906002)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 16:40:06.5164 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7cd5dcd-50c5-44dd-8dac-08dab9031215 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: AM7EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6550 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: 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-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" __correctly_grouped_prefixmb only worked with thousands_len == 1, otherwise it read past the end of cp or thousands. This affects scanf formats like %'d, %'f and the internal but exposed __strto{l,ul,f,d,..}_internal with grouping flag set and an LC_NUMERIC locale where thousands_len > 1. Avoid OOB access by considering thousands_len when initializing cp. This fixes bug 29727. Found by the morello port with strict bounds checking where FAIL: stdlib/tst-strtod4 FAIL: stdlib/tst-strtod5i crashed using a locale with thousands_len==3. --- v2: - use const thousands_len for !USE_WIDE_CHAR. --- stdlib/grouping.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/stdlib/grouping.c b/stdlib/grouping.c index be7922f5fd..06cbe7b9c7 100644 --- a/stdlib/grouping.c +++ b/stdlib/grouping.c @@ -52,21 +52,19 @@ __correctly_grouped_prefixmb (const STRING_TYPE *begin, const STRING_TYPE *end, #endif const char *grouping) { -#ifndef USE_WIDE_CHAR - size_t thousands_len; - int cnt; -#endif - if (grouping == NULL) return end; -#ifndef USE_WIDE_CHAR - thousands_len = strlen (thousands); +#ifdef USE_WIDE_CHAR + size_t thousands_len = 1; +#else + size_t thousands_len = strlen (thousands); + int cnt; #endif - while (end > begin) + while (end - begin >= thousands_len) { - const STRING_TYPE *cp = end - 1; + const STRING_TYPE *cp = end - thousands_len; const char *gp = grouping; /* Check first group. */ From patchwork Fri Oct 28 16:40:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 59588 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B85693829BCC for ; Fri, 28 Oct 2022 16:41:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B85693829BCC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666975317; bh=DcEWRz1T2YMiKB1yUYcHF+CnKKG+rgcer1lEyZ+MLMc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ksGptw81S+M+eiAwYmB+pxpycT58ACLBJvED/Dmax0XDmeIlLRb5jY8nxee6x2WcF FFw5DashdC3lTwMFj0vJTUcgNKJcbQKKpzevDQmi0hZxk2p+eVzOUuBvhQtkiHIV/1 8fiIq9h2bC3QneTrTJeXrYfj/tHVH9EAlI2WSo7w= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80047.outbound.protection.outlook.com [40.107.8.47]) by sourceware.org (Postfix) with ESMTPS id 3ABEE382DE0E for ; Fri, 28 Oct 2022 16:40:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3ABEE382DE0E ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=deYQlEc9KrjFC80sv8YNgtY6pW3tENryYLtp+YsBhln9jXIwxrzDq2IuidALJ77XgV3/raBeAQb0um9++CzcJRWaLZSD6JoQ+uV6OH8h/QLohcWLNxE9+JfQqzwp/s5A7Fe9Tg+5bbmf6/xprI3XNPYGmz1VkCWSb+qcD2cqn98Dab2EvKIamJaBAoZm/5ZC0oGJjPUq8/T4mp+C5JVzwva4YkySzQQ3CSkE8vlaObsHnNoOvrHJGs9kczcGrpVArQ3TXMUBDGE/tsKhssThJiaxi+UgdzCY9ZG5N2zhnz+eUVpWQdealNZBWlLaVVv5Lk1atHtHRIc29J3cLd44Wg== ARC-Message-Signature: i=2; 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=DcEWRz1T2YMiKB1yUYcHF+CnKKG+rgcer1lEyZ+MLMc=; b=mmsS72DpdCD4Bn5mfhCFGpyZmH62Du7Cw0TtzwdpZLr445zRT16qTXkpr374XutQnGWCNbqARDQSjpbN5j5tsOF2e1rOvX3WtlvdytMyg4aT1CbET2SAB86rEl89Sx9AzG3J4M+FJGcmCOkncQeJ5PHrkPvPjWzTYR1KNRLED/sM2LxELdPaEqteDB+5eDZchALnEsjjgbhXn/aTFPRWf5DTTyEno7rFBwUxoWhD8MhoOzrSf1G1p6ERZRtuZcmezp9W+DqRdggqCA3ufKZcI6lwGJLOdckOTZ5f+DQAa6+2d3kiLFZZ5dPBDD5ou86T18WR+V/XkuRLBO/F3WU47g== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from DB6P18901CA0013.EURP189.PROD.OUTLOOK.COM (2603:10a6:4:16::23) by DU0PR08MB7811.eurprd08.prod.outlook.com (2603:10a6:10:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14; Fri, 28 Oct 2022 16:40:16 +0000 Received: from DBAEUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:16:cafe::76) by DB6P18901CA0013.outlook.office365.com (2603:10a6:4:16::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Fri, 28 Oct 2022 16:40:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT034.mail.protection.outlook.com (100.127.142.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Fri, 28 Oct 2022 16:40:16 +0000 Received: ("Tessian outbound b4aebcc5bc64:v130"); Fri, 28 Oct 2022 16:40:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 92b4d2fa1162d165 X-CR-MTA-TID: 64aa7808 Received: from 7a16a1a58abb.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BA3E157A-7055-42B7-940F-1425A62B88F6.1; Fri, 28 Oct 2022 16:40:09 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7a16a1a58abb.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 28 Oct 2022 16:40:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tt//pN9/6ASPMfT6ExcLS/O8AqfqmsOVWjFezmTf7EKlEHAJPh4bSCcaQ0v8pLRfMOa5VFmFTiGHNNSheJ1hxojnyzexb64mLYwlavBtpKKUU/+nUDJobJekViWBIQvEKiu/OkQa9BsNxxrD/fRZ1K8aMf1fCvhWMYIz4bvK28d3/En3mwJSbbYGYLlomrgs/SxUcwVTrh8vLC4qPDU+QS4+CpDjHZO20R+wCBMGgbFbY5hlkod9NwFHZv/Acatz1KYzfdvOtdEKdGEV8Bp5gTAc+VaPPU1JlX9J6Rbz4YVtMr8uRj36g9gxMQ7z2HQ1w4W+vOXBR08cpUrYAADzvA== 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=DcEWRz1T2YMiKB1yUYcHF+CnKKG+rgcer1lEyZ+MLMc=; b=nM9R7a1kcWVZMMTqpGHwkKEVPZdL2F4ZQUJ9ObA4VbZdT3OlpC/OgVksJw2W4Tx+cHdzUeBYZllCZQY3XxCmJHLxkaCPjga2qHaG+yRITUkkEFv6j6EWmfUeGTWjnqY2Rbo2/GKh6BaVCJ6WqtnD9wsSQ9CGIYLTqkQfwL/izU7BNwiWh2mQv39GEHaObxuLK+qfzknIE3TXVg1WxeyR7Q3cPCzq9VTmEfumZjst6TSSb3UpwjI59m0rRRDPt3S4wM7yyRqA4MCVcqhJSgJrirGXzujbOGQEV/CxIRF6i7z4qjAo3Rt9gWXS7aG9S0UyWEqImAH2gjsnJ7gsYnJZuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS9PR07CA0039.eurprd07.prod.outlook.com (2603:10a6:20b:46b::11) by DB4PR08MB8149.eurprd08.prod.outlook.com (2603:10a6:10:383::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Fri, 28 Oct 2022 16:40:06 +0000 Received: from AM7EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46b:cafe::29) by AS9PR07CA0039.outlook.office365.com (2603:10a6:20b:46b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Fri, 28 Oct 2022 16:40:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT053.mail.protection.outlook.com (100.127.140.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5746.16 via Frontend Transport; Fri, 28 Oct 2022 16:40:06 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 28 Oct 2022 16:40:03 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 28 Oct 2022 16:40:03 +0000 To: Subject: [PATCH v2 2/4] Fix off-by-one OOB write in iconv/tst-iconv-mt Date: Fri, 28 Oct 2022 17:40:03 +0100 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT053:EE_|DB4PR08MB8149:EE_|DBAEUR03FT034:EE_|DU0PR08MB7811:EE_ X-MS-Office365-Filtering-Correlation-Id: 01ea0b0c-e0ab-4e40-c18c-08dab9031802 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: PdI2PaR0kue6WzZlkSsWanoic1nvopbSKB1x35OFX3lFDFDIzUvH3IW9K+LsPusc2aKRbQVYZFxPMi3ndb02WYMKymaZRgBTg76/GJnpKYkcE9o2LtRrstcB/VmABHDPiVGOhzpu6wxJ0pG2aAtoGEySgarwP/BIlxOlwIQvYT5G1yBigVv2okms8yZ0mfW7m0PQ+e0ySQQ6rTSuSnlGmN2Pb7AZ79olz2+IGT0Xt2Y4zscMcTvg8vMgcshvnAEEHUrTBpFqSqCw3gWm8mMgSWsLCNFIT4O7DUzLZKtV1L5qkGUkJRKkJ/iwVQHTi8Jzd6mAbB4Yr6WgsPV02Tnj8ewr38pbOmP7qY+PlaUi3vcgL3VC0i+BoiPrNUOBXnoWWysu2TXL6nD1zi3XZrtAB6nYFgcGVJDDld47pG/s4E4p7CkMxYnZFM8YH1FFbxtcAUvuexOMGy5pV7V0sJX9qGqyS1X5WbKdNBaGIVnG6bG0mQNyjw0CqMW2nbur19EndZbYJ4/KaL4evxaTuZI27O+gRuHmsSpkaVp4qVqllbIDkmSaHi/5EeaeVnWPZfGnKvXvGE+fx6NX2nYK6iUnbPl6uilIaEBIpM9glwL2iO0XelkTBCf6FNLdhLFsqxrQMpJHpzhg8Jo0sonSPnKvU2YYgCzwjVIcuOO9kfZQ4ySAENLunWMt86uPQgo6qcVKVX5ZHOXC6qhOUAgnZAOmyNMeSG5KyrWfEMk9qCGfgo74vfyvMqKinEQsZAnSAE7lQBIPtbiVEvg+3nvclwXi+VkMOBAsn/j00akP2YSrziFcX8UuIDKrJtQq78nu9iFA X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(136003)(396003)(39860400002)(376002)(451199015)(46966006)(40470700004)(36840700001)(70586007)(44832011)(2616005)(40460700003)(41300700001)(5660300002)(2906002)(186003)(336012)(36860700001)(478600001)(8936002)(70206006)(316002)(356005)(6916009)(82310400005)(426003)(47076005)(86362001)(8676002)(83380400001)(26005)(40480700001)(7696005)(82740400003)(36756003)(81166007)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8149 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: cb8f483b-7092-43e5-14d2-08dab9031234 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6vOoYCN87aVen3oCZsxOtTdw+h83OC5QnNAwG1UtC0spA342w1Ri+oSeFmzgOHyNQYTgJ38IvrJXQqbrCJu6FBHzA18hb0MbAxhuwfxMAUx6x/Wz01EUdDFm08nazXrinVhXjCme7UR3LDGUFS5fQQQoFjChKV4RI5zrgDAVvLJzCNX5cACvSIXlvOchHJ5rOgsfC3OqSqVESM7gQYY9uML7JISkTs/ne4c6qlBJgNl/lB/fhDm/fZrlqDBZmYrz7UNqgnKfGNNJQeyl1UzjBNddYxRg1ibUblz6ZTtBkm3wEGECNGHl850PheTCsIniScSU0i7tNIrudQHhr47djyzhQZsq5mmKC/ndH3csHBnV0/d7D390RPdB1iVUKFvA/6JUqkiQCLIwoyyou0DF6yWWr/AQQ2+/yt7KWbXO6/PglIigQuAQw/ibnpVl55S1bjgwRfMadtwJwP1HJR4Ycns6DE+pQc7PYq7S49URm+QQh9O+VpYvHvLpiDFIeRGcd8ij+ghHMMhhRRkfxjEm3zjHCKT5V0gYQOhuEsmpWvNf+8HpKOYr+vEQ/jEl3ngObVo9Tp07GKErO2x56uy8sgz5QDk6VBP3uYe9tigAlii0SQ9IB8ySheRXrnmvVtnk0IJ9TYeGy8VRXOV1Z3VEz2beUBgemwIGmfzNGMFVeHZldElW5RzySf01ON7z1Rghcz/2lSBVDP/z4wXAEWeKB1RKZKB+iRmvkHAAQ3ASWUzy9cBqPJ9hNmNCBKc51RgIK1dRJpdb72/x3TQwPHoa/g== 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:(13230022)(4636009)(376002)(396003)(39860400002)(136003)(346002)(451199015)(36840700001)(46966006)(40470700004)(40480700001)(478600001)(316002)(6916009)(86362001)(40460700003)(70206006)(8676002)(7696005)(70586007)(41300700001)(336012)(26005)(2906002)(186003)(36860700001)(82310400005)(81166007)(36756003)(44832011)(47076005)(426003)(8936002)(2616005)(83380400001)(5660300002)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 16:40:16.5220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 01ea0b0c-e0ab-4e40-c18c-08dab9031802 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: DBAEUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7811 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: 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-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The iconv buffer sizes must not include the \0 string terminator. And the output termination with *outbufpos = '\0' was OOB. Consistently use non-null-terminated buffer sizes. --- v2: dropped \0 and replaced strncmp with TEST_COMPARE_BLOB. --- iconv/tst-iconv-mt.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/iconv/tst-iconv-mt.c b/iconv/tst-iconv-mt.c index daaebd273b..36afd8aed4 100644 --- a/iconv/tst-iconv-mt.c +++ b/iconv/tst-iconv-mt.c @@ -57,12 +57,13 @@ worker (void * arg) iconv_t cd; char ascii[] = CONV_INPUT; + size_t bytes = sizeof (CONV_INPUT) - 1; char *inbufpos = ascii; - size_t inbytesleft = sizeof (CONV_INPUT); + size_t inbytesleft = bytes; - char *utf8 = xcalloc (sizeof (CONV_INPUT), 1); + char *utf8 = xcalloc (bytes, 1); char *outbufpos = utf8; - size_t outbytesleft = sizeof (CONV_INPUT); + size_t outbytesleft = bytes; if (tidx < TCOUNT/2) /* The first half of the worker thread pool synchronize together here, @@ -91,8 +92,6 @@ worker (void * arg) &outbytesleft) != (size_t) -1); - *outbufpos = '\0'; - xpthread_barrier_wait (&sync); TEST_VERIFY_EXIT (iconv_close (cd) == 0); @@ -104,11 +103,7 @@ worker (void * arg) if (tidx < TCOUNT/2) xpthread_barrier_wait (&sync); - if (strncmp (utf8, CONV_INPUT, sizeof CONV_INPUT)) - { - printf ("FAIL: thread %lx: invalid conversion output from iconv\n", tidx); - pthread_exit ((void *) (long int) 1); - } + TEST_COMPARE_BLOB (utf8, bytes, CONV_INPUT, bytes); pthread_exit (NULL); } From patchwork Fri Oct 28 16:40:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 59585 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 24EDD382EA38 for ; Fri, 28 Oct 2022 16:40:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24EDD382EA38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666975253; bh=kZMBFoj5oDkW1HZrRM0r8/Ffwqw38QT5zY4wpZ3MAuE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=y6HEwAEE7lCoySfJnODzhEBae+V5bIHiZoVvdbuKMgIwuOSVp+G3yKRyP53zkRPXk sXxd6IpzLWIkSU0ouzbIbAyvYU9ZZhSUSHolrMz/6wLZBavLcv23aFCrEHe9CLcqMU BbHdnzlSHrrIwKc+5JWQ9zowDdEiE4AQEMyXyHMA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2075.outbound.protection.outlook.com [40.107.20.75]) by sourceware.org (Postfix) with ESMTPS id 0CD8B3864846 for ; Fri, 28 Oct 2022 16:40:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0CD8B3864846 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=mqq+R33nl7A20dlO5+62XBWtC1RdWbEWdghmC57TPik97i/NYPA1BBSxhH1q3SNHm2w0wjYHKn/ErjhrmEoLIfUZZecb+Tedbiw2+ea+TGwRpajjbE19oSjQnOUTVXQA/MFpcteOzqMEQzc/XZRf2M6A3rAZCH0gb4/8UOvuOjhF+33gN4lLIlQLSiAWMunhZpHj/0FCQ0E04URfFhcddqkBS7Or7g2IkqEPlS6BMOMjutZNSL0ZZxzvcxl5vrUKC0RPPQVj1QPb2hs5mapw/cGo6B7FhrRjicdKQn8GtHtuhuSyQQ6nhse/PkDuWNrLR0HFbDYQV8wi/AoyHKxmRQ== ARC-Message-Signature: i=2; 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=kZMBFoj5oDkW1HZrRM0r8/Ffwqw38QT5zY4wpZ3MAuE=; b=XMkENB7fe3OVaMU6m6DjcM5ghPaJemiEfPeyCt+cSiAY+tv4t4DQdIERAVDzA+2hFMemH6Csdv5MS4y1DDwCMnYgGcG0iqiXooy2GRL5P3m8oWVfrCsFA5BIiS0mfkry5jqrlimiX/30WRwNCcJ+4cC2Dgv6n3KMjmHk7Op7d1M6cWZWTsrMnvTbhhn1f75FGUKFMfL46Hr5HlDWD2vaUtQRX6xqZgmm9OA8WFG8o8uj82w0q5t9cpf42XAxln8WmpNILP+HTmVsLulnTjcunPj5/uUgwgkhnSMP+4ew+uQcrJq+D4aycUW9WtwnXPZM3U1mT6UtjEkQldwUfA/gGQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from AS9PR06CA0612.eurprd06.prod.outlook.com (2603:10a6:20b:46e::19) by DU0PR08MB8712.eurprd08.prod.outlook.com (2603:10a6:10:400::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Fri, 28 Oct 2022 16:40:27 +0000 Received: from AM7EUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46e:cafe::ca) by AS9PR06CA0612.outlook.office365.com (2603:10a6:20b:46e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Fri, 28 Oct 2022 16:40:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT063.mail.protection.outlook.com (100.127.140.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.19 via Frontend Transport; Fri, 28 Oct 2022 16:40:27 +0000 Received: ("Tessian outbound f394866f3f2b:v130"); Fri, 28 Oct 2022 16:40:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dfa79859e01ca521 X-CR-MTA-TID: 64aa7808 Received: from aa8a67ef30ca.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 11CABBFC-3CB0-412B-8579-6E52E10A4173.1; Fri, 28 Oct 2022 16:40:20 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id aa8a67ef30ca.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 28 Oct 2022 16:40:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f3Sh7Yc1iyIiHprQ4L196CZtloQ6QuoUN8hosQMjwwys6Ku6Ej09NBNpAzlIzMMcdOC65f6BhGANStZfF3d6myRLalAukQ3n9fG1m/jW1CSJ7oH4bMMB8MpEuc7ifS3K5o6RiISYfunyYFGLxAvmRAYzWNTll2a4oiSQo7KFASagrGavLEu/Sl1wNC3tHiqCXJtmQ2n+qzTWzhmbWjDqfMYmGJ8A8R5xpPqu+YnA5+F0N8pl6Hn6pUmGguABdkWQVKQdNzhhU+URjp8gZVPIk8Sbzzdpib1I0hjxIz28nkZ+MYjHuV/v2acmt49W83t6hqidFc1ImQFujBs3rx5pdw== 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=kZMBFoj5oDkW1HZrRM0r8/Ffwqw38QT5zY4wpZ3MAuE=; b=PfaFHxza1TXCQZBw0/0JH0TJbAJO682vT1dcCzbRGCMD8jE4LQgrj8kCqYem9r3Ug/nBnOVK+AqXwhE5RV9EbgCW0ooCrmh56jExnlmJ7tTmLOa1kTV6k7A9uTtkOJtJqHSkrO+K9+M4H0i5Zl2RRTL+NmN241ml4Jab8mXf/IW4aELqTZdBaVRxPTYBfBfQElhW1bO5QosI96ndD1EDh88eTe4DkLdwl6AuxF+KbFlD9Mo4Ux3E3cqKF7O9ASDkA8hZF3vxT8ZYuyg9+6PQrRXBBzVBnrkV/H5l6EJDfwB26PchWYyF6kk41h7TCNjExd22tRbCMCVTWWUT8DU6gg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM6P195CA0054.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::31) by AS8PR08MB9020.eurprd08.prod.outlook.com (2603:10a6:20b:5c0::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Fri, 28 Oct 2022 16:40:12 +0000 Received: from AM7EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:87:cafe::12) by AM6P195CA0054.outlook.office365.com (2603:10a6:209:87::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Fri, 28 Oct 2022 16:40:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT027.mail.protection.outlook.com (100.127.140.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5746.19 via Frontend Transport; Fri, 28 Oct 2022 16:40:11 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 28 Oct 2022 16:40:09 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 28 Oct 2022 16:40:09 +0000 To: Subject: [PATCH v2 3/4] Fix elf/tst-dlmopen-twice not to exhaust static TLS Date: Fri, 28 Oct 2022 17:40:09 +0100 Message-ID: <8dcd34ccf6d5d07153baf9bc559a102ea5877ff1.1666974807.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT027:EE_|AS8PR08MB9020:EE_|AM7EUR03FT063:EE_|DU0PR08MB8712:EE_ X-MS-Office365-Filtering-Correlation-Id: df48835e-d891-4d1c-850d-08dab9031e87 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: QP5/SlR+93iUEm1h+EItadkwySnVhhqF9p0NGwmTvqa7iQrATCSwpvNtUzoyD4ObD4mi9hU/IcZt4CzUqHuOl74IrOnIRtopLoY/liY5h4XxjT4FEb4lQrTh+PEmmOPn98KTHFxg4LHte+WApRX+SoCVkgyj7KOVfqXgsaaYSQeJeNZ6l7kz6qOWE2+ePZOSK5QYhNIxpjE4ZFlllIAJ8BSowl+162RxsTPIyEz/2RFwgUMF7nrScJAFKHwXSUjaS8jkdylqnrwbYhIdJaLtppZztnG8JDH1cn63PDdw98gMV126WgthbGZIExUi7DzyqebyUnq8rHJG2QlhW6BEy320xXLQCFbQiymNu7FmiuVusHSP2uWmfvxWqYRcByMgwmwGWREMBpjuA5oFhDFS08qJ49TgjsCHFmht8ZZvOkw5vB1HNCxCRljDVu9P72pV3fFoflxOfcZvgQBsTttlaQHN6lnn2L34ibNKbowymf34B+/gwyowSh8mXS/ghiEoM+0fEk/japMQzBeHd0j2ggZGiVuixGmbzKsnDADsypybWparTlcAz0wwqYpDpcsanqleC2nlA/iTW/5yPrHyBbTnG6azS9K7Bj1xSbJBVbeUbE9H48Kar2BjsIX/rX+ZkPA4UYnY3LHHtwUAJ3DdyQt0wfRzB8hJ+4XNLtkIYlTJ5HEnz7pz6OF2Ja+TV0jqESdjLJnm1xK/9BJcdzMQ/aovgxxZnhVeAKpH7NvPhfgK10buNdB5wT4TpYzIQv5KM/T0smtKEXGvyXPH6rMPeEZMhFwEsOCcAzZGPy+6ItelLAkYnFnOACG1ZNtlQBNf X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(396003)(136003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(82310400005)(478600001)(7696005)(36756003)(26005)(316002)(70206006)(70586007)(2616005)(86362001)(356005)(82740400003)(41300700001)(186003)(40460700003)(8936002)(81166007)(8676002)(5660300002)(6916009)(336012)(47076005)(426003)(4744005)(2906002)(44832011)(83380400001)(36860700001)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9020 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 85f6fa6a-9556-449a-bd3b-08dab90314e0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YbjskutF36p1EbR8FySBzhOC4lvFUMKcz6PgkwOO4aSF3t1tFBDbN7CYx9g2FBYvY/Jo/72qR0Re7UsTEXWKKyNdocUIE/PkQLSM7GAOoeO+e+ncxAXT0VFFmbXZpYJ1e91QrQeMaNALy5Nvwfizj1h5fKR6upwexoJoqramzna1YgoksuAhSYT8zrRj2C5ilQrrW0IHzYLBez+dqdwL+V7cmNW+aDfRVCyEWMkN9PEVZqGOU6xsb0EFUAu4WOqhZR8rn5GSMZbhPxGiyORi2eMdNDdug64g4XojHXhKonPJltAaXC/4PP8R3yfbNzHYM8An10XhkpwWO5+y8jnKKIWCiCRP3Sd50Va7A4hCeUmf9vJOHOR6T9/7QqZMYmvNlicRqCaRFXDlT8dxRXZnec65BnSj/9ZottXJ8sGIo34e2SqajK0y0X+JcDjuPmi/Ax6Kn0KG8ANUfr12rfVxRxI1jNZcOt8eVUr3QTTMgzg5HhbY3T0BBcsNrtIO7w3aKUtx+aASRp3df6nxhS8HPfCC1Hxb1Uz6Ymy4saiB4aI2IZy8e3oFdoCmVdn4Wtn8MiI1aNGmMPHoupLkEh8it3w/aME347VTcSup8+yLc0Ife2/CT7qDoIxbM9rxUlXiH3+3XD1L3eHLbvWw1L25btHNnG3ZlJBtmMjWeJM4Xd4HO/TKaEDupIQql8cO+JSK5wGs0VgWQCYQu9oaAP2hfzhPyyW1DgNy5VMEnUCIan0Fye9vAP6bhSuCYxvoZyCSyyxEOBTPPw7hPWzzztMZ9A== 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:(13230022)(4636009)(136003)(39860400002)(346002)(396003)(376002)(451199015)(36840700001)(40470700004)(46966006)(2906002)(6916009)(41300700001)(7696005)(82740400003)(36756003)(5660300002)(40460700003)(4744005)(44832011)(86362001)(70586007)(8936002)(40480700001)(81166007)(8676002)(70206006)(478600001)(316002)(26005)(47076005)(426003)(83380400001)(82310400005)(2616005)(186003)(336012)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 16:40:27.3959 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df48835e-d891-4d1c-850d-08dab9031e87 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: AM7EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8712 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: 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-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" By default glibc only allocates enough static TLS for 4 link namespaces including the initial one. So only use 3 dlmopens in the test. Reviewed-by: Florian Weimer --- v2: lowered the dlmopen count from 10 to 3. --- elf/tst-dlmopen-twice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elf/tst-dlmopen-twice.c b/elf/tst-dlmopen-twice.c index 70c71fe19c..a8d7e5e081 100644 --- a/elf/tst-dlmopen-twice.c +++ b/elf/tst-dlmopen-twice.c @@ -46,8 +46,8 @@ do_test (void) recurse (1); /* Then with nesting. The constant needs to be less than the - internal DL_NNS namespace constant. */ - recurse (10); + glibc.rtld.nns tunable (which is 4 by default). */ + recurse (3); return 0; } From patchwork Fri Oct 28 16:40:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 59587 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E5903886C4A for ; Fri, 28 Oct 2022 16:41:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E5903886C4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666975299; bh=ThkY9eupWQ57fMPbpH12redPzowsUpiK06WPou54m9M=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=N4ZRATtRW+j4k9YBA42z8rn6ClaOQTEfyIXTPrHHxQdG/lRSFDBSsRDYWGevqyPep IBJ8dlMPRyZcTYDpsLzfdy0P8rAW0hAN2zD2SrrVJ9pjp0qO44DARtOO1YRc7l2FA5 aMAX/6QOrS62Qh3qXRoeL3z2L5wGyMvbCBuFT/1M= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2082.outbound.protection.outlook.com [40.107.20.82]) by sourceware.org (Postfix) with ESMTPS id 8C422383FBB5 for ; Fri, 28 Oct 2022 16:40:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8C422383FBB5 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=aiQUYUWmcW7vAr8N5gxZcMcJbQdESbXE2qTBeaWERLLDO0w+gXTUyADQ7HtGjrGI1tNwscreepRFhS7LyZrLjmjyghU581qV8681Zw4k/RCtPXwOQV5G0UYbb5mjZc0+pQSDJIo4BLbGKrPIy//KuBeSAbiW8G9XRR+VVf/sjgKyC6Lw5QgMiOcv2WFRIb+SLiIOVUYWEI9IGKEXvI1iS1TpR1kYx0AcP5Hzi5/FlA5EQNe+ltvsaFx6TSSkQWmxjuXfsAGEUXTc8JRCL9UqB0MqPgspKmey9oa7jAfkE25QBzW5cYzQvWjbxV1lTrBu8f529UQsysAARAeemV030g== ARC-Message-Signature: i=2; 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=ThkY9eupWQ57fMPbpH12redPzowsUpiK06WPou54m9M=; b=UNy6b0VgTUFxk9Owv063WQOdcGALaKVFnNKERVxIMg+GpuvXrueyEoiwMXmOZfhwkpPmZJJdqixP7gTOCl4L9wmrAJWUbeNxjXzwkynpueyX0nhR1LiTkD/cFcLfu745aYc4yMpQ/Mm9NkQqRzgQ50vUO2U4HYUWyV+A+DloJzXkrM/RP0XaYADokGym6d/PtM9GK2rR5E8D11ppN3KMfhX4u+4Rv2I9ORr2WKi6qYldNHEFLc/PAMbQVldZD2hH9FE6A+oKuOKnidTFJbHt0OtBujY01CahIryctnibMY6r23va3DOlnvsiRVmcLotXwlff95SJLJNbHelbZZVV/Q== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from DUZPR01CA0041.eurprd01.prod.exchangelabs.com (2603:10a6:10:468::19) by AS8PR08MB6519.eurprd08.prod.outlook.com (2603:10a6:20b:31c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Fri, 28 Oct 2022 16:40:33 +0000 Received: from DBAEUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:468:cafe::c9) by DUZPR01CA0041.outlook.office365.com (2603:10a6:10:468::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23 via Frontend Transport; Fri, 28 Oct 2022 16:40:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT052.mail.protection.outlook.com (100.127.142.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Fri, 28 Oct 2022 16:40:33 +0000 Received: ("Tessian outbound b4aebcc5bc64:v130"); Fri, 28 Oct 2022 16:40:33 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 5909ed89e53ffb1c X-CR-MTA-TID: 64aa7808 Received: from 9f1bd45d0a3b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B55DF354-1A51-414A-B4AA-CB19875ECD96.1; Fri, 28 Oct 2022 16:40:27 +0000 Received: from EUR02-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9f1bd45d0a3b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 28 Oct 2022 16:40:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H4Giy3W4BCDxlx/ESH1qzypa9b+SP5cxBol6GteMxQtl2BoLGuc1Vy1LYsFjHccitpbWCkRIhDPg7uO1xDyRiF+z1dpVhdaXHQdH6H8Og4X6w6EhGPM78v2Amw2RLi8H2PFo+jrj1oid7hlGuKCFlq0zg/efftkiQnIKI+ZnXTh79e+yVShAmCXBp2ys6R1eO/9ZlkHzpJoerBC9st+AcarYzciFS5pF6Sju2Wm3ZBcWPNYWEqL9Hx/5NXlgG6QuHZap4cWKqdCZxHScd6De2soxTNud1qDIGR8/oALe0YrUK23GF0TmjqAaPoLaNUn3oI4qCSTP0hCQhugvPvB/KA== 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=ThkY9eupWQ57fMPbpH12redPzowsUpiK06WPou54m9M=; b=fISrgCjIeYw+57Q+Mc1/WbE/3FQJWEglAYWwyWP5fN0T+MOf7v3wrYKndhK1AxXS3x48o/JHfzFNl6YaqoQf9oVIuqEdwPc9Zxmi+kB/BcZeLSUftRxXopdRC7pkZij03tassJYgsPbHTR1TGg9Fyvnn8l8G//KBXz6gGC3SHjuQvlz+B+uh1lmn/8e92gN4HayvUexDGbWXl/Y9wCAIJvPL8jeXWMISn5NFvbhcC7A5/OBRVxj4vXh/o5c7AzCyJKtFrUi32aQV31o8lU/45mQRUv4ytL5ur3iZKXZffk36JRAKWgJa/YboK/O1vlQQwp3dlefRoloDO4znwF13sA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM6PR02CA0028.eurprd02.prod.outlook.com (2603:10a6:20b:6e::41) by DB9PR08MB6345.eurprd08.prod.outlook.com (2603:10a6:10:252::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14; Fri, 28 Oct 2022 16:40:16 +0000 Received: from AM7EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:6e:cafe::c5) by AM6PR02CA0028.outlook.office365.com (2603:10a6:20b:6e::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Fri, 28 Oct 2022 16:40:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT041.mail.protection.outlook.com (100.127.140.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5723.32 via Frontend Transport; Fri, 28 Oct 2022 16:40:16 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 28 Oct 2022 16:40:15 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 28 Oct 2022 16:40:15 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 28 Oct 2022 16:40:15 +0000 To: Subject: [PATCH v2 4/4] Remove unused scratch_buffer_dupfree Date: Fri, 28 Oct 2022 17:40:15 +0100 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT041:EE_|DB9PR08MB6345:EE_|DBAEUR03FT052:EE_|AS8PR08MB6519:EE_ X-MS-Office365-Filtering-Correlation-Id: 0577e421-ac67-4754-b5a7-08dab9032236 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: r/9DE32jigA90UgySdJkBZl0dHh9OFlKWYCwMFzwiED8JTVpVEs+3tG+DD8gSACYTjwsO82qYZADBeafDJe8GopCGGFKJqlzwzQCGMYqz7yYC2wS8vE3Akiy1T5xQuZKdDxHy0f0mLGS3TPE0rj7zyrZJxmclrDLc5hhkWS0TkHiBHVbrJth0ENzNCgk3m8pSyW+fk64KaZ8vNQOKv40uBiecg3EGROdHpQ/X7t6OwzW2fIn9cVrDDduNbbqcPDfnmMfvvS8rbVTM1+kJIoQmKSdwdCFIWSKObGNCfzWCpuJbjWEF/0qUwMZtf7blFbZimOjovq5JNlF/bNVu5p0jZD4NiNxWhQ4bVHNRQVs1AkpIVooaXCiVQMJyzPdDR6XQk1q03CLTGZ1CLGecU4m2ieUDV/U+Xki020y7QiDTbd1U4Qo5Gg1LQJO9LRBHCT3nLLY7BVyKs9MesGdUR8Y7mCZjodmzTNMSlay9P0C/eifzI5lwcGIEx7a86tB/HqzIkQWxRug/EosWv4xhjz8q06iy5Pu0e8KGvIZeFEexNbDEWWDDhQRhuCZQgDWWLEY+da7qRjHlX5eytR+O4IHfVtkN+4qmoL1fW5C0gKIqGXLWPxMCQM9hlqJdLOPhrCJ96OhyYNgCl8ayiUzSmVIhp/LLLa7pIcD4pTujkMAiwKKVa0PAHkdag0oSiKjZo0y9s8US3nuqT/U7g/Pl1ykKs+oVH7dxup5KP/dQ+mccr4Vm2L8cgfJ+dlmnZSe0AKLQLUacGyo3zUAjFkSqE01wog7/RkYvw/gRZbHxdswHBEWJwqXsRz1f2eemHZhhTHJtjqm7JPT7YYASCj+mHeBu2eQ6MpjgEqJFM2FT0moR5Y= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(396003)(346002)(136003)(376002)(451199015)(46966006)(36840700001)(40470700004)(36756003)(40480700001)(186003)(83380400001)(316002)(66899015)(426003)(82310400005)(47076005)(336012)(478600001)(26005)(44832011)(70206006)(40460700003)(41300700001)(70586007)(86362001)(2616005)(82740400003)(2906002)(8936002)(6916009)(7696005)(8676002)(36860700001)(5660300002)(356005)(81166007)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6345 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6bb7fdec-b8bd-4384-e683-08dab90317cb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hqfh/TbBFJzxKt02s6f7eeH6JvpTPT9mcMeAC5KaEmX4bGFC4TNTcaeSz8gBOkLDhavkbvWNbiKvgYlqGwHYUWLRyXE4l2OTB0jcBuH7MOq2/7G9ZOFbonfeU5QTsbpvBwDPzX33TxMRrpk4zj9a4M7iOlCkCryGgfoX0R9kmNC3qsTiohz8a7Y0cQTQS8dqfl8DdgdgJWgo7MHsaej+6OFrXvTUAEsFxWH5/IzthYjYBll3FzYfkrLl1jHzaRyYXaNS7FhY1HBcxwm0CqX1VrWNHJ04RlzKyMhkuQHc/kb8HrkDFHg3qLaUVxy9K/p+Eu6giGfo5s7RBENCf3tQTlJLUH+c22D/nC1koEY0l4dXMLUHb1NKVg/WRCeAzy82tlIOtl/5rnV6JpH8h7a1t4C7YzinmS+rjmsNz8h5bm9d+UOMQW6um56aH/EQD8uelYwS8hS08S2Q1L940bBDOaclBuAc6qZt5TC3CtGd19v0jcIV9euHplVluLuv5qZgpik4vyQEz0HijDYGJ6AeklP7HgQ968ALbHLMaO45AmOHyz1cEmdih3HEf4L/dswK58FtQrMHbu79XeZmmvzSGDg5uAwR4seu1oxnY0+LvAHYJxF1N3+YrlKv+BCM+/dk4xxdZsNwymekG3GXZfD1y84Ei9FBIe7zrsk7EdscrRs7LCUGeGqbjXE4Uwi1xJrmuo7lYBV7bA5gQEjW3mEw6bxSvyPj72DsYohzM7zms3C3tY8yW3RZo9jGqo8OyH6cCxJUXntojT40LyA1cFnMoBdxK7iZCRLgn2gwbrcaKmEflzOycAoLjxjvuaP3sSME 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:(13230022)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199015)(46966006)(36840700001)(40470700004)(426003)(47076005)(83380400001)(81166007)(86362001)(36860700001)(82740400003)(40460700003)(2906002)(44832011)(5660300002)(8676002)(8936002)(41300700001)(70206006)(82310400005)(70586007)(26005)(2616005)(336012)(7696005)(316002)(186003)(6916009)(478600001)(66899015)(36756003)(40480700001)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 16:40:33.6397 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0577e421-ac67-4754-b5a7-08dab9032236 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: DBAEUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6519 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: 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-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Turns out scratch_buffer_dupfree internal API was unused since commit ef0700004bf0dccf493a5e8e21f71d9e7972ea9f stdlib: Simplify buffer management in canonicalize And the related test in malloc/tst-scratch_buffer had issues so it's better to remove it completely. Reviewed-by: Florian Weimer --- v2: remove all reference to scratch_buffer_dupfree --- include/scratch_buffer.h | 16 ------------- malloc/Makefile | 1 - malloc/scratch_buffer_dupfree.c | 41 --------------------------------- malloc/tst-scratch_buffer.c | 20 ---------------- 4 files changed, 78 deletions(-) delete mode 100644 malloc/scratch_buffer_dupfree.c diff --git a/include/scratch_buffer.h b/include/scratch_buffer.h index e4c5c8a85d..a9bdcadec2 100644 --- a/include/scratch_buffer.h +++ b/include/scratch_buffer.h @@ -132,20 +132,4 @@ scratch_buffer_set_array_size (struct scratch_buffer *buffer, (buffer, nelem, size)); } -/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block, - deallocating *BUFFER if it was heap-allocated. SIZE must be at - most *BUFFER's size. Return NULL (setting errno) on memory - exhaustion. */ -void *__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, - size_t size); -libc_hidden_proto (__libc_scratch_buffer_dupfree) - -/* Alias for __libc_scratch_dupfree. */ -static __always_inline void * -scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) -{ - void *r = __libc_scratch_buffer_dupfree (buffer, size); - return __glibc_likely (r != NULL) ? r : NULL; -} - #endif /* _SCRATCH_BUFFER_H */ diff --git a/malloc/Makefile b/malloc/Makefile index 4e32de2a0b..211be75e36 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -123,7 +123,6 @@ tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests)) endif routines = malloc mcheck mtrace obstack reallocarray \ - scratch_buffer_dupfree \ scratch_buffer_grow scratch_buffer_grow_preserve \ scratch_buffer_set_array_size \ dynarray_at_failure \ diff --git a/malloc/scratch_buffer_dupfree.c b/malloc/scratch_buffer_dupfree.c deleted file mode 100644 index eb3b95c1b1..0000000000 --- a/malloc/scratch_buffer_dupfree.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Variable-sized buffer with on-stack default allocation. - Copyright (C) 2020-2022 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 - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include - -void * -__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) -{ - void *data = buffer->data; - if (data == buffer->__space.__c) - { - void *copy = malloc (size); - return copy != NULL ? memcpy (copy, data, size) : NULL; - } - else - { - void *copy = realloc (data, size); - return copy != NULL ? copy : data; - } -} -libc_hidden_def (__libc_scratch_buffer_dupfree) diff --git a/malloc/tst-scratch_buffer.c b/malloc/tst-scratch_buffer.c index 9fcb11ba2c..1f1e770486 100644 --- a/malloc/tst-scratch_buffer.c +++ b/malloc/tst-scratch_buffer.c @@ -151,26 +151,6 @@ do_test (void) && array_size_must_fail (4, ((size_t)-1) / 4))) return 1; } - { - struct scratch_buffer buf; - scratch_buffer_init (&buf); - memset (buf.data, '@', buf.length); - - size_t sizes[] = { 16, buf.length, buf.length + 16 }; - for (int i = 0; i < array_length (sizes); i++) - { - /* The extra size is unitialized through realloc. */ - size_t l = sizes[i] > buf.length ? sizes[i] : buf.length; - void *r = scratch_buffer_dupfree (&buf, l); - void *c = xmalloc (l); - memset (c, '@', l); - TEST_COMPARE_BLOB (r, l, buf.data, l); - free (r); - free (c); - } - - scratch_buffer_free (&buf); - } return 0; }