From: Fabian Pflug <f.pflug@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Fabian Pflug <f.pflug@pengutronix.de>
Subject: [PATCH 3/3] startup: mount ps only on policy FS_EXTERNAL
Date: Tue, 28 Oct 2025 16:43:28 +0100 [thread overview]
Message-ID: <20251028154453.2990491-5-f.pflug@pengutronix.de> (raw)
In-Reply-To: <20251028154453.2990491-1-f.pflug@pengutronix.de>
Without the SCONFIG_FS_EXTERNAL, the bus of the driver for pstore will
not load, resulting in a missing driver for pstore and an error during
bootup.
Only mount the /pstore if FS_EXTERNAL is allowed by the security policy.
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
---
v2:
remove the umount
add unregister_handler
common/startup.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/common/startup.c b/common/startup.c
index 4313435f05..7cf7088ad6 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -55,6 +55,22 @@ extern exitcall_t __barebox_exitcalls_start[], __barebox_exitcalls_end[];
enum system_states barebox_system_state;
#if defined CONFIG_FS_RAMFS && defined CONFIG_FS_DEVFS
+static struct sconfig_notifier_block sconfig_notifier;
+
+static void mount_pstore(struct sconfig_notifier_block *nb,
+ enum security_config_option opt, bool allowed)
+{
+ if (allowed) {
+ mkdir("/pstore", 0);
+ mount("none", "pstore", "/pstore", NULL);
+ sconfig_unregister_handler(&sconfig_notifier);
+ }
+ /*
+ * no need to umount, since the permission is only needed for mounting,
+ * not for accessing the content.
+ */
+}
+
static int mount_root(void)
{
mount("none", "ramfs", "/", NULL);
@@ -69,8 +85,14 @@ static int mount_root(void)
}
if (IS_ENABLED(CONFIG_FS_PSTORE)) {
- mkdir("/pstore", 0);
- mount("none", "pstore", "/pstore", NULL);
+ if (IS_ALLOWED(SCONFIG_FS_EXTERNAL)) {
+ mkdir("/pstore", 0);
+ mount("none", "pstore", "/pstore", NULL);
+ } else {
+ sconfig_register_handler_filtered(&sconfig_notifier,
+ mount_pstore,
+ SCONFIG_FS_EXTERNAL);
+ }
}
if (IS_ENABLED(CONFIG_9P_FS))
--
2.47.3
next prev parent reply other threads:[~2025-10-28 15:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 15:43 [PATCH v2 1/3] startup: check for console before showing menu Fabian Pflug
2025-10-28 15:43 ` [PATCH v2 2/3] console_common: get_first_active: respect security policy Fabian Pflug
2025-10-29 7:04 ` Ahmad Fatoum
2025-10-28 15:43 ` Fabian Pflug [this message]
2025-10-29 9:06 ` [PATCH v2 1/3] startup: check for console before showing menu Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2025-10-28 12:18 [PATCH " Fabian Pflug
2025-10-28 12:18 ` [PATCH 3/3] startup: mount ps only on policy FS_EXTERNAL Fabian Pflug
2025-10-28 12:56 ` Ahmad Fatoum
2025-10-28 13:48 ` Fabian Pflug
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=20251028154453.2990491-5-f.pflug@pengutronix.de \
--to=f.pflug@pengutronix.de \
--cc=barebox@lists.infradead.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