From patchwork Tue Feb 2 12:58:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41893 X-Patchwork-Delegate: hjl.tools@gmail.com 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 B8C7C386F02D; Tue, 2 Feb 2021 12:58:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8C7C386F02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612270709; bh=N/7OYYVpYZ7fckzsdMNnT98snEkmkgNEz5Aa6anEWi4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kEU6PhwmbJhMkJ+jz2iebCeueT0dCEt25cvgMYtv3YAZNBeDF2+31h7UAmLhSSusO EItjmu9moTmJ9SuIs+zO+h8bqSS3SPNEbGSUfRw3xxnCp6CRg9ZLrmw2iou5qO/yR2 ZlLOnrpN50hNStZISglJEs0KU5oa5YHcb9oIXM+s= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id 79402385783E for ; Tue, 2 Feb 2021 12:58:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 79402385783E Received: by mail-qk1-x729.google.com with SMTP id t63so19627274qkc.1 for ; Tue, 02 Feb 2021 04:58:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N/7OYYVpYZ7fckzsdMNnT98snEkmkgNEz5Aa6anEWi4=; b=GEGGgr1ppLMU9J3i6YTX9lHOGyBgtN0mv+Ut8A/SGm1NE+9Hlz7xJXPyFElH3YE1BT bgqZkAMqiYjrDkH9/Hw0cu3O1mC3Mi7D3BuoBqxZ1uvFUy7LrzQw9S/61U7HxqdRJRuw VXzbWr0M59Jvkl8A+W06weRw4rNwEOFvJcmemJOc/e08cWH9C25/iTN1jRVR9rKjKdLT sRQ2LbikyfibVuB1yP9F9URuAeN27NMjG2W2ApITO1ZYOpPQnlugvzllsA3RLdTHjdvb dNqGTG6OgjtoCl1blaj2o1q9Jp6ytjpP471UbYBkhbrSh3Duh//JWyAavMCl4oh3nDVd aRgw== X-Gm-Message-State: AOAM531vqiuvlUhOvRUadHfMvNbVt3P1UZkHanMHjalhgm34By1zBhe0 Cj7CyEI6l/Uj2/i0foLxzEtCF1oiH/uFkQ== X-Google-Smtp-Source: ABdhPJwbqNB+b1Wke7Un/zqixHrU4KzN4lHqlx90IDGApMnkfmXiD/93lsDikFqA+SuWDbKAOT7Dyw== X-Received: by 2002:ae9:e90d:: with SMTP id x13mr21480312qkf.21.1612270705851; Tue, 02 Feb 2021 04:58:25 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id g11sm13450418qto.89.2021.02.02.04.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 04:58:25 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH] linux: Remove shmmax check from tst-sysvshm-linux Date: Tue, 2 Feb 2021 09:58:19 -0300 Message-Id: <20210202125819.1918921-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The shmmax expected value is tricky to check because kernel clamps it to INT_MAX in two cases: 1. Compat symbols with IPC_64, i.e, 32-bit binaries running on 64-bit kernels. 2. Default symbol without IPC_64 (defined as IPC_OLD within Linux) and glibc always use IPC_64 for 32-bit ABIs (to support 64-bit time_t). It means that 32-bit binaries running on 32-bit kernels will not see shmmax being clamped. And finding out whether the compat symbol is used would require checking the underlying kernel against the current ABI. The shmall and shmmni already provided enough coverage. Checked on x86_64-linux-gnu and i686-linux-gnu. It should fix the tst-sysvshm-linux failures on 32-bit kernels. I will commit this shortly if noone opposes it. --- sysdeps/unix/sysv/linux/tst-sysvshm-linux.c | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c b/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c index 2f05f21e4a..6986443c8f 100644 --- a/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c +++ b/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c @@ -122,18 +122,20 @@ do_test (void) if (shmid == -1) FAIL_EXIT1 ("shmget failed: %m"); + /* It does check shmmax because kernel clamp its value to INT_MAX for: + + 1. Compat symbols with IPC_64, i.e, 32-bit binaries running on 64-bit + kernels. + + 2. Default symbol without IPC_64 (defined as IPC_OLD within Linux) and + glibc always use IPC_64 for 32-bit ABIs (to support 64-bit time_t). + It means that 32-bit binaries running on 32-bit kernels will not see + shmmax being clamped. + + And finding out whether the compat symbol is used would require checking + the underlying kernel against the current ABI. The shmall and shmmni + already provided enough coverage. */ struct test_shminfo tipcinfo; - { - uint64_t v = read_proc_file ("/proc/sys/kernel/shmmax"); -#if LONG_MAX == INT_MAX - /* Kernel explicit clamp the value for shmmax on compat symbol (32-bit - binaries running on 64-bit kernels). */ - if (sizeof (__syscall_ulong_t) == sizeof (unsigned long int) - && v > INT_MAX) - v = INT_MAX; -#endif - tipcinfo.shmmax = v; - } tipcinfo.shmall = read_proc_file ("/proc/sys/kernel/shmall"); tipcinfo.shmmni = read_proc_file ("/proc/sys/kernel/shmmni"); @@ -152,7 +154,6 @@ do_test (void) FAIL_EXIT1 ("shmctl with IPC_INFO failed: %m"); TEST_COMPARE (ipcinfo.shmall, tipcinfo.shmall); - TEST_COMPARE (ipcinfo.shmmax, tipcinfo.shmmax); TEST_COMPARE (ipcinfo.shmmni, tipcinfo.shmmni); }