Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6506696imm; Mon, 23 Jul 2018 20:29:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdO7a9UyvPMhKdcY3dSF0mc+xEehfqfLI43L8oRL9TPNh+SPlLxxlsvTbFIKd94s2B9aF4v X-Received: by 2002:a62:5a01:: with SMTP id o1-v6mr16077461pfb.0.1532402979436; Mon, 23 Jul 2018 20:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532402979; cv=none; d=google.com; s=arc-20160816; b=wZng86jZV2rGWtVhqzMDx6gNMoVH0escjNleXNI8If+EFofLGNNN/1f6E6ipJN45hl vb/JlBCb9q4CwCX7VLLwJAIDYD2Tddatu5gI6NMZDnj+s3I7GkDy5ux+pViFjvxGI3aS btuCAVkl6au+FEar0i6a3Hw4v8rKs2GmGUh6jeJX9y/bL56EvFR7KTk8O92hpkJaAAJJ X1L3QNk9lTylpgXWAqQdraSriixuLMEXvNC+sTe7hreGZlpVf3iclFkEj/araQ2RpXFs 3EusQoDDMPfIGL6ujWCrOZBCAVst/HzDMWrnx5WMdpWzoJhb2+NHkBOKMv/bA1NHO/Bl nyJw== 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=hMiiasf/CX1+CgbRPBBNWtopEPlLgDVJmLbV4JUa03Q=; b=YNRSGzSZPlLSAwEKU5HplRRVQUF7nNDu+bn+qWXvqqiQ7gpUEQBdtKmW9Z9kKYLVHL Y/kuNO7UI5KGmsdhRpKpq4p02gfGAFoBIWHlt5E1rb8uPP3/oJTxj/K4XhzrJjudoDL0 4BzJqa2a+MBsSGlEJWLr35vVPYTRNg5M24hPasOR+yvlBJAVWbEpjs+uHhERoVoInegX pIdu1qQzOc77K7XByvREPHIMfGvGRGnSF8/JkZZoBgv64r9Ut7P4QrnbOCsN+TKJCxBU j6vCScyWxUg1fjrJDKD8YKMcIa8Kc7QdRAOQUGMtYxwjZkA5KrHlthu9pZa+AjVKfTm5 CeTg== 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 n6-v6si10480007pgt.268.2018.07.23.20.29.25; Mon, 23 Jul 2018 20:29:39 -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 S2388443AbeGXEbx (ORCPT + 99 others); Tue, 24 Jul 2018 00:31:53 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:51373 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388149AbeGXEbw (ORCPT ); Tue, 24 Jul 2018 00:31:52 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fhnz3-0007ic-Bz; 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 1fhnxW-0008AK-LM; Mon, 23 Jul 2018 21:25:59 -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:13 -0500 Message-Id: <20180724032419.20231-14-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=1fhnxW-0008AK-LM;;;mid=<20180724032419.20231-14-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19KDukiOfJbBuMvMD9YM8s+IzUojiCQLls= 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 sa08.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.1 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 * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 360 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.4 (0.7%), b_tie_ro: 1.72 (0.5%), parse: 0.58 (0.2%), extract_message_metadata: 20 (5.7%), get_uri_detail_list: 1.09 (0.3%), tests_pri_-1000: 9 (2.4%), tests_pri_-950: 5 (1.4%), tests_pri_-900: 0.91 (0.3%), tests_pri_-400: 25 (7.0%), check_bayes: 24 (6.7%), b_tokenize: 9 (2.4%), b_tok_get_all: 5 (1.4%), b_comp_prob: 1.36 (0.4%), b_tok_touch_all: 3.3 (0.9%), b_finish: 0.67 (0.2%), tests_pri_0: 291 (80.8%), check_dkim_signature: 0.39 (0.1%), check_dkim_adsp: 6 (1.6%), tests_pri_500: 3.9 (1.1%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 14/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 implementing better handling of signales set to a group of processes 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 8decc70c1dc2..1ef94303d87a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -998,7 +998,7 @@ static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_str #endif static int __send_signal(int sig, struct siginfo *info, struct task_struct *t, - int group, int from_ancestor_ns) + enum pid_type type, int from_ancestor_ns) { struct sigpending *pending; struct sigqueue *q; @@ -1012,7 +1012,7 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t, from_ancestor_ns || (info == SEND_SIG_FORCED))) goto ret; - pending = group ? &t->signal->shared_pending : &t->pending; + pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending; /* * Short-circuit ignored signals and support queuing * exactly one non-rt signal, so that we can get more @@ -1096,9 +1096,9 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t, out_set: signalfd_notify(t, sig); sigaddset(&pending->signal, sig); - complete_signal(sig, t, group); + complete_signal(sig, t, type != PIDTYPE_PID); ret: - trace_signal_generate(sig, info, t, group, result); + trace_signal_generate(sig, info, t, type != PIDTYPE_PID, result); return ret; } @@ -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, type != PIDTYPE_PID, from_ancestor_ns); + return __send_signal(sig, info, t, type, from_ancestor_ns); } static void print_fatal_signal(int signr) @@ -1377,7 +1377,7 @@ int kill_pid_info_as_cred(int sig, struct siginfo *info, struct pid *pid, if (sig) { if (lock_task_sighand(p, &flags)) { - ret = __send_signal(sig, info, p, 1, 0); + ret = __send_signal(sig, info, p, PIDTYPE_TGID, 0); unlock_task_sighand(p, &flags); } else ret = -ESRCH; -- 2.17.1