Re: [PATCH 0/9] Refactoring exit
From: Eric W. Biederman
Date: Mon Jun 28 2021 - 15:03:41 EST
Al Viro <viro@xxxxxxxxxxxxxxxxxx> writes:
> On Thu, Jun 24, 2021 at 01:57:35PM -0500, Eric W. Biederman wrote:
>
>> So far the code has been lightly tested, and the descriptions of some
>> of the patches are a bit light, but I think this shows the direction
>> I am aiming to travel for sorting out exit(2) and exit_group(2).
>
> FWIW, here's the current picture for do_exit(), aside of exit(2) and do_exit_group():
>
> 1) stuff that is clearly oops-like -
> alpha:die_if_kernel() alpha:do_entUna() alpha:do_page_fault() arm:oops_end()
> arm:__do_kernel_fault() arm64:die() arm64:die_kernel_fault() csky:alignment()
> csky:die() csky:no_context() h8300:die() h8300:do_page_fault() hexagon:die()
> ia64:die() i64:ia64_do_page_fault() m68k:die_if_kernel() m68k:send_fault_sig()
> microblaze:die() mips:die() nds32:handle_fpu_exception() nds32:die()
> nds32:unhandled_interruption() nds32:unhandled_exceptions() nds32:do_revinsn()
> nds32:do_page_fault() nios:die() openrisc:die() openrisc:do_page_fault()
> parisc:die_if_kernel() ppc:oops_end() riscv:die() riscv:die_kernel_fault()
> s390:die() s390:do_no_context() s390:do_low_address() sh:die()
> sparc32:die_if_kernel() sparc32:do_sparc_fault() sparc64:die_if_kernel()
> x86:rewind_stack_do_exit() xtensa:die() xtensa:bad_page_fault()
> We really do not want ptrace anywhere near any of those and we do not want
> any of that to return; this shit would better be handled right there and
> there - no "post a fatal signal" would do.
Thanks that makes a good start for digging into these.
I think the distinction I would make is:
- If the kernel is broken use do_task_dead.
- Otherwise cleanup the semantics by using start_group_exit,
start_task_exit or by just cleaning up the code.
Looking at the reboot case it looks like we the code
should have become do_group_exit in 2.5. I have a suspicion
we have a bunch of similar cases that want to terminate the
entire process, but we simply never updated to deal with
multi-thread processes.
I suspect in the reboot case panic if machine_halt or
or machine_power_off fails is more likely the correct
handling. But we do have funny semantics sometimes.
I will see what I can do to expand my patchset to handle all of these
various callers of do_exit.
Eric