From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 483B538582A4; Tue, 22 Nov 2022 13:46:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 483B538582A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669124805; bh=2Waep+iqv81hA5fvy3V6/6d8nOZWfFmBWmr4XARBMA0=; h=From:To:Subject:Date:From; b=DSeByZvxDaj8EF5o1ZDcCsuJWV3msCUU2kuV/ItfeH6NW8DUqu5VY6SzpYFpBU9m+ l/d36pi/3IcduF0KrWmFDIfhTB8+Co2nDoB0M/u3FHdAaLcU16pXhBCOLd90Y+6o51 1SHPvouPzLimoGBJQC/3jo35fVMQdS6qLrhzB+MU= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/release/2.35/master] elf: Fix rtld-audit trampoline for aarch64 X-Act-Checkin: glibc X-Git-Author: Vladislav Khmelevsky X-Git-Refname: refs/heads/release/2.35/master X-Git-Oldrev: 8263cbfc1155f2ed5ee304bd7ff7fc6ad44c6152 X-Git-Newrev: fb73a409816dbbbe65e0820cdc10e77fdee2b0f6 Message-Id: <20221122134645.483B538582A4@sourceware.org> Date: Tue, 22 Nov 2022 13:46:45 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fb73a409816dbbbe65e0820cdc10e77fdee2b0f6 commit fb73a409816dbbbe65e0820cdc10e77fdee2b0f6 Author: Vladislav Khmelevsky Date: Thu Nov 17 12:47:29 2022 +0400 elf: Fix rtld-audit trampoline for aarch64 This patch fixes two problems with audit: 1. The DL_OFFSET_RV_VPCS offset was mixed up with DL_OFFSET_RG_VPCS, resulting in x2 register value nulling in RG structure. 2. We need to preserve the x8 register before function call, but don't have to save it's new value and restore it before return. Anyway the final restore was using OFFSET_RV instead of OFFSET_RG value which is wrong (althoug doesn't affect anything). Reviewed-by: Adhemerval Zanella (cherry picked from commit eb4181e9f4a512de37dad4ba623c921671584dea) Diff: --- sysdeps/aarch64/dl-trampoline.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index 909b208578..d66f0b9c45 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -298,12 +298,11 @@ _dl_runtime_profile: stp x2, x3, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*1] stp x4, x5, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*2] stp x6, x7, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*3] - str x8, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*4] stp q0, q1, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*0] stp q2, q3, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*1] stp q4, q5, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*2] stp q6, q7, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*3] - str xzr, [X29, #OFFSET_RV + DL_OFFSET_RG_VPCS] + str xzr, [X29, #OFFSET_RV + DL_OFFSET_RV_VPCS] /* Setup call to pltexit */ ldp x0, x1, [x29, #OFFSET_SAVED_CALL_X0] @@ -315,7 +314,6 @@ _dl_runtime_profile: ldp x2, x3, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*1] ldp x4, x5, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*2] ldp x6, x7, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*3] - ldr x8, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*4] ldp q0, q1, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*0] ldp q2, q3, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*1] ldp q4, q5, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*2]