Use traditional 'p' local to designate td->td_proc in kern_mmap.
Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D20795
This commit is contained in:
parent
f1bb9412c2
commit
3730695151
@ -187,6 +187,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t len, int prot, int flags,
|
||||
{
|
||||
struct vmspace *vms;
|
||||
struct file *fp;
|
||||
struct proc *p;
|
||||
vm_offset_t addr;
|
||||
vm_size_t pageoff, size;
|
||||
vm_prot_t cap_maxprot;
|
||||
@ -199,6 +200,9 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t len, int prot, int flags,
|
||||
prot = PROT_EXTRACT(prot);
|
||||
if (max_prot != 0 && (max_prot & prot) != prot)
|
||||
return (EINVAL);
|
||||
|
||||
p = td->td_proc;
|
||||
|
||||
/*
|
||||
* Always honor PROT_MAX if set. If not, default to all
|
||||
* permissions unless we're implying maximum permissions.
|
||||
@ -209,7 +213,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t len, int prot, int flags,
|
||||
max_prot = (imply_prot_max && prot != PROT_NONE) ?
|
||||
prot : _PROT_ALL;
|
||||
|
||||
vms = td->td_proc->p_vmspace;
|
||||
vms = p->p_vmspace;
|
||||
fp = NULL;
|
||||
AUDIT_ARG_FD(fd);
|
||||
addr = addr0;
|
||||
@ -229,7 +233,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t len, int prot, int flags,
|
||||
* pos.
|
||||
*/
|
||||
if (!SV_CURPROC_FLAG(SV_AOUT)) {
|
||||
if ((len == 0 && curproc->p_osrel >= P_OSREL_MAP_ANON) ||
|
||||
if ((len == 0 && p->p_osrel >= P_OSREL_MAP_ANON) ||
|
||||
((flags & MAP_ANON) != 0 && (fd != -1 || pos != 0)))
|
||||
return (EINVAL);
|
||||
} else {
|
||||
@ -375,7 +379,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t len, int prot, int flags,
|
||||
if (error != 0)
|
||||
goto done;
|
||||
if ((flags & (MAP_SHARED | MAP_PRIVATE)) == 0 &&
|
||||
td->td_proc->p_osrel >= P_OSREL_MAP_FSTRICT) {
|
||||
p->p_osrel >= P_OSREL_MAP_FSTRICT) {
|
||||
error = EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user