From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id 9A5643858025; Wed, 4 Nov 2020 12:37:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A5643858025 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Szabolcs Nagy To: glibc-cvs@sourceware.org Subject: [glibc/release/2.32/master] aarch64: Fix DT_AARCH64_VARIANT_PCS handling [BZ #26798] X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/release/2.32/master X-Git-Oldrev: 8813b2682e4094e43b0cf1634e99619f1b8b2c62 X-Git-Newrev: 70ee5e8b573f76745760dd6b75f705590fc1923a Message-Id: <20201104123704.9A5643858025@sourceware.org> Date: Wed, 4 Nov 2020 12:37:04 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 12:37:04 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=70ee5e8b573f76745760dd6b75f705590fc1923a commit 70ee5e8b573f76745760dd6b75f705590fc1923a Author: Szabolcs Nagy Date: Thu Oct 22 17:55:01 2020 +0100 aarch64: Fix DT_AARCH64_VARIANT_PCS handling [BZ #26798] The variant PCS support was ineffective because in the common case linkmap->l_mach.plt == 0 but then the symbol table flags were ignored and normal lazy binding was used instead of resolving the relocs early. (This was a misunderstanding about how GOT[1] is setup by the linker.) In practice this mainly affects SVE calls when the vector length is more than 128 bits, then the top bits of the argument registers get clobbered during lazy binding. Fixes bug 26798. (cherry picked from commit 558251bd8785760ad40fcbfeaaee5d27fa5b0fe4) Diff: --- sysdeps/aarch64/dl-machine.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index 70b9ed3925..fde7cfd9e2 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -395,13 +395,6 @@ elf_machine_lazy_rel (struct link_map *map, /* Check for unexpected PLT reloc type. */ if (__builtin_expect (r_type == AARCH64_R(JUMP_SLOT), 1)) { - if (map->l_mach.plt == 0) - { - /* Prelinking. */ - *reloc_addr += l_addr; - return; - } - if (__glibc_unlikely (map->l_info[DT_AARCH64 (VARIANT_PCS)] != NULL)) { /* Check the symbol table for variant PCS symbols. */ @@ -425,7 +418,10 @@ elf_machine_lazy_rel (struct link_map *map, } } - *reloc_addr = map->l_mach.plt; + if (map->l_mach.plt == 0) + *reloc_addr += l_addr; + else + *reloc_addr = map->l_mach.plt; } else if (__builtin_expect (r_type == AARCH64_R(TLSDESC), 1)) {