Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2580340imm; Mon, 16 Jul 2018 10:18:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfopFMArKQql9aeD30tBmWGGd93u3LnhSqFYAWxZgDTUVrTjgpDLxjakpSOegYDueKA4mc+ X-Received: by 2002:a62:be03:: with SMTP id l3-v6mr11242030pff.138.1531761527878; Mon, 16 Jul 2018 10:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531761527; cv=none; d=google.com; s=arc-20160816; b=Oe8cEtAKB0PlErVXy5tNr8pD8h0N+ylL0i/mr/YEQIK+StRKgojX9Y6jZDeLg8DoZX LJCwgE2SdYPpmW59i+cAR3A23Db91+1QqaVsO3ss77yfrxBJw+ZfjU+5nXIrKR/PkD6I BC9u4e54jGLCGlRCH7I+cfxwl/pX5iwi47DmdA18tyta5YcEBH/e/PqDKTXnZ5n0kfS5 uKXyadk9ats+x15F/HlPrWTntyxhvFvSK48rD1i2pv/gju5GU/tXatHfobkW/+DVN+ZX HV3lTSBllEv6TdA4HXTtTv8MWdqCq/3g/jgeF7FUQpfZC5ETbpdBIBialwiQyBslOTNZ v5AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=yH3vDhVizbSYESjPGnLyyju4VuKGhQU3EBUpH+aRj1s=; b=ajkxVUv6CrnKhBNq8QJ7F+1vm37i91fg8Dk58WrI12l2p2GCTvszplqhMckvSHcDPB MVwn5Ru9lMmaTI4EbjZwwMcfctPvzYGRiLAc+SD46fgzCsKmn0I8zq+TtIpkmVuV2CGq wiTE1jRS7O8rUoY8E2hZu8HVCVTl+RLgsP9bfO6dABhaWlr+/6EKhpI1prHQNmhZmu7L eQz/sMwsII7QnTkMRZEaGnP9I2EykHbpIieEHvtY4GTT3t5XzgENPjQghtcpbk0hpRDv 148YCyPQJY9BOVzuUOdaougJ5W/tSInjzEjdiawlHhtWuvLY8XUtJIfsvEcKlX/hwlPE Y+Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hBs90ARH; 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 r25-v6si28964225pge.104.2018.07.16.10.18.32; Mon, 16 Jul 2018 10:18:47 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hBs90ARH; 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 S1728639AbeGPRp7 (ORCPT + 99 others); Mon, 16 Jul 2018 13:45:59 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:35888 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727652AbeGPRp7 (ORCPT ); Mon, 16 Jul 2018 13:45:59 -0400 Received: by mail-io0-f193.google.com with SMTP id k3-v6so38526508iog.3 for ; Mon, 16 Jul 2018 10:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yH3vDhVizbSYESjPGnLyyju4VuKGhQU3EBUpH+aRj1s=; b=hBs90ARH7A/vsbjBLIxGTTbrm2Lze9dY9K6r/rM3KRlv49N4Q0sJz3M+a185QRxRJf c7dEZ+nHpyCMQ0FXYtdjKbiXZ3ICbwkJV9gtEfnEQ47WCG1uWYuKMymHNSHkNEgNJdQS lPQZaLrf5qnO0fJk++2C9jrOo6whYNhFijXaw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yH3vDhVizbSYESjPGnLyyju4VuKGhQU3EBUpH+aRj1s=; b=rP28yQQMY1K7xdTOopUmJiKG5BJAAURVDkEjNSTTtIcLk0Zn9sScWZZ22ywXBsv79e /rZ/f+0dk3zK/o9XsmZJVKIP8o7mcaw2gg/s+RLEKo0DfhCD7LvKm9F0NTc56BLi8taN LgIr7AbcCTfmvr66AgkE4tdAStaSOVLFu74CODlg5UHFWSxF1UY4zIPnt2RM0lW9l28c PGN3d/1d8M/ju2rT2C/Mtuo1WBZ94pIjYB1bwuTfQ1Ct5WrQdhZUxSgo5ifJWsn9qqn1 1BQ1ImOQrLyUuXwxI1pyfMvSgyBz1EfVxVtleOLbVKa35o1KNkp/BWwAdRX71i0N++UO 5IWA== X-Gm-Message-State: AOUpUlGg/qLMwrFMDuADZuN5dM1Aeou/KRsscdsFajRIxHut2ifgOYb/ +A7mLM4R11vBE1jmQGQEY/V1wI8wBYSFzAkxF58= X-Received: by 2002:a6b:274f:: with SMTP id n76-v6mr42223087ion.259.1531761457698; Mon, 16 Jul 2018 10:17:37 -0700 (PDT) MIME-Version: 1.0 References: <877em2jxyr.fsf_-_@xmission.com> <20180711024459.10654-7-ebiederm@xmission.com> <20180716125144.GA18262@redhat.com> <8736wjtetv.fsf@xmission.com> In-Reply-To: <8736wjtetv.fsf@xmission.com> From: Linus Torvalds Date: Mon, 16 Jul 2018 10:17:26 -0700 Message-ID: Subject: Re: [RFC][PATCH 07/11] signal: Deliver group signals via PIDTYPE_TGID not PIDTYPE_PID To: "Eric W. Biederman" Cc: Oleg Nesterov , Andrew Morton , Linux Kernel Mailing List , Wen Yang , majiang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 16, 2018 at 7:50 AM Eric W. Biederman wrote: > > 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. Maybe. However, possibly not. The thing is, glibc wasn't the original or only use of our threads. In fact, there are people out there that use clone() directly, without using it for posix threading. And Oleg was right to notice this, because the traditional model was literally to just use "kill()" on the pid returned from clone(). So the semantics of Linux kill() really is to kill the thread, not the group leader. glibc's implementation of pthreads is not the only model out there. Now, it is possible that at none of the legacy uses use CLONE_THREAD and thus aren't affected (because tgid will always be pid). So maybe nobody notices. But we really have three different 'kill' system calls: - the original 'kill' system call (#37 on x86-32). This looks up the thread ID, but signals the *group*. - tkill (#238) This looks up the thread, and signals the specific thread. - tgkill (#270) This looks up the tgid, and signals the group. Modern glibc will not even use the original 'kill()' at all, I think. But it's the legacy behavior. So I do think Oleg is right. We should be careful. You'll not notice breakage on a modern distro, but you might easily break old code. Linus