From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
To: linux-hardening@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kees@kernel.org,
tony.luck@intel.com, kernel-dev@igalia.com, kernel@gpiccoli.net,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Subject: [PATCH] pstore/ftrace: Keep ftrace module parameter and debugfs switch in sync
Date: Sun, 1 Mar 2026 16:26:36 -0300 [thread overview]
Message-ID: <20260301192704.1263589-1-gpiccoli@igalia.com> (raw)
Commit a5d05b07961a ("pstore/ftrace: Allow immediate recording")
introduced a kernel parameter to enable early-boot collection for
ftrace frontend. But then, if we enable the debugfs later, the
parameter remains set as N. This is not a biggie, things work fine;
but at the same time, why not have both in sync if possible, right?
Cc: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
---
fs/pstore/ftrace.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/fs/pstore/ftrace.c b/fs/pstore/ftrace.c
index 776cae20af4e..13db123beac1 100644
--- a/fs/pstore/ftrace.c
+++ b/fs/pstore/ftrace.c
@@ -62,13 +62,16 @@ static struct ftrace_ops pstore_ftrace_ops __read_mostly = {
};
static DEFINE_MUTEX(pstore_ftrace_lock);
-static bool pstore_ftrace_enabled;
+static bool record_ftrace;
+module_param(record_ftrace, bool, 0400);
+MODULE_PARM_DESC(record_ftrace,
+ "enable ftrace recording immediately (default: off)");
static int pstore_set_ftrace_enabled(bool on)
{
ssize_t ret;
- if (on == pstore_ftrace_enabled)
+ if (on == record_ftrace)
return 0;
if (on) {
@@ -82,7 +85,7 @@ static int pstore_set_ftrace_enabled(bool on)
pr_err("%s: unable to %sregister ftrace ops: %zd\n",
__func__, on ? "" : "un", ret);
} else {
- pstore_ftrace_enabled = on;
+ record_ftrace = on;
}
return ret;
@@ -111,7 +114,7 @@ static ssize_t pstore_ftrace_knob_write(struct file *f, const char __user *buf,
static ssize_t pstore_ftrace_knob_read(struct file *f, char __user *buf,
size_t count, loff_t *ppos)
{
- char val[] = { '0' + pstore_ftrace_enabled, '\n' };
+ char val[] = { '0' + record_ftrace, '\n' };
return simple_read_from_buffer(buf, count, ppos, val, sizeof(val));
}
@@ -124,11 +127,6 @@ static const struct file_operations pstore_knob_fops = {
static struct dentry *pstore_ftrace_dir;
-static bool record_ftrace;
-module_param(record_ftrace, bool, 0400);
-MODULE_PARM_DESC(record_ftrace,
- "enable ftrace recording immediately (default: off)");
-
void pstore_register_ftrace(void)
{
if (!psinfo->write)
@@ -145,9 +143,9 @@ void pstore_register_ftrace(void)
void pstore_unregister_ftrace(void)
{
mutex_lock(&pstore_ftrace_lock);
- if (pstore_ftrace_enabled) {
+ if (record_ftrace) {
unregister_ftrace_function(&pstore_ftrace_ops);
- pstore_ftrace_enabled = false;
+ record_ftrace = false;
}
mutex_unlock(&pstore_ftrace_lock);
--
2.50.1
next reply other threads:[~2026-03-01 19:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 19:26 Guilherme G. Piccoli [this message]
2026-03-28 21:48 ` Guilherme G. Piccoli
2026-03-31 21:53 ` Kees Cook
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=20260301192704.1263589-1-gpiccoli@igalia.com \
--to=gpiccoli@igalia.com \
--cc=kees@kernel.org \
--cc=kernel-dev@igalia.com \
--cc=kernel@gpiccoli.net \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=u.kleine-koenig@baylibre.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®