Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3950723pxb; Tue, 2 Mar 2021 02:50:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxwEjtddRnfhwyiZCA/kVfX8SS2408EXo8QUOFjsOKGDB6cl5JHrJry/Kvu2QxrL2WaQm5 X-Received: by 2002:a17:906:2bd6:: with SMTP id n22mr20035147ejg.91.1614682241061; Tue, 02 Mar 2021 02:50:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614682241; cv=none; d=google.com; s=arc-20160816; b=i2XN4sJAlnLG26Yntn5OFUZFZnfKbd8PmlrOFC/IbrI07Id6vAkY8E0cAB/z3sSPyx ojmiqNZbj6mt5HBzHPnEnJaDgSEkKq8YkZqZF/jiMoRsKj/w8rr3OfutqxVWTyToA/uS MPfNuitD6bUfjjIE0YL5LNp43U6xIH5LEjUntSdz/6IRz5Ue/r9n3k9ElcqzTUhVM/Aj MSGNXsdRfP/gwZYWTO/B88kt66nm1cCWoNBS8jl7LRtzV45dV3V4yinkPI9zRbPUFMxP QC1oRs7Yp8OGzrGqpaxPKE9UiA19DN0IxhDoTAZ662ayCLykOT4NgwRB4XMUFgoEFFht WioA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fF+WN2OcsCsAz+OkMbq1k45LdU6ERAYRWuwzCMLQOt0=; b=moJ3fxxlPFOQtpfjv6mBJt9U3uyPZp1Qnqia2ZFdcjFWh8FfuiCirKivWbdhrVnEDs g0gX3qE0nDIrc/RCb7VfhuTk84ODiwZ0FAAZvx2d2svdpOadpMw0ADULGYSgFg0Ww/vv jvymEdSLsNwAo20b1dkpIfFEDJX+quBksv5Aor2aEHgVec1fj1z0QJ4wpf5J6o7T/TL7 +xK9yaAJ+r1xg1H4TRFSZAXzrpPKXdGluyOdrL3FvNtPMfqqEmqZG+ssXtDxYAprzGwU 7DTCtQ0JO2pKpAT+RInCLfgbyOJ5ymcApCBZ9lyT9r3iplAlwYBclJrAEx7aLioRW7yd zbsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G7UOk467; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si899696edr.381.2021.03.02.02.50.17; Tue, 02 Mar 2021 02:50:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G7UOk467; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380117AbhCBBs0 (ORCPT + 99 others); Mon, 1 Mar 2021 20:48:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:46150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241553AbhCATYE (ORCPT ); Mon, 1 Mar 2021 14:24:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F14D26521E; Mon, 1 Mar 2021 17:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614619396; bh=dfiwfjdih95kPmNueKLfJksMl9tfBhr/oXqsr+opQjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G7UOk467exbUHH83sLFxcuqIcKKQ/obtXExXjQmxaXNtTlFUbWcbKRPx1ozXpKes3 J5YiABYUWdL+jqs1gNO5XvMpuik3fTxJFNRV/CO/S/dZkHaa04V6dQ96qxRAvmcuOX 9CUtNfIr7fF/pl/jgE/emCDUOOiRj8GH1NRFHj38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Oetken , Ley Foon Tan , Christian Brauner , Sasha Levin Subject: [PATCH 5.10 440/663] nios2: fixed broken sys_clone syscall Date: Mon, 1 Mar 2021 17:11:28 +0100 Message-Id: <20210301161203.666460554@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andreas Oetken [ Upstream commit 9abcfcb20320e8f693e89d86573b58e6289931cb ] The tls pointer must be pushed on the stack prior to calling nios2_clone as it is the 5th function argument. Prior handling of the tls pointer was done inside former called function copy_thread_tls using the r8 register from the current_pt_regs directly. This was a bad design and resulted in the current bug introduced in 04bd52fb. Fixes: 04bd52fb ("nios2: enable HAVE_COPY_THREAD_TLS, switch to kernel_clone_args") Signed-off-by: Andreas Oetken Signed-off-by: Ley Foon Tan Acked-by: Christian Brauner Signed-off-by: Sasha Levin --- arch/nios2/kernel/entry.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S index da8442450e460..0794cd7803dfe 100644 --- a/arch/nios2/kernel/entry.S +++ b/arch/nios2/kernel/entry.S @@ -389,7 +389,10 @@ ENTRY(ret_from_interrupt) */ ENTRY(sys_clone) SAVE_SWITCH_STACK + subi sp, sp, 4 /* make space for tls pointer */ + stw r8, 0(sp) /* pass tls pointer (r8) via stack (5th argument) */ call nios2_clone + addi sp, sp, 4 RESTORE_SWITCH_STACK ret -- 2.27.0