vhost-vdpa: honor CAP_IPC_LOCK
Subsystems (5)
PATCH v2 1/1 vhost-vdpa: honor CAP_IPC_LOCK
When CAP_IPC_LOCK is set we should not check locked memory against rlimit as what has been implemented in mlock() and documented in Documentation/admin-guide/perf-security.rst:
"RLIMIT_MEMLOCK and perf_event_mlock_kb resource constraints are ignored for processes with the CAP_IPC_LOCK capability.
"
Fixes 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
Signed-off-by Jason Wang <[email protected]>
--- drivers/vhost/vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vhost/vdpa.c +2 -1
@@ -638,7 +638,8 @@ static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v,mmap_read_lock (dev->mm); lock_limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; -if (npages +atomic64_read (&dev->mm->pinned_vm) > lock_limit) { +if (!capable (CAP_IPC_LOCK ) && + (npages +atomic64_read (&dev->mm->pinned_vm) > lock_limit)) { ret = -ENOMEM ; goto unlock; }
Signature · 6 lines
2.18.1 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization