From: Kees Cook <keescook@chromium.org>
To: Yuanhe Shu <xiangzao@linux.alibaba.com>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
tony.luck@intel.com, gpiccoli@igalia.com, shuah@kernel.org,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
linux-hardening@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 0/5] pstore: add tty frontend and multi-backend
Date: Thu, 28 Sep 2023 20:49:02 -0700 [thread overview]
Message-ID: <202309282030.8CE179EBB@keescook> (raw)
In-Reply-To: <20230928024244.257687-1-xiangzao@linux.alibaba.com>
On Thu, Sep 28, 2023 at 10:42:39AM +0800, Yuanhe Shu wrote:
> In public cloud scenario, if kdump service works abnormally,
> users cannot get vmcore. Without vmcore, user has no idea why the
> kernel crashed. Meanwhile, there is no additional information
> to find the reason why the kdump service is abnormal.
>
> One way is to obtain console messages through VNC. The drawback
> is that VNC is real-time, if user missed the timing to get the VNC
> output, the crash needs to be retriggered.
>
> Another way is to enable the console frontend of pstore and record the
> console messages to the pstore backend. On the one hand, the console
> logs only contain kernel printk logs and does not cover
> user-mode print logs. Although we can redirect user-mode logs to the
> pmsg frontend provided by pstore, user-mode information related to
> booting and kdump service vary from systemd, kdump.sh, and so on which
> makes redirection troublesome. So we added a tty frontend and save all
> logs of tty driver to the pstore backend.
This is a clever solution!
> Another problem is that currently pstore only supports a single backend.
> For debugging kdump problems, we hope to save the console logs and tty
> logs to the ramoops backend of pstore, as it will not be lost after
> rebooting. If the user has enabled another backend, the ramoops backend
> will not be registered. To this end, we add the multi-backend function
> to support simultaneous registration of multiple backends.
Ah very cool; I really like this idea. I'd wanted to do it for a while
just to make testing easier, but I hadn't had time to attempt it.
> Based on the above changes, we can enable pstore in the crashdump kernel
> and save the console logs and tty logs to the ramoops backend of pstore.
> After rebooting, we can view the relevant logs by mounting the pstore
> file system.
So, before I do a line-at-a-time review of this code, I'd like to
address some design issues first.
I really don't want to make behavioral differences when we don't have
to:
- The multi-backend will enable _all possible_ backends, and that's a
big change that will do weird things for some pstore users. I would
prefer a pstore option to opt-in to enabling all backends. Perhaps
have "pstore.backend=" be parsed with commas, so a list of backends
can be provided, or "all" for the "all backends" behavior.
- Moving the pstorefs files into a subdirectory will break userspace
immediately (e.g. systemd-pstore expects very specifically named
files). Using subdirectories seems like a good idea, but perhaps
we need hardlinks into the root pstorefs for the "first" backend,
or some other creative solution here.
Then some technical thoughts about the TTY frontend's behavior:
- That 2 pstore records are created for every line of TTY output
feels kind of inefficient, though I don't have a better idea.
This is really only doable as you have it because the ramoops
and zone backends treat the single prz as a circular buffer.
I wonder about supporting this on other backends like EFI, but
perhaps it's just not going to happen.
- I'd like to check with the TTY folks to see if this is the "right"
place to hook to get a copy of what's being written.
Thanks and let me know what you think!
-Kees
--
Kees Cook
next prev parent reply other threads:[~2023-09-29 3:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 2:42 [PATCH 0/5] pstore: add tty frontend and multi-backend Yuanhe Shu
2023-09-28 2:42 ` [PATCH 1/5] pstore: add tty frontend Yuanhe Shu
2023-09-28 6:43 ` Greg KH
2023-09-28 2:42 ` [PATCH 2/5] pstore: add multi-backends support Yuanhe Shu
2023-09-28 2:42 ` [PATCH 3/5] pstore: add subdirs for multi-backends Yuanhe Shu
2023-09-28 2:42 ` [PATCH 4/5] pstore: remove the module parameter "backend" Yuanhe Shu
2023-09-28 2:42 ` [PATCH 5/5] tools/pstore: update pstore selftests Yuanhe Shu
2023-09-29 3:49 ` Kees Cook [this message]
2023-09-29 5:47 ` [PATCH 0/5] pstore: add tty frontend and multi-backend Greg KH
2023-11-24 21:43 ` Guilherme G. Piccoli
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=202309282030.8CE179EBB@keescook \
--to=keescook@chromium.org \
--cc=gpiccoli@igalia.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=tony.luck@intel.com \
--cc=xiangzao@linux.alibaba.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).