linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julius Werner <jwerner@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Julius Werner <jwerner@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Thierry Escande <thierry.escande@collabora.com>,
	Dmitry Torokhov <dtor@chromium.org>,
	Aaron Durbin <adurbin@chromium.org>
Subject: Re: [PATCH v2 2/3] firmware: google: memconsole: Escape unprintable characters
Date: Mon, 1 May 2017 16:44:15 -0700	[thread overview]
Message-ID: <CAODwPW-PbBeUu1vHGN2kpWkawM6U-KmPL3_bXDAq3hs6fDJMMA@mail.gmail.com> (raw)
In-Reply-To: <20170429053720.GB11491@kroah.com>

On Fri, Apr 28, 2017 at 10:37 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Fri, Apr 28, 2017 at 01:42:24PM -0700, Julius Werner wrote:
>> Recent improvements in coreboot's memory console allow it to contain
>> logs from more than one boot as long as the information persists in
>> memory. Since trying to persist a memory buffer across reboots often
>> doesn't quite work perfectly it is now more likely for random bit flips
>> to occur in the console. With the current implementation this can lead
>> to stray control characters that cause weird effects for the most common
>> use cases (such as just dumping the console with 'cat').
>>
>> This patch changes the memconsole driver to replace unprintable
>> characters with '?' by default. It also adds a new /sys/firmware/rawlog
>> node next to the existing /sys/firmware/log for use cases where it's
>> desired to read the raw characters.
>
> Again, you are doing multiple things here.  Break it up.

Sorry, I'm not sure what else you want me to break up here? If I add
the escaping in one patch and then add the raw node in a different
patch, there's a gap between the two patches where we're losing
functionality. Isn't that undesirable?

> And, can userspace handle this change?  You are now changing the format
> of the existing file.

I'm escaping characters that previously hadn't been escaped, but
really, I'm just trying to make sure that people can continue to use
this node as before. The real change has already happened in coreboot,
outside of Linux. This node could previously be relied upon to only
contain printable characters, and with newer versions of coreboot
that's not always the case anymore. I chose to do it this way because
I thought it would be the least disruptive for most users.

It can be handled in userspace, yes. It depends on what you use to
read the file, mostly... people using less will be fine, but people
using cat may get weird behavior. You're right that it doesn't really
*need* to be escaped in the kernel, and honestly I don't care too
much... I can leave it out if you want. But I think this is the most
convenient way to do it for existing users.

>> -     return sysfs_create_bin_file(firmware_kobj, &memconsole_bin_attr);
>> +     return sysfs_create_bin_file(firmware_kobj, &memconsole_log_attr) ||
>> +             sysfs_create_bin_file(firmware_kobj, &memconsole_raw_attr);
>
> While it is really rare, please do this properly and create one file,
> and then the other, and provide proper error handling here (i.e. if the
> second fails, remove the first).

Okay, will send that with the next set once we agree on the other stuff.

  reply	other threads:[~2017-05-01 23:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28 20:42 [PATCH v2 0/3] Memconsole changes for new coreboot format Julius Werner
2017-04-28 20:42 ` [PATCH v2 1/3] firmware: google: memconsole: Make memconsole interface more flexible Julius Werner
2017-04-28 20:42 ` [PATCH v2 2/3] firmware: google: memconsole: Escape unprintable characters Julius Werner
2017-04-29  5:37   ` Greg Kroah-Hartman
2017-05-01 23:44     ` Julius Werner [this message]
2017-05-02  0:42       ` Greg Kroah-Hartman
2017-05-02 22:16         ` Julius Werner
2017-04-28 20:42 ` [PATCH v2 3/3] firmware: google: memconsole: Adapt to new coreboot ring buffer format Julius Werner

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=CAODwPW-PbBeUu1vHGN2kpWkawM6U-KmPL3_bXDAq3hs6fDJMMA@mail.gmail.com \
    --to=jwerner@chromium.org \
    --cc=adurbin@chromium.org \
    --cc=dtor@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thierry.escande@collabora.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;
as well as URLs for NNTP newsgroup(s).