From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] s390: Warn if kernel command line contains non-printable EBCDIC characters
Date: Wed, 26 Aug 2026 16:17:07 +0200 [thread overview]
Message-ID: <485c5bb3-ca8a-4591-827c-09d23f4280a2@linux.ibm.com> (raw)
In-Reply-To: <20260826092916.21444Ab3-hca@linux.ibm.com>
On 8/26/26 11:29, Heiko Carstens wrote:
> On Tue, Aug 25, 2026 at 05:08:08PM +0200, Ilya Leoshkevich wrote:
>> 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.
>>
>> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
>> ---
>> arch/s390/boot/ipl_parm.c | 19 ++++++++++++++++++-
>> 1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/s390/boot/ipl_parm.c b/arch/s390/boot/ipl_parm.c
>> index 6bc950b92be76..71c0c26d56bba 100644
>> --- a/arch/s390/boot/ipl_parm.c
>> +++ b/arch/s390/boot/ipl_parm.c
>> @@ -173,12 +173,29 @@ static inline int has_ebcdic_char(const char *str)
>> return 0;
>> }
>>
>> +static inline int has_nonprintable_char(const char *str)
>> +{
>> + int i;
>> +
>> + for (i = 0; str[i]; i++) {
>> + unsigned char c = (unsigned char)str[i];
>> +
>> + /* isprint() is Latin-1, and we need ASCII here */
>> + if (c < 0x20 || c > 0x7e)
>> + return 1;
>
> Hm, I guess the comment refers to a different implementation than the
> kernel internal one? Since isprint() (see include/linux/ctype.h) is
> true for exactly the range you open-coded, as far as I can tell.
Unfortunately isprint() matches some extra ASCII upper-half characters,
e.g.:
const unsigned char _ctype[] = {
[...]
_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */
> Furthermore kernel command line parsing also allows for all sorts of
> spaces, tabs, and line feeds (see e.g. next_arg()). So I guess the
> above should be changed (and shortened :) ) to something like:
I completely forgot about newlines, thanks!
> static inline int has_nonprintable_char(const char *str)
> {
> for (int i = 0; str[i]; i++) {
> if (isprint(str[i]) || isspace(str[i]))
> return 1;
> }
> return 0;
> }
next prev parent reply other threads:[~2026-08-26 14:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 15:08 [PATCH] s390: Warn if kernel command line contains non-printable EBCDIC characters Ilya Leoshkevich
2026-08-25 15:20 ` sashiko-bot
2026-08-26 9:29 ` Heiko Carstens
2026-08-26 14:17 ` Ilya Leoshkevich [this message]
2026-08-26 13:51 ` David Laight
2026-08-26 14:08 ` Ilya Leoshkevich
2026-08-27 8:32 ` David Laight
2026-08-27 11:15 ` Ilya Leoshkevich
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=485c5bb3-ca8a-4591-827c-09d23f4280a2@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=agordeev@linux.ibm.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.