From owner-svn-src-all@freebsd.org Wed Jul 1 09:21:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B083F348D8E; Wed, 1 Jul 2020 09:21:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49xbMQ0nssz4BbP; Wed, 1 Jul 2020 09:21:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id 0619LNt9072763 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 1 Jul 2020 12:21:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0619LNt9072763 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id 0619LND1072762; Wed, 1 Jul 2020 12:21:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Jul 2020 12:21:23 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362829 - head/sys/compat/linuxkpi/common/src Message-ID: <20200701092123.GI32126@kib.kiev.ua> References: <202007010823.0618Nvcu028770@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202007010823.0618Nvcu028770@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 49xbMQ0nssz4BbP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2020 09:21:38 -0000 On Wed, Jul 01, 2020 at 08:23:57AM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Wed Jul 1 08:23:57 2020 > New Revision: 362829 > URL: https://svnweb.freebsd.org/changeset/base/362829 > > Log: > The "pid" field in the LinuxKPI task struct is typically set to the thread ID > and not the process ID. Make sure the linux_task_exiting() function uses tdfind() > to lookup the BSD procedure structure pointer by the "pid" field, and only > fallback to pfind() when no match is found! This makes linux_task_exiting() > in line with the rest of the code. > > Differential Revision: https://reviews.freebsd.org/D25509 > Submitted by: Greg V > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/compat/linuxkpi/common/src/linux_current.c > > Modified: head/sys/compat/linuxkpi/common/src/linux_current.c > ============================================================================== > --- head/sys/compat/linuxkpi/common/src/linux_current.c Wed Jul 1 05:59:08 2020 (r362828) > +++ head/sys/compat/linuxkpi/common/src/linux_current.c Wed Jul 1 08:23:57 2020 (r362829) > @@ -219,11 +219,21 @@ linux_get_pid_task(pid_t pid) > bool > linux_task_exiting(struct task_struct *task) > { > + struct thread *td; > struct proc *p; > bool ret; > > ret = false; > - p = pfind(task->pid); > + > + /* try to find corresponding thread */ > + td = tdfind(task->pid, -1); > + if (td != NULL) { > + p = td->td_proc; > + } else { > + /* try to find corresponding procedure */ > + p = pfind(task->pid); > + } > + > if (p != NULL) { > if ((p->p_flag & P_WEXIT) != 0) > ret = true; It should be expressed as pget(pid, 0); instead of duplicating.