Date: Mon, 13 Jul 2020 15:37:59 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r363153 - stable/11/sys/compat/linuxkpi/common/src Message-ID: <202007131537.06DFbxx3021506@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Jul 13 15:37:59 2020 New Revision: 363153 URL: https://svnweb.freebsd.org/changeset/base/363153 Log: MFC r362829: 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 <greg@unrelenting.technology> Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/src/linux_current.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_current.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_current.c Mon Jul 13 15:36:57 2020 (r363152) +++ stable/11/sys/compat/linuxkpi/common/src/linux_current.c Mon Jul 13 15:37:59 2020 (r363153) @@ -218,11 +218,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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007131537.06DFbxx3021506>