Date: Thu, 23 Jul 2026 23:51:12 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 8f320c2bc473 - main - getpgrp(2), getsid(2): allow to call on zombies Message-ID: <6a62a8f0.43549.5b8839c3@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8f320c2bc473a775ea9a55d17fa61f729e593867 commit 8f320c2bc473a775ea9a55d17fa61f729e593867 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-07-22 09:36:17 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-07-23 23:50:13 +0000 getpgrp(2), getsid(2): allow to call on zombies Also be more protective in getsid(). Reported by: arrowd Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differrential revision: https://reviews.freebsd.org/D58393 --- sys/kern/kern_prot.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index a223a7720844..5aa7fcf7c653 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -196,7 +196,7 @@ sys_getpgid(struct thread *td, struct getpgid_args *uap) p = td->td_proc; PROC_LOCK(p); } else { - p = pfind(uap->pid); + p = pfind_any(uap->pid); if (p == NULL) return (ESRCH); error = p_cansee(td, p); @@ -231,11 +231,12 @@ kern_getsid(struct thread *td, pid_t pid) struct proc *p; int error; + error = 0; if (pid == 0) { p = td->td_proc; PROC_LOCK(p); } else { - p = pfind(pid); + p = pfind_any(pid); if (p == NULL) return (ESRCH); error = p_cansee(td, p); @@ -244,9 +245,12 @@ kern_getsid(struct thread *td, pid_t pid) return (error); } } - td->td_retval[0] = p->p_session->s_sid; + if (p->p_session != NULL) + td->td_retval[0] = p->p_session->s_sid; + else + error = EINVAL; PROC_UNLOCK(p); - return (0); + return (error); } #ifndef _SYS_SYSPROTO_H_home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a62a8f0.43549.5b8839c3>
