diff options
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/swap_pager.c | 10 | ||||
-rw-r--r-- | sys/vm/vm_mmap.c | 11 |
2 files changed, 11 insertions, 10 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 85ea18e..7b7e5d1 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/conf.h> #include <sys/kernel.h> +#include <sys/priv.h> #include <sys/proc.h> #include <sys/bio.h> #include <sys/buf.h> @@ -1966,11 +1967,11 @@ swapon(struct thread *td, struct swapon_args *uap) struct nameidata nd; int error; - mtx_lock(&Giant); - error = suser(td); + error = priv_check(td, PRIV_SWAPON); if (error) - goto done2; + return (error); + mtx_lock(&Giant); while (swdev_syscall_active) tsleep(&swdev_syscall_active, PUSER - 1, "swpon", 0); swdev_syscall_active = 1; @@ -2009,7 +2010,6 @@ swapon(struct thread *td, struct swapon_args *uap) done: swdev_syscall_active = 0; wakeup_one(&swdev_syscall_active); -done2: mtx_unlock(&Giant); return (error); } @@ -2105,7 +2105,7 @@ swapoff(struct thread *td, struct swapoff_args *uap) struct swdevt *sp; int error; - error = suser(td); + error = priv_check(td, PRIV_SWAPOFF); if (error) return (error); diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 933080e..ff1ba18 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mutex.h> #include <sys/sysproto.h> #include <sys/filedesc.h> +#include <sys/priv.h> #include <sys/proc.h> #include <sys/resource.h> #include <sys/resourcevar.h> @@ -684,7 +685,7 @@ madvise(td, uap) * "immortal." */ if (uap->behav == MADV_PROTECT) { - error = suser(td); + error = priv_check(td, PRIV_VM_MADV_PROTECT); if (error == 0) { p = td->td_proc; PROC_LOCK(p); @@ -951,7 +952,7 @@ mlock(td, uap) vm_size_t npages, size; int error; - error = suser(td); + error = priv_check(td, PRIV_VM_MLOCK); if (error) return (error); addr = (vm_offset_t)uap->addr; @@ -1016,7 +1017,7 @@ mlockall(td, uap) } PROC_UNLOCK(td->td_proc); #else - error = suser(td); + error = priv_check(td, PRIV_VM_MLOCK); if (error) return (error); #endif @@ -1061,7 +1062,7 @@ munlockall(td, uap) int error; map = &td->td_proc->p_vmspace->vm_map; - error = suser(td); + error = priv_check(td, PRIV_VM_MUNLOCK); if (error) return (error); @@ -1095,7 +1096,7 @@ munlock(td, uap) vm_size_t size; int error; - error = suser(td); + error = priv_check(td, PRIV_VM_MUNLOCK); if (error) return (error); addr = (vm_offset_t)uap->addr; |