From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Fabian Pflug <f.pflug@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH v2 2/3] console_common: get_first_active: respect security policy
Date: Wed, 29 Oct 2025 08:04:30 +0100 [thread overview]
Message-ID: <a45014da-fa2c-4b1d-93fb-4ab46743a95c@pengutronix.de> (raw)
In-Reply-To: <20251028154453.2990491-3-f.pflug@pengutronix.de>
Hi,
On 28.10.25 16:43, Fabian Pflug wrote:
> If the console input is deactivated through a security policy, then
> there is no need to iterate over the current consoles, as none should
> have a STDIN.
>
> Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
> ---
> v2:
> Fix in console common instead of working around it in startup.c
> common/console_common.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/common/console_common.c b/common/console_common.c
> index 5b7a64c99c..a8319c20f3 100644
> --- a/common/console_common.c
> +++ b/common/console_common.c
> @@ -23,6 +23,7 @@
> #include <linux/math64.h>
> #include <linux/sizes.h>
> #include <linux/overflow.h>
> +#include <security/config.h>
>
> #ifndef CONFIG_CONSOLE_NONE
>
> @@ -331,6 +332,11 @@ struct console_device *console_get_first_active(void)
> {
> struct console_device *cdev;
> const unsigned char active = CONSOLE_STDIN | CONSOLE_STDOUT;
> +
> + /* if no console input is allows, then we can't have STDIN on any. */
> + if (!IS_ALLOWED(SCONFIG_CONSOLE_INPUT))
> + return NULL;
This stretches the definition of an "active" console, because the console
is still usable for output. Please rename to console_get_first_interactive()
as requested on v1.
Thanks,
Ahmad
> +
> /*
> * Assumption to have BOTH CONSOLE_STDIN AND STDOUT in the
> * same output console
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-10-29 7:05 UTC|newest]
Thread overview: 5+ 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 [this message]
2025-10-28 15:43 ` [PATCH 3/3] startup: mount ps only on policy FS_EXTERNAL Fabian Pflug
2025-10-29 9:06 ` [PATCH v2 1/3] startup: check for console before showing menu Sascha Hauer
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=a45014da-fa2c-4b1d-93fb-4ab46743a95c@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=f.pflug@pengutronix.de \
/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