From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id B01333952491 for ; Fri, 6 May 2022 13:04:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B01333952491 Received: by mail-oi1-x230.google.com with SMTP id r1so7402619oie.4 for ; Fri, 06 May 2022 06:04:36 -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=ynmld5SjbuVilAr0KZMe23ofXPWyaXCC1qgoWrVJQa4=; b=SJT9ZxHode3aAqdeQgGWDJlD97HfThekBENGlnMfwiRbqITnr1/iDKpND2QyARnhXx Lk+Jpo9qfxC/NKTPBAfSroAmEg8vRSn1ANZaX813WrR+7wwhXoqLqKYJCM0VmFfnJGcH bCCm/xj0kFrM+exdydBWkiYYxCSjfmeeMupEwE5gcsyIXXHEnEkRdNztUCr3ZVw7d6+P D+qpR9TDDRI0ZAMlE8JnCbFLjY7ZCmrpY0EmLQ0J8zr3lFAAD7T7WhKmbmr/9Ydafbvc STCu6OGTUyJj7HmQRQqTNG35VuI3W8AZcrKfGaz2F2ZbOZSEg8PUGxqL8IkaAPRnoIif hliQ== X-Gm-Message-State: AOAM531auqVC7GuaaDKtYOIg+uhHI6SRlKQcDV0EV7KhlCbKJfMHhyph sadHukLfs8DgEmiCUdxBd0j0MxAeuXWtsg== X-Google-Smtp-Source: ABdhPJzUqTY3TpHOFn1KuV9bUnLeyq/3HUFhMiEc6iRfym/hNdUlqZbZrlannrjR/gHSYgAxpZR5MQ== X-Received: by 2002:a05:6808:148f:b0:326:497a:99c6 with SMTP id e15-20020a056808148f00b00326497a99c6mr4670369oiw.101.1651842275985; Fri, 06 May 2022 06:04:35 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:726:53f7:4ba7:4810:79df? ([2804:431:c7cb:726:53f7:4ba7:4810:79df]) by smtp.gmail.com with ESMTPSA id s2-20020a9d58c2000000b006060322125esm1602491oth.46.2022.05.06.06.04.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 May 2022 06:04:35 -0700 (PDT) Message-ID: <2aa1ffb1-1c8b-c8b8-2a40-1386581f5391@linaro.org> Date: Fri, 6 May 2022 10:04:32 -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> <87mtfvj7z8.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87mtfvj7z8.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: Fri, 06 May 2022 13:04:39 -0000 On 06/05/2022 07:00, Florian Weimer wrote: > * 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. But for !SHARED we do call _dl_aux_init before ARCH_SETUP_TLS, so we can access GRLO(dl_pagesize). > How can we move this forward? I am still not very found of bleeding misc/sbrk.c details to Linux dl-early_allocate.c, but this is not a blocker for the patch.