From patchwork Tue Mar 9 22:54:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjun Shankar X-Patchwork-Id: 42409 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 7E2FC3860C36; Tue, 9 Mar 2021 22:54:13 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from aloka.lostca.se (aloka.lostca.se [178.63.46.202]) by sourceware.org (Postfix) with ESMTPS id 580093858039 for ; Tue, 9 Mar 2021 22:54:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 580093858039 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lostca.se Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arjun.is@lostca.se Received: from aloka.lostca.se (aloka [127.0.0.1]) by aloka.lostca.se (Postfix) with ESMTP id 55BC219AF9; Tue, 9 Mar 2021 22:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lostca.se; h=date:from:to :cc:subject:message-id:mime-version:content-type; s=howrah; bh=l j/s0mluj/Ai5yrL1JhYZDR60fQ=; b=yzWHziBX59OMTzfK1HjKkj6heq624imfk 2BjH7cv377emCCl87/ld+9NeuyGRTX+Ehi/04TjLB92OK0GzuX6EUut8KujK05xH dj6gHk7Ot8Ff3Y38PNLq99hxl9f/5nZ+54Tc/3jRdbjvjytFk71abP5XMAq8GD8V dodStjYlow= Received: from localhost (unknown [IPv6:2a01:4f8:120:624c::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: spectre) by aloka.lostca.se (Postfix) with ESMTPSA id 1968919AF8; Tue, 9 Mar 2021 22:54:08 +0000 (UTC) Date: Tue, 9 Mar 2021 22:54:06 +0000 From: Arjun Shankar To: libc-alpha@sourceware.org Subject: [PATCH v2] Mount /tmp as tmpfs in test-container and run utime tests in it Message-ID: <20210309225405.GA84301@aloka.lostca.se> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: , Cc: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From: Arjun Shankar tst-utime.c, tst-utimes.c, and tst-futimens.c create a temporary file in /tmp to test Y2038 support in the corresponding functions. This causes the tests to fail when /tmp is mounted as a filesystem that has a Y2038 bug; e.g. XFS. This commit changes test-container.c to mount /tmp as a tmpfs filesystem and moves the utime tests to the tests-container target so that they run in a container against a known-good filesystem. The test-container change of mounting /tmp as tmpfs led to one of the existing container tests, elf/tst-ldconfig-ld_so_conf-update, to fail. This commit also adjusts the test to not use /tmp any more. --- Notes: v1 ("Prefer /dev/shm over /tmp in utime family tests") here: https://sourceware.org/pipermail/libc-alpha/2021-March/123486.html I went a different way this time. Since we cannot touch /dev/shm and since /tmp is not guaranteed to be tmpfs every time, I containerised the tests. This meant modifying test-container to mount /tmp as tmpfs and adjusting one existing container test that failed due to /tmp being a mount point. --- elf/tst-ldconfig-ld_so_conf-update.c | 4 ++-- support/test-container.c | 4 +++- sysdeps/unix/sysv/linux/Makefile | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/elf/tst-ldconfig-ld_so_conf-update.c b/elf/tst-ldconfig-ld_so_conf-update.c index e8bd4c3598..7462516f59 100644 --- a/elf/tst-ldconfig-ld_so_conf-update.c +++ b/elf/tst-ldconfig-ld_so_conf-update.c @@ -32,7 +32,7 @@ #define DSO "libldconfig-ld-mod.so" -#define DSO_DIR "/tmp/tst-ldconfig" +#define DSO_DIR "/tst-ldconfig" #define CONF "/etc/ld.so.conf" @@ -73,7 +73,7 @@ do_test (void) "lib" (for regular shared libraries) or "ld-" (for ld-linux-*). */ char *mod_src_path = xasprintf ("%s/tst-ldconfig-ld-mod.so", support_libdir_prefix); - if (rename (mod_src_path, "/tmp/tst-ldconfig/libldconfig-ld-mod.so")) + if (rename (mod_src_path, DSO_DIR "/libldconfig-ld-mod.so")) FAIL_EXIT1 ("Renaming/moving the DSO failed: %m"); free (mod_src_path); diff --git a/support/test-container.c b/support/test-container.c index 28cc44d9f1..0924bdc2e7 100644 --- a/support/test-container.c +++ b/support/test-container.c @@ -1160,7 +1160,9 @@ main (int argc, char **argv) sprintf (pid_buf, "%lu", (long unsigned)child); setenv ("PID_OUTSIDE_CONTAINER", pid_buf, 0); - maybe_xmkdir ("/tmp", 0755); + maybe_xmkdir ("/tmp", 1777); + if (mount ("none", "/tmp", "tmpfs", MS_NOEXEC | MS_NOSUID | MS_NODEV, NULL) < 0) + FAIL_EXIT1 ("can't mount tmpfs onto /tmp\n"); /* Now that we're pid 1 (effectively "root") we can mount /proc */ maybe_xmkdir ("/proc", 0777); diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index e42bc7f13b..cdbeb81f9c 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -107,8 +107,9 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \ tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \ tst-tgkill tst-sysvsem-linux tst-sysvmsg-linux tst-sysvshm-linux \ - tst-timerfd tst-ppoll tst-futimens tst-utime tst-utimes \ - tst-clock_adjtime tst-adjtimex tst-ntp_adjtime + tst-timerfd tst-ppoll tst-clock_adjtime tst-adjtimex tst-ntp_adjtime + +tests-container += tst-futimens tst-utime tst-utimes # Test for the symbol version of fcntl that was replaced in glibc 2.28. ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes)