From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by sourceware.org (Postfix) with ESMTPS id C4F523858D3C for ; Thu, 5 May 2022 18:25:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C4F523858D3C Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-e5e433d66dso5032016fac.5 for ; Thu, 05 May 2022 11:25:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=jHMggtCQkCNRsQFse9PtDE/VTKMDkeGHOwDnDONJb/Q=; b=yHT+B8yEZkDsFF6/nUY3EONYtuXM93z0/v6ZWbaicJj/9smexOqMKgi/llIfjQjX51 bwvWct4Udoa79FCqzBBeoBAO5r43wCyE3LZKunA1ZACib7ttL4i1X34FDUGhLP4VV7CE kMRxzBkbTKqUav2ppQfNDwb3qDW9xECRdpsaLR6tXliIYKNrlqLDZ6gMIYafnb12mW7e iyME4Dg2oF0dRWs6GPDqLtr5e2tPKRvo6F2SrIPqAV+LTyvE/NvXrUbsGrRaTQSk/Eng uddNi2fgwEamZmo+fIG+8+HXQ9olfu6O/sTxKiatw5rvQwH4i1HAOIHJlO8SCinKMEK0 rDJA== X-Gm-Message-State: AOAM530rCdAr+Flm/zcV1bZCEloYIElg7U3r77w4JgwmdIxZFYeiRPrA cf7bvlZiDJLDVSJEJ1+L9nDNTa+SSrnAuw== X-Google-Smtp-Source: ABdhPJzNukEeGbC/BaoNFdNlWZvZ3MHZfyWj6DKxxSAtjNOiJn35IZamTUcWbNh8XF1A7XsGzhkpfg== X-Received: by 2002:a05:6870:2189:b0:ed:995f:8f1 with SMTP id l9-20020a056870218900b000ed995f08f1mr2857911oae.33.1651775115056; Thu, 05 May 2022 11:25:15 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:726:f51f:3382:ab1c:b594? ([2804:431:c7cb:726:f51f:3382:ab1c:b594]) by smtp.gmail.com with ESMTPSA id l10-20020a9d4c0a000000b006060322124fsm841431otf.31.2022.05.05.11.25.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 May 2022 11:25:14 -0700 (PDT) Message-ID: Date: Thu, 5 May 2022 15:25:11 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v4 3/3] csu: Implement and use _dl_early_allocate during static startup Content-Language: en-US To: Florian Weimer Cc: libc-alpha@sourceware.org References: <1b8e10100702d11449eb4ec02dbfbaa1db5d4c9f.1651762968.git.fweimer@redhat.com> <87fslnluvq.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87fslnluvq.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Thu, 05 May 2022 18:25:19 -0000 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.