From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20080.outbound.protection.outlook.com [40.107.2.80]) by sourceware.org (Postfix) with ESMTPS id EC02A3857367 for ; Thu, 5 May 2022 13:59:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC02A3857367 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=OXL5kMLlMcefdJarYW6jFXVwFLynh3aC94VdfUvbP5nx3UAxCX7sQrje/nTtuKdrqbKBxCAmkhPfb6Gxum1sWqOkn90J5wztiGI9DMjpkJqbc8LqMPDW+nbAbGWm1tg6172QIpbTAkqx9NnxgBzXSNSNQ3FE8J2qCAsx3PXUuNzLXi6zdceAaPv2MjwTs6it26FYmmm5Mq+FP2vGunVM2V+E2NHIDZArghu/j8Lq/nQPxdIHQhnJvlyIDIAa+0JUhRo7K8SVH3P4zDXC2gC3f+5l6KYacKD8eiKwcyWuR+FGXFj4oiuLbMaHRv4GegB+eeelBDOQu+hCBxMWY2ghvg== 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=u+RFq1Dit/uVdanv3e0GmxN/tXuLxDuep/zQfp1Wfcc=; b=Pw2/SCXSWJvoHtFMg4hHrjohhR+kIa1b7xFO1mbqLefN8Q27Z4uCQnItDM0Zeir3WNRu82aaaxOKICAXXkH7wMMVtBPTfwQNBFr4S/CrzPosLO6v/S5Ohrdm+Qiwah3LTU3edo9YiKENZ0Qm8CCYQ+3NFBMCxCu40Zpg+6LrSVsQSn5jBTjq3tyWvagBCKREa7rJjxbE+2l9k3u5qoZpAdh/RPGstI5l7eP9bZLj9osaSzDlIeeGqW6Y9OWKl6h9o3sSbhmDJFdLbLorN4c4UkZ1OAum6S03UmmmZro2LwPxSQbTQkSJcL207nx8SefVKH868+geo5HmTxL1ow1o3A== 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 AS9P250CA0001.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:532::7) by VE1PR08MB4845.eurprd08.prod.outlook.com (2603:10a6:802:a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13; Thu, 5 May 2022 13:59:21 +0000 Received: from AM5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:532:cafe::2d) by AS9P250CA0001.outlook.office365.com (2603:10a6:20b:532::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.27 via Frontend Transport; Thu, 5 May 2022 13:59:20 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT044.mail.protection.outlook.com (10.152.17.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.15 via Frontend Transport; Thu, 5 May 2022 13:59:20 +0000 Received: ("Tessian outbound 78191104f1b7:v118"); Thu, 05 May 2022 13:59:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 42bbed1f403b0815 X-CR-MTA-TID: 64aa7808 Received: from b87b46331062.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 115C427A-81CD-49C0-905A-11F8B42AAA9B.1; Thu, 05 May 2022 13:59:13 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b87b46331062.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 05 May 2022 13:59:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uz+kGMHM2KXiS7dSu/PKKXuHtZY6hvYr5a/iS/1q3LT08uf4bvEkg0MPGeY0Z8+F1Pp8U3L66rHvCV7jlUGyNrbBzfVoXFeF4xSCbkmBe4q0X85J3RM+UlGtZylVYGEPysrpvl0F2vEXxEPIiNxXpmOA1FfB/q7NTAKk+L+yx9s16s/Z0rnq+RxagffJUi8EZZYlMsunfJsq/szFtH1jy8nc6nlLmm7CM1GPoAdStzN/Z60nF0g8EG3x5Soaq4CTKsoGQQ5txz3UCLKBsOyCfRoigvQpP4s0ner73RBg7T8VKNGixu64IlUdmKB+kDN59+qXYvGoQDLTuINlzXUNqg== 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=u+RFq1Dit/uVdanv3e0GmxN/tXuLxDuep/zQfp1Wfcc=; b=kxiyFcJIQl4WDoZwc9SX3QaRBORuks8bO7j1XSURHoi8lGq62AbWrnQXrkiD25egvcBBu6JeMBuJtptjtd1XVItwpWizU0fEG0NH2yIxGo/UZIgQ3d7TXZBRuoSH026CgT6tbKEMqQ2WVkEoD9lBgVViqXfZ+JtyDGe7ZgKXvQRcyw/wdkgW7LdUnZEv8ZT3zfDQJhxVp1xp4pGD0gj9Ev4hZ81tG38tk+X5gtnjCwT+BudVnGelI7HTlrgns4thJNv4HVZsvKGLqlGSxuAu0atEQO9F1+ebYK+L7kYRe3Mw3PWUT7uPoZTnw9qRIrZpmWudKI5+ca4H6jj6EQn3yQ== 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 AS8P250CA0001.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:330::6) by DB9PR08MB7082.eurprd08.prod.outlook.com (2603:10a6:10:2c2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24; Thu, 5 May 2022 13:59:11 +0000 Received: from VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:330:cafe::4d) by AS8P250CA0001.outlook.office365.com (2603:10a6:20b:330::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.27 via Frontend Transport; Thu, 5 May 2022 13:59: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; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT005.mail.protection.outlook.com (10.152.18.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Thu, 5 May 2022 13:59: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.2308.27; Thu, 5 May 2022 13:59:14 +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.2308.27 via Frontend Transport; Thu, 5 May 2022 13:59:14 +0000 From: Szabolcs Nagy To: CC: Florian Weimer Subject: [PATCH v6 3/4] linux: Add a getauxval test [BZ #23293] Date: Thu, 5 May 2022 14:59:10 +0100 Message-ID: <7b79ffb5ec178813653763651aa46403afd49cc2.1651757640.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 6c52d724-6542-4b99-a24d-08da2e9f73fd X-MS-TrafficTypeDiagnostic: DB9PR08MB7082:EE_|AM5EUR03FT044:EE_|VE1PR08MB4845:EE_ X-Microsoft-Antispam-PRVS: 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: 6G8XTgImMsH9uP8/75FUxH07ZQZVcxGBisukvBKkduA0vqs7pdfmgq0gIL2opiUKkGhILiU3cjMtMuznZVmZm9x6FboBrANyRzmK+n2Wv+6qNYcKLt7vh24sJWZKjn39W8Jrc3ALKyWkofQ8ZyEAp7gS1wLav3A13HsxA3JlOLEKXrsdh9SsGkLN/A2qqrlBGMXd4e122MaKxBrTi44QeYwIj8/HpmXpIptMvb9gM6AVSYvPHtSwFpSuYIGjgvGoxk2RqqIVASgVhiPJTjHdwxde++4+3cJL6eHgeuIRNHjdgy6dVyY4nkab3+m0OIAazKt4fB+eenjT61u8LfpIXKnkfYpT4R/yedk661kmjThc4fVwtnF/oPj8T3K5XQD9tPDTJlAVM8XR07o06cRrkwOhN83tVigkvPGutUnKnt/HO60Wph25qUilxCKHLBsoA2dDetu/pYZLUdR3eeYWnNq5l5Hv5Ea5pP5oq8RUGslr/EksnCl0BRZdtXSqIZVtJd9mXb3dfgoVddbjZ6EpWVi/i4bKiqES4t/qmoQvqG32p9Zp6PLVDOuZRl8N7tOFzKa7srASfbMOeJbEM3BTKcm8vv+7clAV//SfJZs0Klt65on7Dd/Hv2419tM74FHKlAiOEZ7uiOX7W3FgjxF56xr+WnwbxqPsDEU6jJ6pTT0b6weAbDmv7lF3Z93i3awpGc8Hew4mezQqJO5KLRUPceMnCIKh0oEFYqKjZyStZdwpsz1aeSTU/Zh5PJEYuNXwmX2nb63LR5P0CB0QSxWIF/MGjLcYSkFqGYI8XT2pe832Zi0mlumrFCDbxtNXEhBj 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(6916009)(7696005)(508600001)(36860700001)(2906002)(70586007)(4326008)(70206006)(8936002)(8676002)(26005)(44832011)(5660300002)(6666004)(316002)(186003)(81166007)(426003)(82310400005)(336012)(86362001)(47076005)(36756003)(356005)(2616005)(40460700003)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7082 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d73d1920-d7de-4765-bae9-08da2e9f6e8e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9dGFPV1Cd27ZGVk/9TmXQ8UfxQ1t8S206qj4JpIMauHegKCpoko8HR+bYrfLK5+CzjqCGTuRwrIOmaSg7zVvggy5R0VgUJTw4Wag6ME4nN7L9IA6LeeHYAxyvrhB4ui7bgcH//UUyt3E1e08ouXYbLWpWXRIivs3p+boHM7Rnlww8KwxhVeajq+rpzH21Ct4DDNjpp0XxuFfWWpgw/rTklCKAaJc/oSQpotMzeoNV1RrOzGPNkrrMFeCBd8WOaEYcPcQhlMn0iVCvaJewKqOuAbu4bx4lFKwHEOp665FVYphJwz62CtbHBsnY5zDpdZxLTrYrHo4kqqZI7wQmhdvBIVglGTjfuURoOVpDZUOMkgjgCeEHlD6x7X8H43/Wrzsn4sXFzFKQrBRNyEz3bzbCTMbqo2SCXMbEgWijKxTTzlFUwyeHcm+vKqV6VVXa3h8B6kSXir9P2hD/pDaGPlIVVWDTPWkZ9cmlhLlkk64mtP9+gc2ZDH7Sl79TPUYmkycfhFOntwqOTXNqPH5wcr4FQt2BaEX1FfLrkrSHlRakabQUpUT0PKQjicIoDhWBaeeZKJvgJejd8Im500zLvhWsZfQwzHuFBno1K1b9U3xtk5wG2LTjT7DRddSH9K7WixdDT+NSlKyiwSHAW6gezaPjnET7JqQGqSY0N7j3mMneeXDBE5VWnFoAKzpSrD/3HdDZbPgj27UgQXLx9X85lTRZt/GJtX6i8lC1HmO2EfPDFlLezRP5lfS+I+MiaCBvQhqElwc3Z6dbdDzOyJABDph4ppLGV6GWS/NgIMN1uyxpVw= 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:(13230001)(4636009)(36840700001)(46966006)(40470700004)(8676002)(4326008)(6666004)(86362001)(316002)(70206006)(36860700001)(81166007)(70586007)(186003)(426003)(336012)(8936002)(7696005)(47076005)(5660300002)(44832011)(508600001)(107886003)(2906002)(26005)(40460700003)(82310400005)(36756003)(2616005)(6916009)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 13:59:20.6462 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c52d724-6542-4b99-a24d-08da2e9f73fd 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: AM5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4845 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 05 May 2022 13:59:26 -0000 This is for bug 23293 and it relies on the glibc test system running tests via explicit ld.so invokation by default. Reviewed-by: Florian Weimer --- v4: - New patch. --- sysdeps/unix/sysv/linux/Makefile | 1 + sysdeps/unix/sysv/linux/tst-getauxval.c | 74 +++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/tst-getauxval.c diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index ca953804d0..89cb005c7d 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -126,6 +126,7 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ tst-prctl \ tst-scm_rights \ tst-epoll \ + tst-getauxval \ # tests # For +depfiles in Makerules. diff --git a/sysdeps/unix/sysv/linux/tst-getauxval.c b/sysdeps/unix/sysv/linux/tst-getauxval.c new file mode 100644 index 0000000000..c4b6195743 --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-getauxval.c @@ -0,0 +1,74 @@ +/* Basic test for getauxval. + Copyright (C) 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 + . */ + +#include +#include +#include +#include + +static int missing; +static int mismatch; + +static void +check_nonzero (unsigned long t, const char *s) +{ + unsigned long v = getauxval (t); + printf ("%s: %lu (0x%lx)\n", s, v, v); + if (v == 0) + missing++; +} + +static void +check_eq (unsigned long t, const char *s, unsigned long want) +{ + unsigned long v = getauxval (t); + printf ("%s: %lu want: %lu\n", s, v, want); + if (v != want) + mismatch++; +} + +#define NZ(x) check_nonzero (x, #x) +#define EQ(x, want) check_eq (x, #x, want) + +static int +do_test (void) +{ + /* These auxv entries should be non-zero on Linux. */ + NZ (AT_PHDR); + NZ (AT_PHENT); + NZ (AT_PHNUM); + NZ (AT_PAGESZ); + NZ (AT_ENTRY); + NZ (AT_CLKTCK); + NZ (AT_RANDOM); + NZ (AT_EXECFN); + if (missing) + FAIL_EXIT1 ("Found %d missing auxv entries.\n", missing); + + /* Check against syscalls. */ + EQ (AT_UID, getuid ()); + EQ (AT_EUID, geteuid ()); + EQ (AT_GID, getgid ()); + EQ (AT_EGID, getegid ()); + if (mismatch) + FAIL_EXIT1 ("Found %d mismatching auxv entries.\n", mismatch); + + return 0; +} + +#include -- 2.25.1