Skip to content

Commit

Permalink
sysctl vm.objects/vm.swap_objects: do not fill vnode info if jailed
Browse files Browse the repository at this point in the history
Reported by:	Shawn Webb via markj
Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
  • Loading branch information
kostikbel committed Jan 16, 2024
1 parent 296a4cb commit 38f5f2a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sys/vm/vm_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include <sys/systm.h>
#include <sys/blockcount.h>
#include <sys/cpuset.h>
#include <sys/jail.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mman.h>
Expand Down Expand Up @@ -2515,6 +2516,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
vm_page_t m;
u_long sp;
int count, error;
bool want_path;

if (req->oldptr == NULL) {
/*
Expand All @@ -2533,6 +2535,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
count * 11 / 10));
}

want_path = !(swap_only || jailed(curthread->td_ucred));
kvo = malloc(sizeof(*kvo), M_TEMP, M_WAITOK | M_ZERO);
error = 0;

Expand Down Expand Up @@ -2584,7 +2587,8 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
freepath = NULL;
fullpath = "";
vp = NULL;
kvo->kvo_type = vm_object_kvme_type(obj, swap_only ? NULL : &vp);
kvo->kvo_type = vm_object_kvme_type(obj, want_path ? &vp :
NULL);
if (vp != NULL) {
vref(vp);
} else if ((obj->flags & OBJ_ANON) != 0) {
Expand Down

0 comments on commit 38f5f2a

Please sign in to comment.