Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1058923rwb; Thu, 22 Sep 2022 09:34:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7a0Ih2OgiXfn1v1V5xQkhh2fiHeV71OHCIIqwsS5+YxJvqrLBM6VLKsx6JzsoYY589aTj5 X-Received: by 2002:a05:6402:410:b0:451:ea13:4ed7 with SMTP id q16-20020a056402041000b00451ea134ed7mr4442593edv.262.1663864458076; Thu, 22 Sep 2022 09:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663864458; cv=none; d=google.com; s=arc-20160816; b=TXcWuy8FD9vFqGBkvorED/E3yuEJSmAqZ5j/mBrUo7zStDLAvbOCaMBU0ye5QR+FdL Omoal3o3gr2qFFXe5y/P2cTjYXr+Bhv6WqwpOP1Coao5yZsm0p7k1AMJC4iGcPHkx8zI fmCGdDGW0pmf1bWc69s7flvXiVyl9kpsBnzUo4KEinPC69ampSYOiB2jez5LxMqjnGuD aLxrRYodrF2AY08VHgFZ13fgXAVJD1BuMNvj79lsPufW0YucJ8SHt+LwoQfpNy85xDH0 BX3Dj7jANzYpz+7YyVPLj5feyUif3P11JEKilora+MltQTufUSOh/3WXAfARRZ289wBp 6Xew== 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=U3bBMoOK6d8EV1pXlkFT2W58jpWxMMiMQxeX92lEAA4=; b=ZX18FnU59Q6ZfVr7qckGhqjBMzCp4JBTqm9Wau0aa28VmKA/Xq0Q0bRzIxMDrt2wpq Jywzs6MIR4vjDlk+4QMXyVT8EMPipBld2tHPDPlhq4Fd6pzdIOOPA78mnP7nG5VelEAU GPhtYZwxS9HZnhBO6+fqOEfzJ4kbnZ+aO7wDgP1DX20xRI2OroBOErv2wBj4i5/r/TMR 5FtXGF9iAp5WG9m5osGDWCQMsweNS3QINyEc2AFl7z52n1ZB1uY8rynnvM1Be+P+tz46 GSVyLgLFl5VoV12sdx8peZMJJjXcwTypA3lG9VJGzhI3xxeCr8yRnB1ixFdedvzkuLK5 sDLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a170906924d00b00751a4675a99si5009608ejx.108.2022.09.22.09.33.51; Thu, 22 Sep 2022 09:34:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230419AbiIVPdj (ORCPT + 99 others); Thu, 22 Sep 2022 11:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231578AbiIVPda (ORCPT ); Thu, 22 Sep 2022 11:33:30 -0400 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 628C1FE046; Thu, 22 Sep 2022 08:33:29 -0700 (PDT) Received: from in01.mta.xmission.com ([166.70.13.51]:35806) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1obOCd-006cog-NE; Thu, 22 Sep 2022 09:33:27 -0600 Received: from ip68-110-29-46.om.om.cox.net ([68.110.29.46]:37646 helo=email.froward.int.ebiederm.org.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 1obOCc-00B3Dh-Re; Thu, 22 Sep 2022 09:33:27 -0600 From: "Eric W. Biederman" To: cambda@linux.alibaba.com Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Xuan Zhuo , Dust Li , Tony Lu References: <69E17223-F0CA-4A4C-AAD7-065D6E6266D9@linux.alibaba.com> Date: Thu, 22 Sep 2022 10:33:20 -0500 In-Reply-To: <69E17223-F0CA-4A4C-AAD7-065D6E6266D9@linux.alibaba.com> (cambda@linux.alibaba.com's message of "Thu, 22 Sep 2022 17:11:12 +0800") Message-ID: <87k05v5sqn.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1obOCc-00B3Dh-Re;;;mid=<87k05v5sqn.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.110.29.46;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX18/4hzMM+SNTsxDzbpcPfCVlVvmPeUFjts= X-SA-Exim-Connect-IP: 68.110.29.46 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;cambda@linux.alibaba.com X-Spam-Relay-Country: X-Spam-Timing: total 333 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 7 (2.2%), b_tie_ro: 6 (1.9%), parse: 0.78 (0.2%), extract_message_metadata: 2.9 (0.9%), get_uri_detail_list: 0.94 (0.3%), tests_pri_-1000: 3.0 (0.9%), tests_pri_-950: 1.04 (0.3%), tests_pri_-900: 0.79 (0.2%), tests_pri_-90: 145 (43.5%), check_bayes: 143 (43.1%), b_tokenize: 4.7 (1.4%), b_tok_get_all: 4.1 (1.2%), b_comp_prob: 1.64 (0.5%), b_tok_touch_all: 130 (39.0%), b_finish: 0.87 (0.3%), tests_pri_0: 156 (47.0%), check_dkim_signature: 0.41 (0.1%), check_dkim_adsp: 2.1 (0.6%), poll_dns_idle: 0.48 (0.1%), tests_pri_10: 1.96 (0.6%), tests_pri_500: 7 (2.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: Syscall kill() can send signal to thread ID 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 cambda@linux.alibaba.com writes: > I found syscall kill() can send signal to a thread id, which is > not the TGID. But the Linux manual page kill(2) said: > > "The kill() system call can be used to send any signal to any > process group or process." > > And the Linux manual page tkill(2) said: > > "tgkill() sends the signal sig to the thread with the thread ID > tid in the thread group tgid. (By contrast, kill(2) can be used > to send a signal only to a process (i.e., thread group) as a > whole, and the signal will be delivered to an arbitrary thread > within that process.)" > > I don't know whether the meaning of this 'process' should be > the TGID? Because I found kill(tid, 0) will return ESRCH on FreeBSD, > while Linux sends signal to the thread group that the thread belongs > to. > > If this is as expected, should we add a notice to the Linux manual > page? Because it's a syscall and the pids not equal to tgid are not > listed under /proc. This may be a little confusing, I guess. How did you come across this? Were you just experimenting? I am wondering if you were tracking a bug, or a portability problem or something else. If the current behavior is causing problems in some way instead of just being a detail that no one really cares about either way it would be worth considering if we want to maintain the current behavior. Eric