From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) by sourceware.org (Postfix) with ESMTPS id 614B53858412 for ; Thu, 14 Oct 2021 17:16:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 614B53858412 Received: by mail-ua1-x92c.google.com with SMTP id f3so12721869uap.6 for ; Thu, 14 Oct 2021 10:16:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ESGLzLJlXS6zVAwfT71/nrOn34xK775mxHKNB3U9nxU=; b=Q60n9vRKx5t/hfVbWwmp3vta82pOV4HT39Q5UhFQ4qYojW+yoxykx5Rk0FkNHWRyTH ayV2nkOP+KFp6AX8wwKIQmVZ79flb5y5BTnz/ni6cVmbsdyO4EtyrI95bKq1u9z2fBdI LfzhllUp6X5UQMA3TkNlCwap71UMYlYArm6roUm4xG1zydtfMyJKELsouFBNF/yNq5Zm QJoJmW44SWmJ6wA+a7uoGjrNXxRwPvPBgcHltvyh+aO6xy1UC0TgsCEOFfo9Ocv1lrKf ZjSoGMQT5oUi/DB0pgZykW3HjnOoveYO00QxH6NB+DMUoUW0Tn6a4XND3PbjnQNxRvB8 Rynw== X-Gm-Message-State: AOAM533pYxX7B0HPavEIxeyegP5D8c6XVNzXAS0B9UjUNxvzEeRkyiU2 MtUA5sY6g4AdOh9wIOZ9Wzuo0g== X-Google-Smtp-Source: ABdhPJxRbt1zJCGXyeiBekJa791IRobO7buPoqkgr0h/kpHeOVHXyBmBowhC8Xz1Q4a5Wq6ODZgiJg== X-Received: by 2002:ab0:1681:: with SMTP id e1mr7834459uaf.21.1634231806753; Thu, 14 Oct 2021 10:16:46 -0700 (PDT) Received: from ?IPv6:2804:431:c7ca:c6c7:3c65:db0e:6fcc:a8e9? ([2804:431:c7ca:c6c7:3c65:db0e:6fcc:a8e9]) by smtp.gmail.com with ESMTPSA id 104sm1900655uas.5.2021.10.14.10.16.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Oct 2021 10:16:46 -0700 (PDT) Subject: Re: [PATCH] elf: Fix dynamic-link.h usage on rtld.c To: Szabolcs Nagy Cc: libc-alpha@sourceware.org, Manuel Lauss , Florian Weimer References: <20211013192538.4012206-1-adhemerval.zanella@linaro.org> <20211014164236.GC1982710@arm.com> From: Adhemerval Zanella Message-ID: <2191daba-37de-fa8e-7320-9c7589f233d8@linaro.org> Date: Thu, 14 Oct 2021 14:16:44 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211014164236.GC1982710@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.3 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 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, 14 Oct 2021 17:16:49 -0000 On 14/10/2021 13:42, Szabolcs Nagy wrote: > The 10/13/2021 16:25, Adhemerval Zanella wrote: >> The 4af6982e4c fix does not fully handle RTLD_BOOTSTRAP usage on >> rtld.c due two issues: >> >> 1. RTLD_BOOTSTRAP is also used on dl-machine.h on various >> architectures and it changes the semantics of various machine >> relocation functions. >> >> 2. The elf_get_dynamic_info() change was done sideways, previously >> to 490e6c62aa get-dynamic-info.h was included by the first >> dynamic-link.h include *without* RTLD_BOOTSTRAP being defined. >> It means that the code within elf_get_dynamic_info() that uses >> RTLD_BOOTSTRAP is in fact unused. >> >> To fix 1. this patch now includes dynamic-link.h only once with >> RTLD_BOOTSTRAP defined. The ELF_DYNAMIC_RELOCATE call will now have >> the relocation fnctions with the expected semantics for the loader. >> >> And to fix 2. part of 4af6982e4c is reverted (the check argument >> elf_get_dynamic_info() is not required) and the RTLD_BOOTSTRAP >> pieces are removed. >> >> To reorganize the included the static TLS definition is moved to > > typo: includes? Ack. > >> its own header to avoid a circular dependency (it is defined on >> dynamic-link.h and dl-machine.h requires it at same time other >> dynamic-link.h definition requires dl-machine.h defitions). >> >> Also ELF_MACHINE_NO_REL, ELF_MACHINE_NO_RELA, and ELF_MACHINE_PLT_REL >> are moved to its own header. Only ancient ABIs need special values >> (arm, i386, and mips), so a generic one is used as default. >> >> The powerpc Elf64_FuncDesc is also moved to its own header, since >> csu code required its definition (which would require either include >> elf/ folder or add a full path with elf/). >> >> Checked on x86_64, i686, aarch64, armhf, powerpc64, powerpc32, >> and powerpc64le. > > i now reviewed the generic and aarch64 specific changes > and they look good. > > Reviewed-by: Szabolcs Nagy Thank you, I will commit this shortly. > >> --- >> elf/dl-load.c | 2 +- >> elf/dl-reloc-static-pie.c | 2 +- >> elf/dl-static-tls.h | 51 +++++++++++++++++++++ >> elf/dynamic-link.h | 33 +------------ >> elf/get-dynamic-info.h | 25 +++------- >> elf/rtld.c | 23 +++++----- >> elf/setup-vdso.h | 2 +- >> sysdeps/aarch64/dl-machine.h | 8 ++-- >> sysdeps/alpha/dl-machine.h | 6 +-- >> sysdeps/arc/dl-machine.h | 10 ++-- >> sysdeps/arm/dl-machine-rel.h | 31 +++++++++++++ >> sysdeps/arm/dl-machine.h | 11 +---- >> sysdeps/csky/dl-machine.h | 6 +-- >> sysdeps/generic/dl-machine-rel.h | 27 +++++++++++ >> sysdeps/generic/dl-machine.h | 2 + >> sysdeps/hppa/dl-machine.h | 6 +-- >> sysdeps/i386/dl-machine-rel.h | 31 +++++++++++++ >> sysdeps/i386/dl-machine.h | 11 +---- >> sysdeps/ia64/dl-machine.h | 6 +-- >> sysdeps/m68k/dl-machine.h | 6 +-- >> sysdeps/microblaze/dl-machine.h | 6 +-- >> sysdeps/mips/dl-machine-rel.h | 26 +++++++++++ >> sysdeps/mips/dl-machine.h | 6 +-- >> sysdeps/nios2/dl-machine.h | 6 +-- >> sysdeps/powerpc/powerpc32/dl-machine.h | 6 +-- >> sysdeps/powerpc/powerpc64/dl-funcdesc.h | 34 ++++++++++++++ >> sysdeps/powerpc/powerpc64/dl-irel.h | 2 +- >> sysdeps/powerpc/powerpc64/dl-machine.h | 19 ++------ >> sysdeps/riscv/dl-machine.h | 5 +- >> sysdeps/s390/s390-32/dl-machine.h | 6 +-- >> sysdeps/s390/s390-64/dl-machine.h | 6 +-- >> sysdeps/sh/dl-machine.h | 6 +-- >> sysdeps/sparc/sparc32/dl-machine.h | 6 +-- >> sysdeps/sparc/sparc64/dl-machine.h | 6 +-- >> sysdeps/unix/sysv/linux/powerpc/libc-vdso.h | 2 +- >> sysdeps/x86_64/dl-machine.h | 6 +-- >> 36 files changed, 272 insertions(+), 175 deletions(-) >> create mode 100644 elf/dl-static-tls.h >> create mode 100644 sysdeps/arm/dl-machine-rel.h >> create mode 100644 sysdeps/generic/dl-machine-rel.h >> create mode 100644 sysdeps/i386/dl-machine-rel.h >> create mode 100644 sysdeps/mips/dl-machine-rel.h >> create mode 100644 sysdeps/powerpc/powerpc64/dl-funcdesc.h