Re: [PATCH] MIPS: Remove noreturn attribute for die()

From: Tiezhu Yang
Date: Sun Aug 13 2023 - 23:03:25 EST




On 08/14/2023 05:30 AM, Maciej W. Rozycki wrote:
On Wed, 9 Aug 2023, Tiezhu Yang wrote:

So you want to keep a task alive that has caused a kernel oops in the
process context in this case, right? What purpose would it be for and
what condition causes `notify_die' to return NOTIFY_STOP? IOW why is
there no need to call `make_task_dead' in this case?

I did some research, hope it is useful.

...


This requires making die() and die_if_kernel() return a value,
and their callers to honor this (and be prepared that it returns).

Thanks, that indeed helps, though indirectly. I think the most relevant,
though still terse explanation comes from commit 20c0d2d44029 ("[PATCH]
i386: pass proper trap numbers to die chain handlers"), which I believe is
the earliest of similar changes. The patch was originally submitted here:
<https://lore.kernel.org/r/43DDF02E.76F0.0078.0@xxxxxxxxxx/> and hardly
any discussion emerged, but I think the key statement is:

"[...] honor the return value from the handler chain invocation in die()
as, through a debugger, the fault may have been fixed."

Now it makes sense to me: even if ignoring the event will make the system
unstable, by allowing access through a debugger it has been compromised
already anyway.

So I think your change will be good if you update the change description
to include the justification quoted above rather than just: "the others do
it too, so it must be good" (though you can of course mention that your
change also makes our port consistent with other ones). I suggest linking
to the original i386 submission too for future reference.

Thank you very much.


Also I note that you combine three independent changes into one, so
please split it into individual patches as per our requirements.


Will do it in v2.

Thanks,
Tiezhu