From: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>, <mark-pk.tsai@mediatek.com>,
<yj.chiang@mediatek.com>
Subject: [PATCH] arm64: ftrace: don't dereference a probably invalid address
Date: Mon, 7 Jun 2021 11:23:30 +0800 [thread overview]
Message-ID: <20210607032329.28671-1-mark-pk.tsai@mediatek.com> (raw)
Address in __mcount_loc may be invalid if somthing goes wrong.
On our arm64 platform, the bug in recordmcount make kernel
crash in ftrace_init().
https://lore.kernel.org/lkml/20210607023839.26387-1-mark-pk.tsai@mediatek.com/
Return -EFAULT if we are dealing with out-of-range condition
to prevent dereference the invalid address in ftrace_bug(),
then the kernel can disable ftrace safely for problematic
__mcount_loc.
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
---
arch/arm64/kernel/ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index b5d3ddaf69d9..98bec8445a58 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -201,7 +201,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
preempt_enable();
if (WARN_ON(!mod))
- return -EINVAL;
+ return -EFAULT;
}
/*
--
2.18.0
next reply other threads:[~2021-06-07 3:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 3:23 Mark-PK Tsai [this message]
2021-06-07 13:55 ` Steven Rostedt
2021-06-07 14:15 ` Mark-PK Tsai
2021-06-07 14:36 ` Mark-PK Tsai
2021-06-07 14:52 ` Steven Rostedt
2021-06-07 18:14 ` Mark-PK Tsai
2021-06-07 18:50 ` Steven Rostedt
2021-06-08 0:52 ` Mark-PK Tsai
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=20210607032329.28671-1-mark-pk.tsai@mediatek.com \
--to=mark-pk.tsai@mediatek.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=will@kernel.org \
--cc=yj.chiang@mediatek.com \
/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
all inboxes | Powered by JetHome®