From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id CB309385456F for ; Thu, 17 Nov 2022 18:15:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CB309385456F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x22a.google.com with SMTP id e205so2729597oif.11 for ; Thu, 17 Nov 2022 10:15:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=5uCEwdZC6jD97AwmO+9fB+WJ8nQyQ/Cs0lfKkBAl3mM=; b=HU5CIEsb8hrq+HRXovpQo7r75/q190iJHNE6GjEIYgFLivnkMHqCye4zcUaSGi6z+f VzK9BqC+Do3dAsH03phwcMibcJTpd2wBZcncm0+dllE4WUIgrQXemgeAX4PpfnZWCJrq heoTnaFWKLLuwlkjHZXI6UP3XhubmmqNzO0YKPrmMW+QKy7Bpe67tCOv9pIoA9HSXUH0 16Ohiv6DuhWfowUTdaXB8It2snjfqjMpWW6oDWp6fD+kXrAdeBjmiGnXzJtpg1t/LKAB 6mTKIPDqHNxV7Nrw149wkbZR3fMR2TX7zMY3MDfWtDMmf5VSqymvZS1AxZHPY3+XFnZ/ PU7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5uCEwdZC6jD97AwmO+9fB+WJ8nQyQ/Cs0lfKkBAl3mM=; b=i8pCw+lLSR8WECzqL6VvIOZ6y4k4jZRd5xhbmgSXiEZWn+ogMW5J7uvs+weu7qz2Rt Ae6M8mKzH5HuC5mu8L9ifpWjEWczXB6b5lMkguM7OaPeBsXSADnS9c+VL9AccI4Ma95Y 98hRvxQ4WIY5r9EqfNYnPmT9+hcsNTEkggyi7V8in1FO9v+xpMaYM7BhSEh23xgUHGRu /NgvOuXnd30IOEtIzJhhW64Cq5Pzew9ZThaM0k7PaSNYqpgLgDtoCp83E5xRm0leqDT7 mnOYMJ3imB7Bah5+ag5cdDG29NPMQcskql9trKX6I/xPRSAKleOTtHjofAXD4NC8y40Z zFZA== X-Gm-Message-State: ANoB5pkDiNLdB1jhHsP0m9FIpRz6RBEDRT0XeaZ8P+En94dDZqQEIp7d 70wzuEZX/yVXPUIMG/FHHe8VittbawnoFJo3 X-Google-Smtp-Source: AA0mqf5NOYoiPKcZjwyuUsv56hR/lhXhBGz9OJZfHNBCtm04NQXDpIM70m5S0KP+wu0gcRHiIu44yw== X-Received: by 2002:a05:6808:490:b0:359:5496:f60e with SMTP id z16-20020a056808049000b003595496f60emr4698110oid.119.1668708956588; Thu, 17 Nov 2022 10:15:56 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c1:84f3:2833:5b94:1e27:c35b? ([2804:1b3:a7c1:84f3:2833:5b94:1e27:c35b]) by smtp.gmail.com with ESMTPSA id bc6-20020a056820168600b0049be9c3c15dsm571736oob.33.2022.11.17.10.15.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 10:15:56 -0800 (PST) Message-ID: <8c6d9a21-464b-3b8d-661a-a3b3733e1bb7@linaro.org> Date: Thu, 17 Nov 2022 15:15:53 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] elf: Fix rtld-audit trampoline for aarch64 Content-Language: en-US To: Vladislav Khmelevsky , libc-alpha@sourceware.org Cc: woodard@redhat.com References: <20221117084729.2794073-1-och95@yandex.ru> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <20221117084729.2794073-1-och95@yandex.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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: On 17/11/22 05:47, Vladislav Khmelevsky wrote: > 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). Patch looks ok, although I think currently the ABI only uses x0 and/or x1 to return value (for __int128_t for instance). So I think it should not be a user-visible issue (at least tst-audit26 does check that lr_vpcs and lrv_vpcs are zeroed). Are you seeing any issue with current code? If so could you open a bug please? > --- > 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]