Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6507030imm; Mon, 23 Jul 2018 20:30:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdrnWKX/XUBsSOMuER3wGcpBEqMUbko4q3hQ75WVW/8fgb7EvNc/U1+HqLzBu/okjeeaH5g X-Received: by 2002:a63:6b03:: with SMTP id g3-v6mr14717827pgc.57.1532403010147; Mon, 23 Jul 2018 20:30:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532403010; cv=none; d=google.com; s=arc-20160816; b=otYEpcCmm6gwX/KhQ2IcwJ1RfzBTRfF3e/lt51EHmcZtW4WeNNHhax6VecH8jgCe+G RLY88wpGf00dH4USLUxWhxxg8neD1ebWSSW5jkB6IkoyfbxjNiVAT2GmPYikW5MLKpBN Lkh3IxEnH6m3EY6m3A+IsS/VH3phZP7vvMaqcbdRLIZX/DSR/yOB6j/2BwRnm8iBQ0SI T463V0sE8FpKAdjIr3wHcuMCDd1/vNSf6rV4x5FlpBkMEG3rWdjZYsfHOzOvDm0AqSTF qkfZmWpGJApGKXUwZfQFzR/7j4sVuMir/9M6IhorANsq6yQs5ikkf79IzdvYdwipXlRC qBAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=IPRXuwhiBPO2+ldrs8cxt1CCOU47GlMFsPqI6neYu3E=; b=cZ3Jm4qyzBasIDscCS4PqXZl/BxitzuFL7uuXH4qi+Egpzihq2Kjif6xHJt/ULMW5S cfa4hMnmo6ZeyfVqG5m0wVD0dy4Uo8gY/B3mCCxXWl5dIdDAVluuLGdW0g8qSXrJW5Q5 fu4JwHi/Ch3S7B9pYX5kzhbj6Qo2x53l0R2QrtpwF4LMMBjnmxXeyvohpYOtqgOcIgig 6Oj7DuFBZB183s9EIERVf4V2hjDlMZxW19pVJwvdRCy8bKxga4YzUT5xBgeBaWx+QN09 BW5yXXWj2MrKNcH19oMf6nx36kFFeuQ1aHIQSDs8Kh8D9ZTgiaxzafpd0qlHEZn/JdTN v0sA== 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 b184-v6si10690980pfg.94.2018.07.23.20.29.55; Mon, 23 Jul 2018 20:30:10 -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 S2388473AbeGXEbx (ORCPT + 99 others); Tue, 24 Jul 2018 00:31:53 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:41961 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388134AbeGXEbw (ORCPT ); Tue, 24 Jul 2018 00:31:52 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fhnz3-00032Z-3H; Mon, 23 Jul 2018 21:27:33 -0600 Received: from [97.119.167.31] (helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fhnxT-0008AK-Pw; Mon, 23 Jul 2018 21:25:56 -0600 From: "Eric W. Biederman" To: Linus Torvalds Cc: Oleg Nesterov , Andrew Morton , linux-kernel@vger.kernel.org, Wen Yang , majiang , "Eric W. Biederman" Date: Mon, 23 Jul 2018 22:24:12 -0500 Message-Id: <20180724032419.20231-13-ebiederm@xmission.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <87efft5ncd.fsf_-_@xmission.com> References: <87efft5ncd.fsf_-_@xmission.com> X-XM-SPF: eid=1fhnxT-0008AK-Pw;;;mid=<20180724032419.20231-13-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1++ynVFon7RuQmBMEWG9WKVKJAmxpEknn8= X-SA-Exim-Connect-IP: 97.119.167.31 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa02.xmission.com X-Spam-Level: * X-Spam-Status: No, score=1.3 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TooManySym_01,XMNoVowels autolearn=disabled version=3.4.0 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa02 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 883 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.2 (0.4%), b_tie_ro: 2.2 (0.3%), parse: 1.15 (0.1%), extract_message_metadata: 25 (2.8%), get_uri_detail_list: 2.6 (0.3%), tests_pri_-1000: 9 (1.0%), tests_pri_-950: 2.1 (0.2%), tests_pri_-900: 1.69 (0.2%), tests_pri_-400: 26 (2.9%), check_bayes: 24 (2.7%), b_tokenize: 10 (1.2%), b_tok_get_all: 6 (0.6%), b_comp_prob: 2.8 (0.3%), b_tok_touch_all: 2.3 (0.3%), b_finish: 0.81 (0.1%), tests_pri_0: 432 (48.9%), check_dkim_signature: 0.86 (0.1%), check_dkim_adsp: 4.6 (0.5%), tests_pri_500: 379 (42.9%), poll_dns_idle: 369 (41.8%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 13/20] signal: Push pid type down into send_signal 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 in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This information is already available in the callers and by pushing it down it makes the code a little clearer, and allows better group signal behavior in fork. Signed-off-by: "Eric W. Biederman" --- kernel/signal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index 2c09e6143dd8..8decc70c1dc2 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1103,7 +1103,7 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t, } static int send_signal(int sig, struct siginfo *info, struct task_struct *t, - int group) + enum pid_type type) { int from_ancestor_ns = 0; @@ -1112,7 +1112,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t, !task_pid_nr_ns(current, task_active_pid_ns(t)); #endif - return __send_signal(sig, info, t, group, from_ancestor_ns); + return __send_signal(sig, info, t, type != PIDTYPE_PID, from_ancestor_ns); } static void print_fatal_signal(int signr) @@ -1151,13 +1151,13 @@ __setup("print-fatal-signals=", setup_print_fatal_signals); int __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p) { - return send_signal(sig, info, p, 1); + return send_signal(sig, info, p, PIDTYPE_TGID); } static int specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t) { - return send_signal(sig, info, t, 0); + return send_signal(sig, info, t, PIDTYPE_PID); } int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p, @@ -1167,7 +1167,7 @@ int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p, int ret = -ESRCH; if (lock_task_sighand(p, &flags)) { - ret = send_signal(sig, info, p, type != PIDTYPE_PID); + ret = send_signal(sig, info, p, type); unlock_task_sighand(p, &flags); } @@ -3966,7 +3966,7 @@ void kdb_send_sig(struct task_struct *t, int sig) "the deadlock.\n"); return; } - ret = send_signal(sig, SEND_SIG_PRIV, t, false); + ret = send_signal(sig, SEND_SIG_PRIV, t, PIDTYPE_PID); spin_unlock(&t->sighand->siglock); if (ret) kdb_printf("Fail to deliver Signal %d to process %d.\n", -- 2.17.1