Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2425859imm; Mon, 16 Jul 2018 07:51:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdgJf3PIt/nBH4hfOHA6tR6hBoD82jrYRulCJNn8gMTJ13eRL0rwlXO5HhbRk+xRXJ+YVS9 X-Received: by 2002:a17:902:780d:: with SMTP id p13-v6mr14870949pll.119.1531752691357; Mon, 16 Jul 2018 07:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531752691; cv=none; d=google.com; s=arc-20160816; b=ID/eOoALSafQxl8MGkG9XS2pPfENNOUMYh22R//Wq44sITlo6GmJOHb5y1x/f1nhIs szw7LfY2DaU70idWTfhiLWGNu2F4vbx1l4DEcFFpVeMUBdJNDHd1NVhzn0X7XwJlebdI RdipO8AnWDx6F8lqZyYkXPR3WH9Pogbxtv3cAfrcIAi3frcq62sdZanTT+DkNun/dY61 2jhtxyLDY+jxip4rxfFHmOn90I8tvqAyoGC2H7oSm+4dip3QIO7S8iuCLr4urVN94NOE dtABczLvIoSJmoAm+k7p6slbRv9ALXA6u2dk5gAcyHNC65BElL/Znfd+Ki4zqIZ1wqsU G5aA== 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=pv5pu74rOyHorMe9Z67HwxGMCcj1BGseQlTTMaytsAM=; b=eFXjzSw5UHJMwVM8uaVIcjdUY1igitVC2x+rRVKtiO4Mwa26gN5fCI2mJMHNpPRdEm OPfpeOCipTOo82RPkzNWXCk02KLhjRpAaJ1xpLo8xGJKf+RNILzIEAwvaIFVcS3t812f F1qUx03CXtS11Nth3yNARnI0YX2sErF0l1CJ4/UQnSNj56BWJdC7j+N6pTfYIDVW/Yvb E9Cv2PsbEAluJ8BSGSIcKphIf1rQgnUeJrQdfs1rRqDntW5VEeGOXj/82wFYflwWfQgV 1pJEyJmpKoMNvqNx0KtX0SWJNekeev/jD3W2aL7q5U5Q8bTED+NrOuJ1lX7rZvtDKA/l N/Xg== 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 s126-v6si33175487pfc.222.2018.07.16.07.51.16; Mon, 16 Jul 2018 07:51:31 -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 S1728522AbeGPPS2 (ORCPT + 99 others); Mon, 16 Jul 2018 11:18:28 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:53522 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727328AbeGPPS2 (ORCPT ); Mon, 16 Jul 2018 11:18:28 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ff4pl-0006p0-29; Mon, 16 Jul 2018 08:50:41 -0600 Received: from [97.119.167.31] (helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ff4pV-0006Qe-BU; Mon, 16 Jul 2018 08:50:40 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov Cc: Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org, Wen Yang , majiang References: <877em2jxyr.fsf_-_@xmission.com> <20180711024459.10654-7-ebiederm@xmission.com> <20180716125144.GA18262@redhat.com> Date: Mon, 16 Jul 2018 09:50:20 -0500 In-Reply-To: <20180716125144.GA18262@redhat.com> (Oleg Nesterov's message of "Mon, 16 Jul 2018 14:51:45 +0200") Message-ID: <8736wjtetv.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=1ff4pV-0006Qe-BU;;;mid=<8736wjtetv.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19iZc11nrAlcKLM5hnLbsLDKuIpwiQkmBs= 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=3.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, XMNoVowels,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 1.5 TR_Symld_Words too many words that have symbols inside * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 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 15030 ms - load_scoreonly_sql: 0.14 (0.0%), signal_user_changed: 5.0 (0.0%), b_tie_ro: 3.0 (0.0%), parse: 1.25 (0.0%), extract_message_metadata: 4.3 (0.0%), get_uri_detail_list: 1.16 (0.0%), tests_pri_-1000: 4.8 (0.0%), compile_eval: 36 (0.2%), tests_pri_-950: 1.90 (0.0%), tests_pri_-900: 1.82 (0.0%), tests_pri_-400: 21 (0.1%), check_bayes: 19 (0.1%), b_tokenize: 6 (0.0%), b_tok_get_all: 6 (0.0%), b_comp_prob: 2.9 (0.0%), b_tok_touch_all: 2.2 (0.0%), b_finish: 1.00 (0.0%), tests_pri_0: 198 (1.3%), check_dkim_signature: 0.86 (0.0%), check_dkim_adsp: 4.9 (0.0%), tests_pri_500: 14781 (98.3%), poll_dns_idle: 14770 (98.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RFC][PATCH 07/11] signal: Deliver group signals via PIDTYPE_TGID not PIDTYPE_PID 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 Oleg Nesterov writes: > On 07/10, Eric W. Biederman wrote: >> >> Now that we can make the distinction use PIDTYPE_TGID rather than >> PIDTYPE_PID. > > Wai, wait, this doesn't look right... > >> There is no immediate effect as they point point at the >> same task, > > How so? pid_task(pid, PIDTYPE_TGID) will return NULL unless this pid is actually > a group leader's pid, > >> --- a/kernel/signal.c >> +++ b/kernel/signal.c >> @@ -1315,7 +1315,7 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid) >> >> for (;;) { >> rcu_read_lock(); >> - p = pid_task(pid, PIDTYPE_PID); >> + p = pid_task(pid, PIDTYPE_TGID); >> if (p) >> error = group_send_sig_info(sig, info, p); > > So, currently kill(pid_nr) always works, even if pid_nr is a sub-thread's tid. > > After this change kill(2) will always fail with -ESRCH in this case. > > Or I am totally confused? No you are not. That does at least need to be documented in the description of the patch. In practice since glibc does not make thread id's available I don't expect anyone relies on this behavior. Since no one relies on it we can change it without creating a regression. I believe this can be described as fixing a bug that we were not able to before the introduction of PIDTYPE_TGID. I will update my change description. Eric