vm: use new capsicum helpers

This commit is contained in:
mjg 2020-02-15 01:29:07 +00:00
parent b25754c877
commit e6a4b66e3b

View File

@ -389,15 +389,15 @@ kern_mmap_fpcheck(struct thread *td, uintptr_t addr0, size_t len, int prot,
* rights, but also return the maximum rights to be combined
* with maxprot later.
*/
cap_rights_init(&rights, CAP_MMAP);
cap_rights_init_one(&rights, CAP_MMAP);
if (prot & PROT_READ)
cap_rights_set(&rights, CAP_MMAP_R);
cap_rights_set_one(&rights, CAP_MMAP_R);
if ((flags & MAP_SHARED) != 0) {
if (prot & PROT_WRITE)
cap_rights_set(&rights, CAP_MMAP_W);
cap_rights_set_one(&rights, CAP_MMAP_W);
}
if (prot & PROT_EXEC)
cap_rights_set(&rights, CAP_MMAP_X);
cap_rights_set_one(&rights, CAP_MMAP_X);
error = fget_mmap(td, fd, &rights, &cap_maxprot, &fp);
if (error != 0)
goto done;