From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88265 invoked by alias); 2 Nov 2018 09:50:58 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 88250 invoked by uid 89); 2 Nov 2018 09:50:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Nov 2018 09:50:56 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 788585CC for ; Fri, 2 Nov 2018 09:50:55 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 454555C1A1 for ; Fri, 2 Nov 2018 09:50:55 +0000 (UTC) Received: by oldenburg.str.redhat.com (Postfix, from userid 1000) id 1F0124399457D; Fri, 2 Nov 2018 10:50:52 +0100 (CET) Date: Mon, 01 Jan 2018 00:00:00 -0000 To: libc-stable@sourceware.org Subject: [2.28 COMMITTED] Test stdlib/test-bz22786 exits now with unsupported if malloc fails. User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20181102095052.1F0124399457D@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 02 Nov 2018 09:50:55 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg00001.txt.bz2 From: Stefan Liebler The test tries to allocate more than 2^31 bytes which will always fail on s390 as it has maximum 2^31bit of memory. Before commit 6c3a8a9d868a8deddf0d6dcc785b6d120de90523, this test returned unsupported if malloc fails. This patch re enables this behaviour. Furthermore support_delete_temp_files() failed to remove the temp directory in this case as it is not empty due to the created symlink. Thus the creation of the symlink is moved behind malloc. Reviewed-by: Carlos O'Donell ChangeLog: * stdlib/test-bz22786.c (do_test): Return EXIT_UNSUPPORTED if malloc fails. (cherry picked from commit 3bad2358d67d371497079bba4f8eca9c0096f4e2) 2018-08-30 Stefan Liebler * stdlib/test-bz22786.c (do_test): Return EXIT_UNSUPPORTED if malloc fails. diff --git a/stdlib/test-bz22786.c b/stdlib/test-bz22786.c index d1aa69106c..777bf9180f 100644 --- a/stdlib/test-bz22786.c +++ b/stdlib/test-bz22786.c @@ -39,16 +39,25 @@ do_test (void) const char *lnk = xasprintf ("%s/symlink", dir); const size_t path_len = (size_t) INT_MAX + strlen (lnk) + 1; - TEST_VERIFY_EXIT (symlink (".", lnk) == 0); - DIAG_PUSH_NEEDS_COMMENT; #if __GNUC_PREREQ (7, 0) /* GCC 7 warns about too-large allocations; here we need such allocation to succeed for the test to work. */ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than="); #endif - char *path = xmalloc (path_len); + char *path = malloc (path_len); DIAG_POP_NEEDS_COMMENT; + if (path == NULL) + { + printf ("malloc (%zu): %m\n", path_len); + /* On 31-bit s390 the malloc will always fail as we do not have + so much memory, and we want to mark the test unsupported. + Likewise on systems with little physical memory the test will + fail and should be unsupported. */ + return EXIT_UNSUPPORTED; + } + + TEST_VERIFY_EXIT (symlink (".", lnk) == 0); /* Construct very long path = "/tmp/bz22786.XXXX/symlink/aaaa....." */ char *p = mempcpy (path, lnk, strlen (lnk));