Re: [PATCH] kexec: Fix reboot race during device_shutdown()
From: Joel Fernandes
Date: Wed Oct 11 2023 - 11:53:14 EST
On Tue, Oct 10, 2023 at 5:08 PM Eric W. Biederman <ebiederm@xxxxxxxxxxxx> wrote:
>
> Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> writes:
[...]
> >> That way you can get the orderly shutdown
> >> of userspace daemons/services along with an orderly shutdown of
> >> everything the kernel is responsible for.
> >
> > Fixing in userspace is an option but people are not happy that the
> > kernel can crash like that.
>
> In a kexec on panic scenario the kernel needs to perform that absolute
> bare essential shutdown before calling kexec (basically nothing).
> During kexec-on-panic nothing can be relied upon because we don't know
> what is broken. If that is what you care about (as suggested by the
> unit test) you need to fix the device initialization.
>
> In a normal kexec scenario the whole normal reboot process is expected.
> I have no problems with fixing the kernel to handle that scenario,
> but in the real world the entire orderly shutdown both, kernel
> and userspace should be performed.
Sounds good. Since you mentioned you have no problem with fixing
regular reboot in the kernel, we will work on reproducing the issue
with regular reboot as well and fix that.
I think a syscall causing the kernel to crash instead of operate
normally is a cause of concern, so let us fix the kernel as well
(other than improving the test case as you mentioned).
> >> At the kernel level a kexec reboot and a normal reboot have been
> >> deliberately kept as close as possible. Which is why I say we should
> >> fix it in reboot.
> >
> > You mean fix it in userspace?
>
> No. I mean in the kernel the orderly shutdown for a kexec reboot and an
> ordinary reboot are kept as close to the same as possible.
>
> It should be the case that the only differences between the two is that
> in once case system firmware takes over after the orderly shutdown,
> and in the other case a new kernel takes over after the orderly shutdown.
Agreed.
thanks,
- Joel