From patchwork Mon Feb 5 16:18:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1895304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=uBkz1ReW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTBQ11x2Jz23g7 for ; Tue, 6 Feb 2024 03:18:33 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1981238582BA for ; Mon, 5 Feb 2024 16:18:31 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by sourceware.org (Postfix) with ESMTPS id 8658F3858D1E for ; Mon, 5 Feb 2024 16:18:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8658F3858D1E 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 8658F3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707149897; cv=none; b=S+kI3C6/Bpxop4IXQTTjvXyzKrVitZ9aiHDypltn1+fJF1DW0BCbMAe4ZA866lXM7z2VOoD+HuvisgMC6Ia5ed7h6uvcoNRDT8wORfWVj0EWY1gasByORQpV01zp8/iWETeQ9WmxPQrpEG8KglzYgxuZ2hV8YcxCNhAHLpoDslU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707149897; c=relaxed/simple; bh=TSwbvE8RT3C4FHQBy301QNKTaxmmP5i64omNlqWPoSI=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=OdQogvTg9dAfYYRDcLyRYuquQsvyc73EKF5NsXJVBLTa2yr5KL5DHMqaV+tYeIAGDNayTLJVDrB8oa/58kPxC27vTjZD808FQGmk1Gnn5F4mFw5Gs+c9e1E31lCovU5kVp3h+/+LhdHVn44edB9ZzNDIqja1U8A3OIjbVf9dkaQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-216f774c827so2309439fac.2 for ; Mon, 05 Feb 2024 08:18:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707149894; x=1707754694; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IQ/5YsKKfFlnDpuHeKXdepg3qe1+ZnYx5wYTnT8ZAB4=; b=uBkz1ReWRWW7QEIoAASGm3WEC58WLsfQPS7GWcEsBdVS2BQOnFewpglFnl3L133o33 esYQWIt40h8UARU+2QzcKzeHTnZ9v20MWZg94oBxUmLTrW2tkBmJP+7eWdmaIM+KGfAd uGoiS33u5vprdkYLLmbzfqc3N13cziDslNYeGBRcRsgRpU0Zfe7+Pdb7SJMSxXfiQWvy MUojNYtN2eUv+jxYdfdX3X+/wvkYYGKxGN+osHsJcdh4Y4BzwM7l8YtPAWkpEPScJpKF nzgcJT+HzuZEDHJph7w7hUa6eKwvqb2rO8wuDPqiAw43MXVmFJPK6eAbV5SutMFgRPIl TgxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707149894; x=1707754694; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IQ/5YsKKfFlnDpuHeKXdepg3qe1+ZnYx5wYTnT8ZAB4=; b=F6xayID50J6OSL0aokhUlfgjk1u3BkVkhs4aS2U1kZf8bGV2qrtC9Oskym16iuEVd5 rgS0C0xHmfaeej/AwpTs18TiZEEiv3F2Kj4+FIw9RaAlPh/fhX4PJILIoIYlKLlEO27G w3pcR7NSM9RqRooyipfVnp9S0rS0qWwquDnOoXwzVsRUMeRgAVx4AflXGFvYczIJDEEo NeT3P71TLeCgJPZ3WMiyEEC9TFZvG8EF1CKMN+LYkzJ0vu9ljyPBlxR+PKQ1EnyB/tzh XAWOAbv0A2G7qtWoVQpbcqccCZdsm8b3Jg4+OBuPui/ECtvVxj4uZUlw//qiPi/2dwRf 9XTg== X-Gm-Message-State: AOJu0Yw5P4gTbRHWTUo6Y7KyivBuuTgljwu6h1PjQpAYNB1Pt0VJ+XOa g71OQB8nGtO9ZS+Hrx3gtjgnnGFyeKOolJSpyEzIC9lbQYHTumJuPFET1NyV6BJCLLQpIC4e92M f X-Google-Smtp-Source: AGHT+IFUZNkzyEW4o6oKhSy+lrN37kQ3telNKnfYwOXkYeGqEwEf4f1ToA9MBU3KSgQFG81Y7GtIrA== X-Received: by 2002:a05:6870:420c:b0:219:432b:abca with SMTP id u12-20020a056870420c00b00219432babcamr147819oac.53.1707149893730; Mon, 05 Feb 2024 08:18:13 -0800 (PST) Received: from localhost.localdomain ([139.178.84.207]) by smtp.gmail.com with ESMTPSA id ti11-20020a056871890b00b00214d2727a8asm42969oab.25.2024.02.05.08.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 08:18:11 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Adrian Ratiu Subject: [PATCH] arm: Remove unused ldr _dl_start_user Date: Mon, 5 Feb 2024 16:18:08 +0000 Message-Id: <20240205161808.1316432-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.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+incoming=patchwork.ozlabs.org@sourceware.org The commit 49d877a80b29d3002887b084eec6676d9f5fec18 (arm: Remove _dl_skip_args usage) removed the _SKIP_ARGS literal, which was previously loader to r4 on loader _start. However, the cleanup did not remove the following 'ldr r4, [sl, r4]' on _dl_start_user, used to check to skip the arguments after ld self-relocations. In my testing, the kernel initially set r4 to 0, which makes the ldr instruction just read the _GLOBAL_OFFSET_TABLE_. However, since r4 is a caller-saved register; a different runtime might not zero initialize it and thus trigger an invalid memory access. Checked on arm-linux-gnu. Reported-by: Adrian Ratiu Reviewed-by: Szabolcs Nagy --- sysdeps/arm/dl-machine.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index b857bbc868..dd1a0f6b6e 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -139,7 +139,6 @@ _start:\n\ _dl_start_user:\n\ adr r6, .L_GET_GOT\n\ add sl, sl, r6\n\ - ldr r4, [sl, r4]\n\ @ save the entry point in another register\n\ mov r6, r0\n\ @ get the original arg count\n\