Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3920043pxv; Mon, 28 Jun 2021 16:41:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2sx+xIw5YEA7l6lC/kyqSL563g3vdV8gNhBFzoY66Hj3+j3ilLlYu7177TA0abalDpM88 X-Received: by 2002:a5d:9456:: with SMTP id x22mr1574552ior.14.1624923685821; Mon, 28 Jun 2021 16:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624923685; cv=none; d=google.com; s=arc-20160816; b=U/YkeDBc1HqPciL0WWci9X/ZDC7M8WYgFFzsdvENjiB/8l+52XbtARSTd7MDNezBH8 6UjY1El98F7XgswKfqIvLswBUP/eFLxU4/dOmep8FGa5d+80E1i9fdxNPClN3B0Qrpt7 vzE9gDUgS2Kq/IktuKP/3YtfPPIv3AWiXo+ULPyiiUz/8sKFPVsPg/FI9L64byaIrArF UM0eH2otBjyogrgYWrVkzgIEN1MBIp15tqV760e/NoeieBHXpLO+R3JcfFEDFfUQL5pk M9C7D0tZGIvAC6Iul8iK/XFvVEEDx/2M5m+7bHSbo5g0FtKnmuePdfEvBPPTlhknEfKP JQHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=RyXgP3rxZejGxt1sIENk/dvysQVBrXxs0itZPpnSnJ0=; b=hapz1erbIYa81zvodKToBWVdvKrMPdTwiRbPX8a+oihAemaf6qw9rredqUpNXq44Pk UsAhm6H5O4tNyUPu0kON/tT4P8zmeb0KfiNmwx1N+izj3NjDOCDe1kzRFLochq+N6hPL CFCUIYkzrIpynSnyre83FyRC7jVAXWUH2Obs60U+9RRvKlkmi2sPCczGlnGUn544avkf I8UrrpZTbX+59DkBVZ9nqzdbJcgaiofK+SXzcMCoF5ZBbcSVW9SwPl61Gkzctv3MEkN1 +9TSaV2YgIiGSMPxy638+QI/JnC+fvzwTE4q0jshQk7emp/0/Qfa9Z70+tSAVvxOaaef p7yQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si20174945jal.25.2021.06.28.16.41.14; Mon, 28 Jun 2021 16:41:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235994AbhF1TGE (ORCPT + 99 others); Mon, 28 Jun 2021 15:06:04 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:33324 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233101AbhF1TGA (ORCPT ); Mon, 28 Jun 2021 15:06:00 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]:48296) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lxwXY-00FZtO-Fr; Mon, 28 Jun 2021 13:03:28 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95]:38704 helo=email.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lxwXX-00Gdx8-9L; Mon, 28 Jun 2021 13:03:28 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Al Viro Cc: Linus Torvalds , Michael Schmitz , linux-arch , Jens Axboe , Oleg Nesterov , Linux Kernel Mailing List , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Geert Uytterhoeven , linux-m68k , Arnd Bergmann , Ley Foon Tan , Tejun Heo , Kees Cook References: <87a6njf0ia.fsf@disp2133> <87tulpbp19.fsf@disp2133> <87zgvgabw1.fsf@disp2133> <875yy3850g.fsf_-_@disp2133> Date: Mon, 28 Jun 2021 14:02:50 -0500 In-Reply-To: (Al Viro's message of "Thu, 24 Jun 2021 22:45:23 +0000") Message-ID: <87v95xx15x.fsf@disp2133> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1lxwXX-00Gdx8-9L;;;mid=<87v95xx15x.fsf@disp2133>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18JERu3BMiKmUMjDvvelGV7aJUlVNLWdXI= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa08.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,XMNoVowels, XM_Body_Dirty_Words autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] * 1.0 XM_Body_Dirty_Words Contains a dirty word X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Al Viro X-Spam-Relay-Country: X-Spam-Timing: total 577 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 14 (2.4%), b_tie_ro: 12 (2.0%), parse: 0.98 (0.2%), extract_message_metadata: 13 (2.2%), get_uri_detail_list: 1.59 (0.3%), tests_pri_-1000: 9 (1.5%), tests_pri_-950: 1.33 (0.2%), tests_pri_-900: 1.13 (0.2%), tests_pri_-90: 194 (33.7%), check_bayes: 190 (33.0%), b_tokenize: 7 (1.2%), b_tok_get_all: 10 (1.7%), b_comp_prob: 3.1 (0.5%), b_tok_touch_all: 164 (28.5%), b_finish: 1.53 (0.3%), tests_pri_0: 330 (57.2%), check_dkim_signature: 0.49 (0.1%), check_dkim_adsp: 3.1 (0.5%), poll_dns_idle: 0.90 (0.2%), tests_pri_10: 2.2 (0.4%), tests_pri_500: 8 (1.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 0/9] Refactoring exit X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Al Viro 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