From patchwork Mon Sep 28 18:55:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 144814 X-Patchwork-Delegate: fweimer@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 12EA64BAE7D4 for ; Mon, 28 Sep 2026 18:59:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12EA64BAE7D4 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=UmMrw4vW X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ua2-x24.google.com (mail-ua2-x24.google.com [IPv6:2a00:1450:4864:39::24]) by sourceware.org (Postfix) with ESMTPS id 1F4024BAE7F9 for ; Mon, 28 Sep 2026 18:55:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F4024BAE7F9 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1F4024BAE7F9 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:39::24 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790621751; cv=none; b=TOkJrBQpCEvjIgAzV6UzQsr7iQ7ahNbF4YcYYbPdRdPF2UFmb5mKFK7dzLdUZb7OjWrfQn9eu3jr/Hyb8+SMlKSfB7qZJ+T/Ta56l1jrU6TumniHwFgJzZwe8NTQVJXEaBHa9+UglSMT8ffuvhwRpEAdw7BUXutEhmnBHAQdfYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790621751; c=relaxed/simple; bh=P3q9vO4GhrSgMsj21dN//DXMQuAB+P9xacLlPn5qpJs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=sQOqwvCfinDN+RlOB1Zo96CGMlAeewrbLe8Xw9M/FQvbGorQvzektV27CjKJIHC/xZ+o7yRcPCBC3Fiowal9vO9M8yu2mdpZGWXplur/LA37xXZI3CMe+lpGlQJlBpdvLHQmFvQqnVeI8zq2pDsdBbCoVgjrNC32jFYdQYMbcGE= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=UmMrw4vW DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F4024BAE7F9 Received: by mail-ua2-x24.google.com with SMTP id a1e0cc1a2514c-97e97e2c7d4so1922847241.1 for ; Mon, 28 Sep 2026 11:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1790621750; x=1791226550; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NUJo698mVPKf14LjwON6l2BJjXy5zdVqGQTfIb9m3Cg=; b=UmMrw4vWampfqofxW7M9BrxRvZ8IDo0bZNjGfFkTIcKSasUgPQRVbWmfCiItDketRK I3CFSU8BLEsQRU2+XdJQXIlaPtc6y+Q1KUY5YbRVG27xJvkC3LzPKD3L3jn/KMtvXdOG f3US6Un3C4sIJ115tlXo0fJYuNK8eITz3puSSqoEuaPxppYuQfs/EvtjdiE9L3xxTtBn WYZ7TTmw/crjDamJrf1tcjnHvJRF3LmIDGDb51vF2RIUxFqQIQfRVcW9IeQMIwP0jsoX 1Kkv4vD3aVLk/1cPz452uEoqnySUnCuJ+KmojdH2m/aQO/0u3UlPVVBSDOsfOeWC8YyF Q6Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790621750; x=1791226550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=NUJo698mVPKf14LjwON6l2BJjXy5zdVqGQTfIb9m3Cg=; b=WxE6uOu/Sjv69w6kmCzsXxwHATt7N4M/XLu28O7kQPYM12GDVBraZLdHKkzCA+b74W iyMFdj1hzUA2Dm9PGiVcOmbbiqg/9mJon0tcbvdd+T1w4RJDNYcaTc8xSoqMtwO5Y8RZ am0Ty7dVRgFTIQcffRIu1jApZrEpoNJWIeB5ZeX8JtdtpmL2hQN2wwlwiDyhCkfxvtdM Xn5miE0tyCXFeKh2M4gu+ic+7xtL/9CC77dwmT539o7iqGq/qkXN+JcVHomJzqd2C153 kKYHl1AJI8lbJMCMvwFvvIu9UG5xiyu4jCBCQA6YcIvfqpsBH9dhE60IrRdJp2zFHN6Q JVTA== X-Gm-Message-State: AFq9FYKIYrGqks8QntG2TvEQDMhSCwfS2dWmBjVIJvdyL3toYbb99fT+ 7vOI8PMQcEx2rJnEVtXgf5ocr5KmdDchayT3uS/QarmupYQRnUQ46i4nkel+OcrqCHQS/3ZOMzx baR8W X-Gm-Gg: AYBFou33RKwokW1ol1M+hvnpTBkfAuw7whjZe2D3Lgy3Gq/8w4nd+kTXBLV51Cb35U7 C+yrtFmQqatnc6Sw1ZMIkFPDQlQVo2aUnjOflSXECLLmLmNSmn9DqEG0y0ZDbw0NgULKKQODmGj bJPGGPpJ5vL6DPJc2ag/I9wfDIhbgbyHu+JnJ4kjXRTySN7vv9Yd+dfM0CGnr8dXh1Fa8c6659v Pe1+DDYlG976M6tnxgT5DlghLTNqClXgsB/T5yI6Oh7RBP6ZgQcGjri4ZMrDiUhUQYHkDTUJeH9 hQzsQn3G5XuwehPegI49dwR32f8ORmRXgjTC2abdKJmIVTOWOnxsaEQGnB6BNosCnxFMmpOjoYh 6UEuYKtQvTOjsUkWbpVm7M81ryMx6NRc+GiNw47jITrpxFcrtE5/joiG9YTD91Uz0nAFmMA4vvt tAEx4qxQ6LwdlrpXpg6a1UTY+p281pevkv0KngeoYHQQA3hPHl6Ay3ZoLiHRyRGDtpMalP9RSsf MhFKhx5lFIPJhAu1ILSIhYJkS04DeXrWuREnjs= X-Received: by 2002:a05:6102:2c8d:b0:7a8:2a34:433a with SMTP id ada2fe7eead31-7af1cc9e2b6mr5668996137.9.1790621750260; Mon, 28 Sep 2026 11:55:50 -0700 (PDT) Received: from mandiga ([2804:1b3:a7c1:43a:4422:b237:80b0:bad8]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-988b86d6058sm887554241.0.2026.09.28.11.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2026 11:55:49 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: DJ Delorie Subject: [PATCH 5/8] alpha: Fix the la_pltexit path of _dl_runtime_profile Date: Mon, 28 Sep 2026 15:55:09 -0300 Message-ID: <20260928185535.1353957-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260928185535.1353957-1-adhemerval.zanella@linaro.org> References: <20260928185535.1353957-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org The la_pltexit path of both _dl_runtime_profile_new and _dl_runtime_profile_old had two issues: - The call destination was saved in the new argument frame, which the memcpy of the stack arguments then overwrote. The trampoline jumped to a random address for any frame size larger than 14*8. - The return values were not reloaded from La_alpha_retval after _dl_audit_pltexit. The caller got whatever _dl_audit_pltexit left in the return registers. The tst-audit-plt-flags XFAIL is removed. Checked on alpha-linux-gnu. --- sysdeps/alpha/Makefile | 4 ---- sysdeps/alpha/dl-trampoline.S | 26 ++++++++++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/sysdeps/alpha/Makefile b/sysdeps/alpha/Makefile index ebf6288ccc4..faa59ab27a6 100644 --- a/sysdeps/alpha/Makefile +++ b/sysdeps/alpha/Makefile @@ -69,10 +69,6 @@ CFLAGS-s_isnan.c += -fno-builtin-isnanf test-xfail-test-float32x-float64-div = yes endif -ifeq ($(subdir),elf) -test-xfail-tst-audit-plt-flags = yes -endif - # Build everything with full IEEE math support, and with dynamic rounding; # there are a number of math routines that are defined to work with the # "current" rounding mode, and it's easiest to set this with all of them. diff --git a/sysdeps/alpha/dl-trampoline.S b/sysdeps/alpha/dl-trampoline.S index c69d03c03b8..2602b3d0c58 100644 --- a/sysdeps/alpha/dl-trampoline.S +++ b/sysdeps/alpha/dl-trampoline.S @@ -161,8 +161,9 @@ _dl_runtime_profile_new: bic $18, 15, $18 subq $30, $18, $30 - /* Save the call destination around memcpy. */ - stq $0, 14*8($30) + /* Save the call destination around memcpy, in the fixed frame + since the new argument frame is overwritten by the copy. */ + stq $0, 14*8($15) /* Copy the stack arguments into place. */ lda $16, 0($30) @@ -171,7 +172,7 @@ _dl_runtime_profile_new: ldgp $29, 0($26) /* Reload the argument registers. */ - ldq $27, 14*8($30) + ldq $27, 14*8($15) ldq $16, 2*8($15) ldq $17, 3*8($15) ldq $18, 4*8($15) @@ -199,6 +200,12 @@ _dl_runtime_profile_new: stt $f1, 19*8($15) bsr $26, _dl_audit_pltexit !samegp + /* Reload the return values, which la_pltexit may change. */ + ldq $0, 16*8($15) + ldq $1, 17*8($15) + ldt $f0, 18*8($15) + ldt $f1, 19*8($15) + mov $15, $30 cfi_def_cfa_register (30) ldq $26, 0($30) @@ -494,8 +501,9 @@ _dl_runtime_profile_old: bic $18, 15, $18 subq $30, $18, $30 - /* Save the call destination around memcpy. */ - stq $0, 46*8($30) + /* Save the call destination around memcpy, in the fixed frame + since the new argument frame is overwritten by the copy. */ + stq $0, 46*8($15) /* Copy the stack arguments into place. */ lda $16, 0($30) @@ -504,7 +512,7 @@ _dl_runtime_profile_old: ldgp $29, 0($26) /* Reload the argument registers. */ - ldq $27, 46*8($30) + ldq $27, 46*8($15) ldq $16, 2*8($15) ldq $17, 3*8($15) ldq $18, 4*8($15) @@ -532,6 +540,12 @@ _dl_runtime_profile_old: stt $f1, 49*8($15) bsr $26, _dl_audit_pltexit !samegp + /* Reload the return values, which la_pltexit may change. */ + ldq $0, 46*8($15) + ldq $1, 47*8($15) + ldt $f0, 48*8($15) + ldt $f1, 49*8($15) + mov $15, $30 cfi_def_cfa_register (30) ldq $26, 0($30)