Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp47580imu; Thu, 8 Nov 2018 14:31:51 -0800 (PST) X-Google-Smtp-Source: AJdET5dkmzmbs0/Uv1gNtTbyZoarPNPSL2ko3RdcLzBdsrwHtnUNqeW1qfH7V5j2G0A/UPXi1k9r X-Received: by 2002:a63:a112:: with SMTP id b18mr5311718pgf.440.1541716311484; Thu, 08 Nov 2018 14:31:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716311; cv=none; d=google.com; s=arc-20160816; b=z6k5D/Ule/wftkiu/gzRQDuH1xPtKrVUb55X0pmJXQc97OcdK5rskmmM+ZhxsFqV9Z DRvyXrw8kSKsaZxkEq/eYS1XCHK4CVNxrGXvW5tQ3OQL9iHAbeK6Iw2ezE6f+Dyu7GJd NVbZx0nxoOCo0BXeTrC+2NxvL4zxXVivUsDtJi54C0mGQIYRviINWqR+00Z6tUAKh8/5 62viCkHMSJsHtkxzhpwv4OCEOGLDzgUOBgZSn4san2+MWwQIGF5HCwLApP8vOBnmuJqI BY7zKQcIF7LjuxU966kNWrB1HkMQdBIPSIcO5XyPpniR4I8LoOqRTDSHNFHubUA0iZeq ww+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=siYy/PkXvF6LXFnxSB8kbRqHfLaSJYHYioK/GHn2/xo=; b=crCBbTvoU8xFfcYf+omTCT4N/FQYYzaX4JGAtsFTaUoHgnluIK4cZ3/7DdF/dZ1j8s isHjjCTFlPCZRJyb54RyzeszeKXYVQlZWvq8pRX8wG5Nuwct6C+AopcXB5tTAgoCddMH p8H5ZsB1++ySh1aueKMHhLmkROrY/AW2pqRg/m7zyrWDH2mgRn7eQPR5f13eo3Jrl7Yd n81TgFC1xldD4ZakXtQZe1YfymlaAhbwuq7bwtZN5LaBt215DBcQQ8F52pZ5TTFVhtXw HCMzNbWVn4UPRA3hzZZDF+IVlVmQnTHG13X498y/QQqhFcyvBANYrmHITr6tvdmvqxrW h7Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iC/18oS3"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b13-v6si6085959plm.316.2018.11.08.14.31.36; Thu, 08 Nov 2018 14:31:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iC/18oS3"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730515AbeKIHh5 (ORCPT + 99 others); Fri, 9 Nov 2018 02:37:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:56718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730487AbeKIHh4 (ORCPT ); Fri, 9 Nov 2018 02:37:56 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C5BC20989; Thu, 8 Nov 2018 22:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714427; bh=qh/itS1sUc+hgT3Vk5UI+RKtFPsW0Z72Db7BN3jzqwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iC/18oS3QfjNMcWz6yRxtw0M9CSLgbPilmj8lhQ93jYjTJ8GybLA2SnqMUY6/w2IN 3gApwHrDK1mW9YP2lgK6RHGOVSUpKV9RhIYUsdnmUe+35400Z4AtMY+mhtsDuvZcNQ +j6DcT5zD2vzHyDDzbrr7S9vAFLS/Fu6HT4jINd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Burton , Matt Redfearn , James Hogan , Marcin Nowakowski , Miodrag Dinic , Ingo Molnar , David Daney , linux-mips@linux-mips.org, Ralf Baechle , Sasha Levin Subject: [PATCH 4.4 081/114] MIPS: microMIPS: Fix decoding of swsp16 instruction Date: Thu, 8 Nov 2018 13:51:36 -0800 Message-Id: <20181108215108.269018818@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit cea8cd498f4f1c30ea27e3664b3c671e495c4fce ] When the immediate encoded in the instruction is accessed, it is sign extended due to being a signed value being assigned to a signed integer. The ISA specifies that this operation is an unsigned operation. The sign extension leads us to incorrectly decode: 801e9c8e: cbf1 sw ra,68(sp) As having an immediate of 1073741809. Since the instruction format does not specify signed/unsigned, and this is currently the only location to use this instuction format, change it to an unsigned immediate. Fixes: bb9bc4689b9c ("MIPS: Calculate microMIPS ra properly when unwinding the stack") Suggested-by: Paul Burton Signed-off-by: Matt Redfearn Reviewed-by: James Hogan Cc: Marcin Nowakowski Cc: Miodrag Dinic Cc: Ingo Molnar Cc: David Daney Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/16957/ Signed-off-by: Ralf Baechle Signed-off-by: Sasha Levin --- arch/mips/include/uapi/asm/inst.h | 2 +- arch/mips/kernel/process.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h index 9b44d5a816fa..1b6f2f219298 100644 --- a/arch/mips/include/uapi/asm/inst.h +++ b/arch/mips/include/uapi/asm/inst.h @@ -846,7 +846,7 @@ struct mm16_r3_format { /* Load from global pointer format */ struct mm16_r5_format { /* Load/store from stack pointer format */ __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rt : 5, - __BITFIELD_FIELD(signed int simmediate : 5, + __BITFIELD_FIELD(unsigned int imm : 5, __BITFIELD_FIELD(unsigned int : 16, /* Ignored */ ;)))) }; diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index a9cc74354df8..ebd8a715fe38 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -207,7 +207,7 @@ static inline int is_ra_save_ins(union mips_instruction *ip, int *poff) if (ip->mm16_r5_format.rt != 31) return 0; - *poff = ip->mm16_r5_format.simmediate; + *poff = ip->mm16_r5_format.imm; *poff = (*poff << 2) / sizeof(ulong); return 1; -- 2.17.1