From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward107o.mail.yandex.net (forward107o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::205]) by sourceware.org (Postfix) with ESMTPS id 19AC03955627 for ; Thu, 17 Nov 2022 08:48:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 19AC03955627 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru Received: from forward102q.mail.yandex.net (forward102q.mail.yandex.net [IPv6:2a02:6b8:c0e:1ba:0:640:516:4e7d]) by forward107o.mail.yandex.net (Yandex) with ESMTP id DF3276AFB4A3; Thu, 17 Nov 2022 11:48:12 +0300 (MSK) Received: from vla3-3dd1bd6927b2.qloud-c.yandex.net (vla3-3dd1bd6927b2.qloud-c.yandex.net [IPv6:2a02:6b8:c15:350f:0:640:3dd1:bd69]) by forward102q.mail.yandex.net (Yandex) with ESMTP id DCEC6BF00007; Thu, 17 Nov 2022 11:48:12 +0300 (MSK) Received: by vla3-3dd1bd6927b2.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id Ax2eCZN1LP-mAVewYLh; Thu, 17 Nov 2022 11:48:12 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1668674892; bh=tz+xX/ZfMOLaTGA6ugHNourG3vMt1deU/6b1NWS58x4=; h=Message-Id:Date:Cc:Subject:To:From; b=nG6tkQMU1S7LAFBlA0HaugJStfqEffzGi4hQyj7euOcBom7QgCoKkFtBbpNjababE h5RbJZb7lpvYyOoirQFEf71RBE9/EZMIoN1T2lIckG+85hjr2SCHtTCjUA41TOe/a5 e7heeayiA+PjnOG+M9gjoIktub4UhUsKoLhqXzqY= Authentication-Results: vla3-3dd1bd6927b2.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru From: Vladislav Khmelevsky To: libc-alpha@sourceware.org Cc: woodard@redhat.com, adhemerval.zanella@linaro.org, Vladislav Khmelevsky Subject: [PATCH] elf: Fix rtld-audit trampoline for aarch64 Date: Thu, 17 Nov 2022 12:47:29 +0400 Message-Id: <20221117084729.2794073-1-och95@yandex.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,KAM_NUMSUBJECT,SPF_HELO_NONE,SPF_PASS,TXREP 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: 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). --- 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] -- 2.25.1