From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id 0A225385457E for ; Thu, 17 Nov 2022 18:37:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A225385457E 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-x22e.google.com with SMTP id h132so2841723oif.2 for ; Thu, 17 Nov 2022 10:37:00 -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=E7DdwtEWeAPxnzJGAtG7d0xnPYmWScaJT9KNj9/rbQQ=; b=Zy0eDxUQKWGNRknMU9JPCp2VnBEsy7BMULSB2s/EycEdkO6JLFROyZeIanE+COy3UT ZS3vut9qGdfTMIYnMr2ddvvAjWIcttyieLVP129PfrflZoIhwlsawgUEejCmJRpY7V8O WcQpEYLnfsqRLJGBo5S5tpaJ+hggmbKQU8N8RNbubLZF5Gpcog0bMgpu4IVNLjzfbMKv QaHRQD9J+HtHNNsYuV5CC1M2ftz/BEc4vZg/hDw1LnPvmH/Jllu2YF6epEm32gw91SIe mZ3tnPxLmefqtH7dBsl10RfrdUfHyl/es6e9o8XqUBW1fmCZFMdU1owzm/OG8urj2luh 0mkw== 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=E7DdwtEWeAPxnzJGAtG7d0xnPYmWScaJT9KNj9/rbQQ=; b=lYmSBMi9xAQ+2jHBruEH433hhJRWagFDAkSHC3j09B9h8wTN/N/gEaJLvfgeFjN7o1 JzY1KYzMXIkdLRJ3AojsPmiYu4sk5QpvWSqsTuLWerd2cMgDcNFXgmqSUPs5fajS6p/H kglAenzpkDkO2g7nNOo5die4zKUebGvKdUW+pwHO1jJjsK/2b8HQ87y+RZDb+mPOKZyN KtV6ct22r2hQLkl36bT3yIrNsLQI8JryEK1X/76mhE0DPodiqFqspU/9W8+BYXuverUm F6k7EcMfz1mhUddqzGpnGpWQutA4eZzxOYIge3/f7twBOfX0g9l0GLeqYF/MhJdEqCl4 U6rQ== X-Gm-Message-State: ANoB5pnPr5YAYDuLAh10IwrkrcGJmch9n2LehoswdmQBoJhOOOqPiiFh cRd8Z2G4DkZyLn7ZNdKl6/KE7v8fDSj73zvl X-Google-Smtp-Source: AA0mqf40j9dKt72ScdGsTqlPcsvx1pJZoHFqb8rp7j1FoOiNDPqT1QFrgFwPcZacPR6haWMr6PlHCw== X-Received: by 2002:aca:670b:0:b0:35a:c694:c22e with SMTP id z11-20020aca670b000000b0035ac694c22emr4509131oix.298.1668710219168; Thu, 17 Nov 2022 10:36:59 -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 f6-20020a056830056600b0066c73061d4bsm627506otc.54.2022.11.17.10.36.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 10:36:58 -0800 (PST) Message-ID: <3180cd8a-a3e2-b6bb-cb6a-af7c2a4fca22@linaro.org> Date: Thu, 17 Nov 2022 15:36:56 -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 Cc: libc-alpha@sourceware.org, woodard@redhat.com References: <20221117084729.2794073-1-och95@yandex.ru> <8c6d9a21-464b-3b8d-661a-a3b3733e1bb7@linaro.org> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,BODY_8BITS,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 15:23, Vladislav Khmelevsky wrote: > Thank you for reviewing! > Yes, it is true tat inly x0/x1 are used as return register. But I have a specific audit library code that was storing some metadata in a free registers during plt entrer and reading it during plt exit :) As for a normal use cases both problems doesn't really affect anything. > Fair enough, although we might want to backport this. Reviewed-by: Adhemerval Zanella >> 17 нояб. 2022 г., в 22:15, Adhemerval Zanella Netto написал(а): >> >> >> >> 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] >