Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1693915imm; Wed, 8 Aug 2018 23:55:02 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxQg9x98c2khMcMTwLHjhoWng/G4fd80D5Yj+M5PcJtLNnPNeKcqalTDHkVSVKHBtSgFHPX X-Received: by 2002:aa7:83cd:: with SMTP id j13-v6mr1028764pfn.236.1533797702186; Wed, 08 Aug 2018 23:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533797702; cv=none; d=google.com; s=arc-20160816; b=RTQQG2Mf2eCqF0K3ITIjO3eGc0WFkCgPpY0zhDb4EK/ghIu+Sah4YQNbWkIVOXudBs DBG/V7VEiDcRKuwobkAhFLWIQcgBmFu3auW2evb7ZYY3G11ZdxwWuh6iFkcmJP8/hxO/ hjehJMCDHpF/WRqR00fQuuMslXYjjTSKu1Sql4jlMAuS2ph1rJYNEF3FOfzfSW1AOiat IeYuwEENujm7hat3xt5FYBACSNX26B3L4jHPTfWlzNXqNZsBhQ3TosN+MuTyB2RI6Chb GzeQ3H/EyaXAv5JrIegZNxBLt/uALIaqjTQEl3JLxa/feI/wkFc01NFZdna7D6dpOQRi OVZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=uee/19ZglqtFWuOucay2Ioug4I1l8jamm7jcVRJQUJ4=; b=wsk8TMaoJl+C9vUYiO2f1DxTbWxMCeTC6SqPUYkU5g074P7hXnwP9q/HF6YPM9VaEQ sJRHxzl32Sf+oGin/o57yWvRrnqrd9JsIagrKyksSOV6CHAcbAScY9RFcnjcC7KREJP4 0VrCMhfQ8j9RkH88gHYCD2+xoWTiIv3LBQ3L9fv/bE/JZojnzABpuVWEcS/eqXGLkQeN qb9y82FNewBoggNEfThndVoS0l6FlydR/qiWMOArxiyukqibjWo9qq81592aQqzJA5AY sPTEFHk0AhtpN4d0p+LjT6vY8F6eI8xtXWjSdfv0UWs3oPgs4afTByvW/5BkPzay9JIQ lGKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21-v6si5913240pgk.337.2018.08.08.23.54.48; Wed, 08 Aug 2018 23:55:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728549AbeHIJQz (ORCPT + 99 others); Thu, 9 Aug 2018 05:16:55 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:42808 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727371AbeHIJQy (ORCPT ); Thu, 9 Aug 2018 05:16:54 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fnep8-0000Mk-Am; Thu, 09 Aug 2018 00:53:30 -0600 Received: from [97.119.167.31] (helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fneos-0004l2-Vs; Thu, 09 Aug 2018 00:53:30 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov Cc: Andrew Morton , , Wen Yang , majiang , Linus Torvalds References: <87h8l9p7bg.fsf@xmission.com> <20180709104158.GA23796@redhat.com> <87sh4so5jv.fsf@xmission.com> <20180709145726.GA26149@redhat.com> <877em4nxo0.fsf@xmission.com> <87lgakm4ol.fsf@xmission.com> <20180710134639.GA2453@redhat.com> <877em2jxyr.fsf_-_@xmission.com> <87efft5ncd.fsf_-_@xmission.com> Date: Thu, 09 Aug 2018 01:53:02 -0500 In-Reply-To: <87efft5ncd.fsf_-_@xmission.com> (Eric W. Biederman's message of "Mon, 23 Jul 2018 22:22:58 -0500") Message-ID: <87wot0yqsx.fsf_-_@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1fneos-0004l2-Vs;;;mid=<87wot0yqsx.fsf_-_@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19pYWtLigVphRuYEECAG2OafgkXfmadnUI= X-SA-Exim-Connect-IP: 97.119.167.31 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa07.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.1 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TooManySym_01,XMSolicitRefs_0 autolearn=disabled version=3.4.1 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.4264] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.1 XMSolicitRefs_0 Weightloss drug * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 15021 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 3.2 (0.0%), b_tie_ro: 2.2 (0.0%), parse: 0.93 (0.0%), extract_message_metadata: 3.1 (0.0%), get_uri_detail_list: 1.29 (0.0%), tests_pri_-1000: 2.7 (0.0%), tests_pri_-950: 1.15 (0.0%), tests_pri_-900: 0.95 (0.0%), tests_pri_-400: 22 (0.1%), check_bayes: 21 (0.1%), b_tokenize: 8 (0.1%), b_tok_get_all: 6 (0.0%), b_comp_prob: 2.4 (0.0%), b_tok_touch_all: 2.7 (0.0%), b_finish: 0.65 (0.0%), tests_pri_0: 139 (0.9%), check_dkim_signature: 0.48 (0.0%), check_dkim_adsp: 3.0 (0.0%), tests_pri_500: 14839 (98.8%), poll_dns_idle: 14832 (98.7%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH v5 0/6] Not restarting for due to signals. X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This builds on patches 1-15 of my previous patch posting. As those are non-controversial I am not posting them again. I took longer than I had hoped to get this set together because a kernel testing robot noticed some random corruption with the way I had been adding to the list. I finally tracked it down to failing to remove the sigset from the list during fork_idle. So I have made that logic simpler and use hlist_del_init which will only remove an item from a list if it was placed on the list in the first place. I took Oleg's suggesting and moved calculate_sigpending into schedule_tail where recalc_sigpending an be used directly. Then in calculate_sigpending I just unconditionally set TIF_SIGPENDING and allow recalc_sigpending to clear TIF_SIGPENDING if we don't need it. I also now handle the stop/continue signal magic where we only let one of stop signals and SIGCONT be pending at a time. Looking at it from first principles dropping one of SIGTSTP SIGTTIN SIGTTOU or SIGCONT before calling it's handler feels wrong. I checked and it is our historical behavior, so I won't even thinking of introducing different behavior at this point. Eric W. Biederman (6): fork: Move and describe why the code examines PIDNS_ADDING fork: Unconditionally exit if a fatal signal is pending signal: Add calculate_sigpending() fork: Skip setting TIF_SIGPENDING in ptrace_init_task fork: Have new threads join on-going signal group stops signal: Don't restart fork when signals come in. include/linux/ptrace.h | 2 -- include/linux/sched/signal.h | 11 ++++++++++ init/init_task.c | 1 + kernel/fork.c | 49 ++++++++++++++++++++++++++++++-------------- kernel/sched/core.c | 2 ++ kernel/signal.c | 43 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 17 deletions(-) Eric