From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [170.10.129.74]) by sourceware.org (Postfix) with ESMTPS id ABCFF3948A53 for ; Fri, 6 May 2022 10:01:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ABCFF3948A53 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-211-CcoEL2L7P8mWzqvrChYXCA-1; Fri, 06 May 2022 06:01:03 -0400 X-MC-Unique: CcoEL2L7P8mWzqvrChYXCA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E356880418C; Fri, 6 May 2022 10:01:02 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 168DBC28119; Fri, 6 May 2022 10:01:01 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v4 3/3] csu: Implement and use _dl_early_allocate during static startup References: <1b8e10100702d11449eb4ec02dbfbaa1db5d4c9f.1651762968.git.fweimer@redhat.com> <87fslnluvq.fsf@oldenburg.str.redhat.com> Date: Fri, 06 May 2022 12:00:59 +0200 In-Reply-To: (Adhemerval Zanella's message of "Thu, 5 May 2022 15:25:11 -0300") Message-ID: <87mtfvj7z8.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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: Fri, 06 May 2022 10:01:07 -0000 * Adhemerval Zanella: > On 05/05/2022 15:03, Florian Weimer wrote: >> * Adhemerval Zanella: >> >>> I still think there will be way simpler to just use mmap here, it will allow >>> to use a generic version without the need to fiddle with a Linux specific >>> (it will be required just a wrapper to MMAP_CALL_INTERNAL, instead of an >>> implementation that need to know both sbrk and mmap internals). >> >> We need to wrap the difference in error checking as well. >> >>> I think you even clean up all the dl-brk.c and similar files required to >>> make brk/sbrk work on the loader with an allocator that only uses mmap. >> >> At the cost of additional VMAs, sure. We won't be able to reuse the >> unused tail of the allocation easily because we do not know the page >> size yet. __minimal_malloc does not yet work at this point. We also >> lose some ASLR. I'm not convinced it's worth it. > > It is another code that does something similar to __minimal_malloc to > a specific usage, so now we have another allocation scheme that is used > solely for static initialization. And it does something different than > __minimal_malloc, so has different semantic. > > I am not really against it, but initialization code is already > quite complex with a lot of different paths for dynamic/static case, > so I think it would be good to have single loader/static allocation > code. As I said, we don't have the page size yet at this point, and __minimal_malloc needs to know that. And there are likely other obstacles to consolidation. How can we move this forward? Thanks, Florian