git: 7a9423d6f360 - main - procstat_getfiles_sysctl: do not require non-null ki_fd

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 02 Dec 2021 22:52:58 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=7a9423d6f360e3758ca67fbb25d309140ea93670

commit 7a9423d6f360e3758ca67fbb25d309140ea93670
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-12-02 18:03:01 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-12-02 22:52:49 +0000

    procstat_getfiles_sysctl: do not require non-null ki_fd
    
    ki_fd is legitimately NULL when 32bit process requests process data
    from 64bit host kernel.  The field is not used by the code for sysctl
    case;  procstat_getfiles_kvm() checks ki_fd.
    
    PR:     260174
    Reported by:    Damjan Jovanovic <damjan.jov@gmail.com>
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 lib/libprocstat/libprocstat.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index b50875db1637..850d37598423 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -865,8 +865,6 @@ procstat_getfiles_sysctl(struct procstat *procstat, struct kinfo_proc *kp,
 	cap_rights_t cap_rights;
 
 	assert(kp);
-	if (kp->ki_fd == NULL)
-		return (NULL);
 	switch (procstat->type) {
 	case PROCSTAT_SYSCTL:
 		files = kinfo_getfile(kp->ki_pid, &cnt);