From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>
Cc: David Laight <david.laight.linux@gmail.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH v3 2/2] s390: Warn if kernel command line contains non-printable EBCDIC characters
Date: Fri, 28 Aug 2026 15:59:35 +0200 [thread overview]
Message-ID: <20260828140057.1728173-3-iii@linux.ibm.com> (raw)
In-Reply-To: <20260828140057.1728173-1-iii@linux.ibm.com>
Users may accidentally add multi-byte UTF-8 characters to zipl.conf
parmline, for example, by copying snippets containing non-breaking
spaces (\xC2\xA0) from web pages.
The kernel will then interpret the entire command line as EBCDIC,
making it unusable. Distinguish this situation from the legitimate
EBCDIC conversion by looking for non-printable characters and issue
a warning.
The current solution deliberately makes the following tradeoffs:
* Do not make this a hard failure, there may be a very small number
of users who put characters with diacritics on their EBCDIC-encoded
command lines.
* Do not use heuristics with arbitrary thresholds, these may fail
intermittently on, e.g., punctuation-heavy command lines, and having
to tune thresholds in subsequent patches is not desirable.
* Use the invariant subset of EBCDIC to determine whether characters
are printable, the vast majority of command lines will contain
characters from this subset.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
arch/s390/boot/ipl_parm.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/s390/boot/ipl_parm.c b/arch/s390/boot/ipl_parm.c
index 6bc950b92be76..24573307263ca 100644
--- a/arch/s390/boot/ipl_parm.c
+++ b/arch/s390/boot/ipl_parm.c
@@ -173,12 +173,23 @@ static inline int has_ebcdic_char(const char *str)
return 0;
}
+static inline bool has_nonprintable_ebcdic_char(const char *str)
+{
+ for (; *str; str++)
+ if (!isprint_ebc_inv(*str))
+ return true;
+ return false;
+}
+
void setup_boot_command_line(void)
{
parmarea.command_line[COMMAND_LINE_SIZE - 1] = 0;
/* convert arch command line to ascii if necessary */
- if (has_ebcdic_char(parmarea.command_line))
+ if (has_ebcdic_char(parmarea.command_line)) {
+ if (has_nonprintable_ebcdic_char(parmarea.command_line))
+ boot_warn("Kernel command line was treated as EBCDIC, but contains non-printable characters\n");
EBCASC(parmarea.command_line, COMMAND_LINE_SIZE);
+ }
/* copy arch command line */
strscpy(early_command_line, strim(parmarea.command_line));
--
2.55.0
next prev parent reply other threads:[~2026-08-28 14:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 13:59 [PATCH v3 0/2] s390: Warn if kernel command line contains non-printable EBCDIC Ilya Leoshkevich
2026-08-28 13:59 ` [PATCH v3 1/2] s390/ebcdic: Add character classes for the invariant subset of EBCDIC Ilya Leoshkevich
2026-08-28 14:09 ` sashiko-bot
2026-08-28 13:59 ` Ilya Leoshkevich [this message]
2026-08-28 14:22 ` [PATCH v3 2/2] s390: Warn if kernel command line contains non-printable EBCDIC characters sashiko-bot
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=20260828140057.1728173-3-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=david.laight.linux@gmail.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.