public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Dmitry Osipenko <digetx@gmail.com>,
	Ingo Molnar <mingo@kernel.org>, Sasha Levin <sashal@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 4.9 06/16] arm/ftrace: Fix BE text poking
Date: Sat, 22 Feb 2020 21:24:28 -0500	[thread overview]
Message-ID: <20200223022438.2398-6-sashal@kernel.org> (raw)
In-Reply-To: <20200223022438.2398-1-sashal@kernel.org>

From: Peter Zijlstra <peterz@infradead.org>

[ Upstream commit be993e44badc448add6a18d6f12b20615692c4c3 ]

The __patch_text() function already applies __opcode_to_mem_*(), so
when __opcode_to_mem_*() is not the identity (BE*), it is applied
twice, wrecking the instruction.

Fixes: 42e51f187f86 ("arm/ftrace: Use __patch_text()")
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/kernel/ftrace.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index 414e60ed02573..58a01083b0415 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -105,13 +105,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
 {
 	unsigned long replaced;
 
-	if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
+	if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
 		old = __opcode_to_mem_thumb32(old);
-		new = __opcode_to_mem_thumb32(new);
-	} else {
+	else
 		old = __opcode_to_mem_arm(old);
-		new = __opcode_to_mem_arm(new);
-	}
 
 	if (validate) {
 		if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))
-- 
2.20.1


  parent reply	other threads:[~2020-02-23  2:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-23  2:24 [PATCH AUTOSEL 4.9 01/16] ipmi:ssif: Handle a possible NULL pointer reference Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 02/16] drm/msm: Set dma maximum segment size for mdss Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 03/16] mac80211: consider more elements in parsing CRC Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 04/16] cfg80211: check wiphy driver existence for drvinfo report Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 05/16] qmi_wwan: re-add DW5821e pre-production variant Sasha Levin
2020-02-23  2:24 ` Sasha Levin [this message]
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 07/16] net: ena: fix potential crash when rxfh key is NULL Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 08/16] net: ena: add missing ethtool TX timestamping indication Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 09/16] net: ena: fix incorrect default RSS key Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 10/16] net: ena: rss: fix failure to get indirection table Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 11/16] net: ena: rss: store hash function as values and not bits Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 12/16] net: ena: fix incorrectly saving queue numbers when setting RSS indirection table Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 13/16] net: ena: ena-com.c: prevent NULL pointer dereference Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 14/16] enic: prevent waking up stopped tx queues over watchdog reset Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 15/16] cifs: Fix mode output in debugging statements Sasha Levin
2020-02-23  2:24 ` [PATCH AUTOSEL 4.9 16/16] cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200223022438.2398-6-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=digetx@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox