From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7AE523857345 for ; Mon, 2 May 2022 19:15:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7AE523857345 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-461-w4QxHK2dNM-eBYNe7iJkaA-1; Mon, 02 May 2022 15:15:30 -0400 X-MC-Unique: w4QxHK2dNM-eBYNe7iJkaA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A906B1014A62 for ; Mon, 2 May 2022 19:15:29 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.59]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E83D09D7E for ; Mon, 2 May 2022 19:15:28 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 0/5] Linux: Fall back to mmap if early sbrk fails X-From-Line: 68225a7568f2ea26c7ff64a21bb1a928987e46ab Mon Sep 17 00:00:00 2001 Message-Id: Date: Mon, 02 May 2022 21:15:27 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: Mon, 02 May 2022 19:15:32 -0000 This series implements a _dl_early_allocate function that does not need a TCB. It prefers sbrk over mmap to avoid creating too many PTE, but it can use mmap as well. Tested on aarch64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu. Built with build-many-glibcs.py. I manually used strace to inject an brk failure, and it mmap fallback kicks in. Thanks, Florian Florian Weimer (5): Linux: Implement a useful version of _startup_fatal Linux: Define MMAP_CALL_INTERNAL i386: Remove OPTIMIZE_FOR_GCC_5 from Linux libc-do-syscall.S i386: Honor I386_USE_SYSENTER for 6-argument Linux system calls csu: Implement and use _dl_early_allocate during static startup csu/libc-tls.c | 12 ++- elf/Makefile | 19 +++++ elf/dl-early_allocate.c | 30 +++++++ elf/tst-tls-allocation-failure-static.c | 31 +++++++ scripts/tst-elf-edit.py | 34 ++++++-- sysdeps/generic/ldsodefs.h | 5 ++ sysdeps/unix/sysv/linux/dl-early_allocate.c | 81 +++++++++++++++++++ sysdeps/unix/sysv/linux/i386/Makefile | 2 +- .../sysv/linux/i386/libc-do-syscall-int80.S | 25 ++++++ .../unix/sysv/linux/i386/libc-do-syscall.S | 3 - sysdeps/unix/sysv/linux/i386/startup.h | 17 +--- sysdeps/unix/sysv/linux/i386/sysdep.h | 13 ++- sysdeps/unix/sysv/linux/mmap_call.h | 22 +++++ sysdeps/unix/sysv/linux/mmap_internal.h | 6 +- .../s390/{mmap_internal.h => mmap_call.h} | 14 ++-- sysdeps/unix/sysv/linux/startup.h | 38 +++++++++ 16 files changed, 309 insertions(+), 43 deletions(-) create mode 100644 elf/dl-early_allocate.c create mode 100644 elf/tst-tls-allocation-failure-static.c create mode 100644 sysdeps/unix/sysv/linux/dl-early_allocate.c create mode 100644 sysdeps/unix/sysv/linux/i386/libc-do-syscall-int80.S create mode 100644 sysdeps/unix/sysv/linux/mmap_call.h rename sysdeps/unix/sysv/linux/s390/{mmap_internal.h => mmap_call.h} (78%) create mode 100644 sysdeps/unix/sysv/linux/startup.h base-commit: d056c212130280c0a54d9a4f72170ec621b70ce5 -- 2.35.1