From: Ye Bin <yebin@huaweicloud.com>
To: rostedt@goodmis.org, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com, mark.rutland@arm.com,
linux-trace-kernel@vger.kernel.org
Cc: yebin@huaweicloud.com, yebin10@huawei.com
Subject: [PATCH v2 2/2] ftrace: don't allocate ftrace module map if ftrace is disabled
Date: Tue, 27 May 2025 14:19:00 +0800 [thread overview]
Message-ID: <20250527061900.1533462-3-yebin@huaweicloud.com> (raw)
In-Reply-To: <20250527061900.1533462-1-yebin@huaweicloud.com>
From: Ye Bin <yebin10@huawei.com>
If the ftrace is disabled, it is meaningless to allocate module map.
So add check in allocate_ftrace_mod_map().
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
kernel/trace/ftrace.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ff5d9d73a4a7..1cac568a031c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7626,6 +7626,9 @@ allocate_ftrace_mod_map(struct module *mod,
{
struct ftrace_mod_map *mod_map;
+ if (ftrace_disabled)
+ return NULL;
+
mod_map = kmalloc(sizeof(*mod_map), GFP_KERNEL);
if (!mod_map)
return NULL;
--
2.34.1
prev parent reply other threads:[~2025-05-27 6:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 6:18 [PATCH v2 0/2] fix UAF when lookup kallsym after ftrace disabled Ye Bin
2025-05-27 6:18 ` [PATCH v2 1/2] ftrace: " Ye Bin
2025-05-27 6:19 ` Ye Bin [this message]
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=20250527061900.1533462-3-yebin@huaweicloud.com \
--to=yebin@huaweicloud.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=yebin10@huawei.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;
as well as URLs for NNTP newsgroup(s).