From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2482AC433E0 for ; Thu, 18 Jun 2020 02:13:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBD9E20853 for ; Thu, 18 Jun 2020 02:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592446385; bh=gcYIdJSBndXo8ib41qkOp7IDNKCp6T94n1aw+8dxIIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Q+3OnVcVPgiQP7o5Ye1tt5hpN1+4mrud7JEnD9S4c+giPeodiHHbGYT5YEQ1tyhvA KCltcLbtDva6iqrsE/k8AN7ZHtoDAqvIkHhlDOiWaHaEwBd9HwIvAqSuvyVp8q1QwR p2IczjMWatDqnVsrwKMDvjtAdfc5Gp3hdAliR5s4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387468AbgFRCNC (ORCPT ); Wed, 17 Jun 2020 22:13:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:53562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729411AbgFRBVM (ORCPT ); Wed, 17 Jun 2020 21:21:12 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B7CE20776; Thu, 18 Jun 2020 01:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592443268; bh=gcYIdJSBndXo8ib41qkOp7IDNKCp6T94n1aw+8dxIIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BoN2KpAvGSJw8WGp4UGyp/FvDPvv+Mz30sqwWUlzK+SD0IxpKy4USlWZB0ot6GAy/ l1Cs5ciagwGxP9+pPXQgp83Eo88LYHKgAr5EqKd0cshdiN9ll9ZARvbISRGiaC1V+5 Ra1/JDmeKvf6XgJQU2xbPnu53wQUJPleHu09CzgQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stafford Horne , Sasha Levin , openrisc@lists.librecores.org Subject: [PATCH AUTOSEL 5.4 214/266] openrisc: Fix issue with argument clobbering for clone/fork Date: Wed, 17 Jun 2020 21:15:39 -0400 Message-Id: <20200618011631.604574-214-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618011631.604574-1-sashal@kernel.org> References: <20200618011631.604574-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stafford Horne [ Upstream commit 6bd140e14d9aaa734ec37985b8b20a96c0ece948 ] Working on the OpenRISC glibc port I found that sometimes clone was working strange. That the tls data argument sent in r7 was always wrong. Further investigation revealed that the arguments were getting clobbered in the entry code. This patch removes the code that writes to the argument registers. This was likely due to some old code hanging around. This patch fixes this up for clone and fork. This fork clobber is harmless but also useless so remove. Signed-off-by: Stafford Horne Signed-off-by: Sasha Levin --- arch/openrisc/kernel/entry.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S index e4a78571f883..c6481cfc5220 100644 --- a/arch/openrisc/kernel/entry.S +++ b/arch/openrisc/kernel/entry.S @@ -1166,13 +1166,13 @@ ENTRY(__sys_clone) l.movhi r29,hi(sys_clone) l.ori r29,r29,lo(sys_clone) l.j _fork_save_extra_regs_and_call - l.addi r7,r1,0 + l.nop ENTRY(__sys_fork) l.movhi r29,hi(sys_fork) l.ori r29,r29,lo(sys_fork) l.j _fork_save_extra_regs_and_call - l.addi r3,r1,0 + l.nop ENTRY(sys_rt_sigreturn) l.jal _sys_rt_sigreturn -- 2.25.1