Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 May 2024 00:26:43 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6b667b46ab19 - stable/13 - kcmp_pget(): add an assert that we did not hold the current process
Message-ID:  <202405030026.4430QhtP097741@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=6b667b46ab192d00a280ffdab60ff523a88495e4

commit 6b667b46ab192d00a280ffdab60ff523a88495e4
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-04-29 18:51:53 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-05-03 00:26:25 +0000

    kcmp_pget(): add an assert that we did not hold the current process
    
    (cherry picked from commit 1e01650a787028fd558e8cb709c232e335fc2cd9)
---
 sys/kern/sys_generic.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 32f137f0cb4c..f2d099f7a0c4 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -2018,11 +2018,15 @@ kcmp_cmp(uintptr_t a, uintptr_t b)
 static int
 kcmp_pget(struct thread *td, pid_t pid, struct proc **pp)
 {
+	int error;
+
 	if (pid == td->td_proc->p_pid) {
 		*pp = td->td_proc;
 		return (0);
 	}
-	return (pget(pid, PGET_CANDEBUG | PGET_NOTWEXIT | PGET_HOLD, pp));
+	error = pget(pid, PGET_CANDEBUG | PGET_NOTWEXIT | PGET_HOLD, pp);
+	MPASS(*pp != td->td_proc);
+	return (error);
 }
 
 int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405030026.4430QhtP097741>