From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C57DC433E6 for ; Thu, 11 Mar 2021 16:38:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE91864FAA for ; Thu, 11 Mar 2021 16:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229459AbhCKQhg (ORCPT ); Thu, 11 Mar 2021 11:37:36 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:52756 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbhCKQhY (ORCPT ); Thu, 11 Mar 2021 11:37:24 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lKOJP-006ZlW-QV; Thu, 11 Mar 2021 09:37:23 -0700 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=fess.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lKOJP-0031iH-0U; Thu, 11 Mar 2021 09:37:23 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov Cc: Jim Newsome , Andrew Morton , Christian Brauner , linux-kernel@vger.kernel.org References: <20210309203919.15920-1-jnewsome@torproject.org> <20210311150820.GA15552@redhat.com> Date: Thu, 11 Mar 2021 10:37:27 -0600 In-Reply-To: <20210311150820.GA15552@redhat.com> (Oleg Nesterov's message of "Thu, 11 Mar 2021 16:08:21 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1lKOJP-0031iH-0U;;;mid=;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18DeM/j9n2X2ms1qI2KqEBrWyWfZAhqUGo= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH v3] do_wait: make PIDTYPE_PID case O(1) instead of O(n) X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov writes: > On 03/10, Eric W. Biederman wrote: >> >> Jim Newsome writes: >> >> > +static int do_wait_pid(struct wait_opts *wo) >> > +{ >> > + struct task_struct *target = pid_task(wo->wo_pid, PIDTYPE_PID); >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> This is subtle change in behavior. >> >> Today on the task->children list we only place thread group leaders. > > Aaah, yes, thanks Eric! > >> So the code either needs a thread_group_leader filter on target before >> the ptrace=0 case or we need to use "pid_task(wo->wo_pid, PIDTYPE_TGID)" >> and "pid_task(wo->wo_pid, PIDTYPE_PID)" for the "ptrace=1" case. > > Agreed, > >> I would like to make thread_group_leaders go away > > Hmm, why? Mostly because we have class of very nasty bugs to fix because code thinks one thread is special. There has been and I think still is code that mishandles zombie thread group leaders. Particularly nasty are zombie thread group leaders after userspace has called setresuid in a way that changes signal permissions. Eric