From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by sourceware.org (Postfix) with ESMTPS id BEAD43858C83 for ; Sat, 22 Apr 2023 17:04:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BEAD43858C83 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-18777914805so16663627fac.1 for ; Sat, 22 Apr 2023 10:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682183065; x=1684775065; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RYT5WOnY/pXJQSIhQOhlcTNS4ZT22gcB6/BtV/DGDfI=; b=gFpEwSWjNWBZPhoTvkCO6fD8qZVkXH1u3H1sFcCqZHXGCYDH4xzT+6U8n4/uTdEAVr IaW3FE7EfXdUhjGvZqzgBGLEew/mfLFrTa2dQcRaggyxZGEFnacrMXcFcrBX667JTjHi wWDnqbLUUSGYLMpAiSsHCa1WlcJM5wBKkel0WeUynmawD6NZMcbgo+gygBmYi0ynLcps Sq6e+Zo7fHysLcL+Vzz3BHcTyS78yQRlf9qEBaKz7NtPuboarQFnKjv836IEZNKjf7lW 2nemZ7I/K4uwPfoUF6w1twsmCkf3Nf8JTCTX1duPfrKfILuCUlOPx8aj6OB5KZ5SDX8j vvkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682183065; x=1684775065; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RYT5WOnY/pXJQSIhQOhlcTNS4ZT22gcB6/BtV/DGDfI=; b=ChM6BsKWXbsXaLBlnUYI74r5eoQ4tnyUqPG5Sy9N/q3VqnkaT03XPVYBQTavJh/HAb vZUMJG+iv6Lv9bd7CoUhUWaFdS8G/0y6XzHbrXkMIEw3kIeHLB2ptaYwgpFIuBHjphot 1gSB/v43Pbfg+8txu9HXxdQn4d1OGmy/0JxqeHcCL9auxNVp4zL1dfNoOew38TXocBzZ QDrolyeSUz04tg4ahCt+q4llwyw/7771i8rW3I84MYkZV6/ta7lLVkweqULwcx+84UKN NBS10F55995g7A7jv04sMZ4DV3/+Fo2UM4Q8L7Qw7TrpvA6qe+OygikTtX+xQKdg9Ead ZMuA== X-Gm-Message-State: AAQBX9e6CZyN5WdTwY0/mEEhG7lVKE9OrH2Q0+0mQeGLWPOqwHezlUQm 55eWpsg1Hu/Znh3ZPLdItA6uNaJXNo+h4lBt9u0= X-Google-Smtp-Source: AKy350ZboBMSPAxqjyA+pB6ZknclwkZLIckmkJctvibs0e9w/3WTvOnM+KNRwe+UHbs7n5f0yesQHBVztW+q+gd3FEw= X-Received: by 2002:a05:6870:4723:b0:187:f933:d308 with SMTP id b35-20020a056870472300b00187f933d308mr6299067oaq.25.1682183065001; Sat, 22 Apr 2023 10:04:25 -0700 (PDT) MIME-Version: 1.0 References: <20230420184220.300862-2-bugaevc@gmail.com> <167de8d8-2598-fc32-c26c-749318d9451b@linaro.org> <8408f776-6e4f-9f3b-cf75-80853d83bec7@linaro.org> <20230422115921.24upng76tpj2ymb3@begin> <20230422162036.wfsocspdiviiq2fe@begin> In-Reply-To: <20230422162036.wfsocspdiviiq2fe@begin> From: Sergey Bugaev Date: Sat, 22 Apr 2023 20:04:13 +0300 Message-ID: Subject: Re: [VERY RFC PATCH 2/2] hurd: Make it possible to call memcpy very early To: Samuel Thibault Cc: Adhemerval Zanella Netto , "H.J. Lu" , libc-alpha@sourceware.org, bug-hurd@gnu.org, Luca Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Apr 22, 2023 at 7:20=E2=80=AFPM Samuel Thibault wrote: > But what about the memcpy calls from the RPC stubs used by the init > code? Ah, I see that we do actually call more than I thought before _start1. In particular, we initialize the dtable (so the ctty stuff...) and get our pid/pgrp from the proc server. We should probably do this later, at time __libc_init_first probably. We want to do as little as possible before _start1; we must get our argv and env, so that must happen before _start1, and to do that we need to set up __init_tcbhead, but the rest we can do later. Guess I still like my GOT prefilling approach better then. It's not that big of a hack, it's just two lines of assembly (we can drop stpcpy, it's not used during early startup) and it makes memcpy just work from anywhere (any RPCs, any other code) without any additional trickery at use sites or in the build system. And all the same code gets automatically upgraded to the better memcpy when it's available. We know it works in practice and doesn't prevent ifunc selectors from doing their thing later. What's not to like? Sergey