From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by sourceware.org (Postfix) with ESMTPS id 196893858D39 for ; Tue, 11 Jan 2022 18:12:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 196893858D39 Received: by mail-qt1-x82f.google.com with SMTP id b11so113289qtk.12 for ; Tue, 11 Jan 2022 10:12:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=A3ccOncj0LkUxQWTTCVaoUwVCuMyjtv3/T2x9xfZ+CY=; b=kOPD7paXY7qVCFQn+1HMSooPmH5tuKFylNAczTkHixwTrL73Z/g2iyCd8SxW3GyarE vyPr82PD3tM+AmlnkjFAKJ30owbK7YOmaDcx0Rs8GgS47yvTZPykMWBFtbHJbhD9/3Ae OFMofK3fU9cJ3iLZtM9juxN8d5su6foBQdTWWWppA/dVleCoylKEJZyOH1sGljt1Zgt/ eBRr0qT73GxDCb4TAaCT+u4fHABIGdkYojD0ppRTl5pg32DAtHRxIv9s3hf+hc0foDEo 47QyePSgu2yynDycSFvIhZF8rA43nwqHMC59K1GZA8ga3sxeVTXifKSZ3Pku5TRucR9R kT8w== X-Gm-Message-State: AOAM531F1MyfVmrmcaGbPpkvHx9Va76ZPOL8F5DR1PkWRK9QaESx60E/ X31/LNKRo50hzfAgG/kl8hD1Kw== X-Google-Smtp-Source: ABdhPJy5Q03b3ZsHjEnPg0zKzIU7DkdJNweSH6+3+bBb/YHkoPSoi8nLbawdizIlIkXWO12+zHiAgQ== X-Received: by 2002:a05:622a:548:: with SMTP id m8mr4793702qtx.126.1641924727217; Tue, 11 Jan 2022 10:12:07 -0800 (PST) Received: from ?IPV6:2804:431:c7ca:9d3:6f7c:f45d:859d:a30d? ([2804:431:c7ca:9d3:6f7c:f45d:859d:a30d]) by smtp.gmail.com with ESMTPSA id u28sm6883473qke.12.2022.01.11.10.12.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jan 2022 10:12:06 -0800 (PST) Message-ID: Date: Tue, 11 Jan 2022 15:12:04 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v9 4/4] elf: Fix runtime linker auditing on aarch64 (BZ #26643) Content-Language: en-US To: Szabolcs Nagy Cc: libc-alpha@sourceware.org, jma14 , John Mellor-Crummey References: <20220103132530.1149542-1-adhemerval.zanella@linaro.org> <20220103132530.1149542-5-adhemerval.zanella@linaro.org> <20220111111645.GX3294453@arm.com> <5de33ad5-d86a-3370-4a24-fbb3d6a4ac42@linaro.org> <20220111170944.GZ3294453@arm.com> From: Adhemerval Zanella In-Reply-To: <20220111170944.GZ3294453@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jan 2022 18:12:10 -0000 On 11/01/2022 14:09, Szabolcs Nagy wrote: > The 01/11/2022 13:49, Adhemerval Zanella wrote: >> On 11/01/2022 08:16, Szabolcs Nagy wrote: >>> The 01/03/2022 10:25, Adhemerval Zanella via Libc-alpha wrote: >>>> @@ -142,13 +143,17 @@ _dl_runtime_profile: >>>> Stack frame layout: >>>> [sp, #...] lr >>>> [sp, #...] &PLTGOT[n] >>>> - [sp, #96] La_aarch64_regs >>>> - [sp, #48] La_aarch64_retval >>>> - [sp, #40] frame size return from pltenter >>>> - [sp, #32] dl_profile_call saved x1 >>>> - [sp, #24] dl_profile_call saved x0 >>>> - [sp, #16] t1 >>>> - [sp, #0] x29, lr <- x29 >>>> + ----------------------- >>>> + [sp, #384] La_aarch64_regs::lr_xreg (x0-x8) >>>> + [sp, #256] La_aarch64_regs::lr_vreg (q0-q7) >>>> + [sp, #240] La_aarch64_regs::sp and La_aarch64_regs::lr >>>> + [sp, #176] La_aarch64_retval::lrv_xreg (x0-x7) >>>> + [sp, # 48] La_aarch64_retval::lrv_vreg (q0-q7) >>>> + [sp, # 40] frame size return from pltenter >>>> + [sp, # 32] dl_profile_call saved x1 >>>> + [sp, # 24] dl_profile_call saved x0 >>>> + [sp, # 16] t1 >>>> + [sp, # 0] x29, lr <- x29 >>>> */ >>> >>> the layout in the comment looks backwards. >> >> It follows the convention of the about layout: >> >> /* AArch64 we get called with: >> ip0 &PLTGOT[2] >> ip1 temp(dl resolver entry point) >> [sp, #8] lr >> [sp, #0] &PLTGOT[n] >> [...] >> > > i mean the order of the fields is wrong. > > lr_xreg has larger address than lr_vreg > but in the struct it is the opposite. > > i think you need to reorder the fields. > (but we don't have to document the exact offsets > here, so a simplified comment is fine too) Indeed, it should be: [sp, #384] La_aarch64_regs::lr_xreg (q0-q7) [sp, #256] La_aarch64_regs::lr_vreg (x0-x8) [sp, #240] La_aarch64_regs::sp and La_aarch64_regs::lr [sp, #176] La_aarch64_retval::lrv_xreg (q0-q7) [sp, #48] La_aarch64_retval::lrv_vreg (x0-x7) [sp, #40] frame size return from pltenter [sp, #32] dl_profile_call saved x1 [sp, #24] dl_profile_call saved x0 [sp, #16] t1 [sp, #0] x29, lr <- x29 I have fixed it.