From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 17F4C3858D1E for ; Mon, 5 Feb 2024 17:13:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17F4C3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 17F4C3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707153233; cv=none; b=SgAWYnurDgLECOjssYyv9Hy46Mewi6PVF3wT888YhRFI8iDWGehTaL+e8exvIVX2TPDafLiXsiAO8pNomII1jBZg+6nGeUUa3wRUmV4raaQSmMUzlyoLyXnBgJ2LgJF0mWobedV9D6dvBZk28HxqPk/JiOTGOrn5lA/e9pT8/x0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707153233; c=relaxed/simple; bh=uTu6mgekbo8ANiqHJdzHQjTKvkVSuRM6lipRU6KaBow=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=JFJ7ihTZ2evU05xvu3nmLxt8N64iMHxFgFxls7/ipKeILXaYe8GncrFJ/SbudMFY0oW4FPvZazxpLKoPRR3GW4t/XLzwcKREA+X7uqDwbf7c6o8Tlhbwlwf9Q6x/b28pdcNlzDgBdFcW1dfZArAJaPQrapqX/Qi6r61xunnbzxU= ARC-Authentication-Results: i=1; server2.sourceware.org References: <20240205161808.1316432-1-adhemerval.zanella@linaro.org> User-agent: mu4e 1.10.8; emacs 30.0.50 From: Sam James To: Adhemerval Zanella Cc: Adrian Ratiu , libc-alpha@sourceware.org Subject: Re: [PATCH] arm: Remove unused ldr _dl_start_user Date: Mon, 05 Feb 2024 17:13:23 +0000 Organization: Gentoo In-reply-to: <20240205161808.1316432-1-adhemerval.zanella@linaro.org> Message-ID: <87bk8ual6f.fsf@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,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 List-Id: Adhemerval Zanella writes: > 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. Tag the bug? Also, I feel like the title perhaps makes the change sound more cosmetic than it is. > > Checked on arm-linux-gnu. > > Reported-by: Adrian Ratiu > --- > 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\