gcore: Don't hardcode VM write permissions.
This ensures read-only PT_LOAD segments are not marked as writable in the phdr flags. Reviewed by: markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D35398
This commit is contained in:
parent
b831865fe3
commit
81c857dd7e
@ -624,7 +624,9 @@ readmap(pid_t pid)
|
|||||||
errx(1, "out of memory");
|
errx(1, "out of memory");
|
||||||
ent->start = (vm_offset_t)kve->kve_start;
|
ent->start = (vm_offset_t)kve->kve_start;
|
||||||
ent->end = (vm_offset_t)kve->kve_end;
|
ent->end = (vm_offset_t)kve->kve_end;
|
||||||
ent->protection = VM_PROT_READ | VM_PROT_WRITE;
|
ent->protection = VM_PROT_READ;
|
||||||
|
if ((kve->kve_protection & KVME_PROT_WRITE) != 0)
|
||||||
|
ent->protection |= VM_PROT_WRITE;
|
||||||
if ((kve->kve_protection & KVME_PROT_EXEC) != 0)
|
if ((kve->kve_protection & KVME_PROT_EXEC) != 0)
|
||||||
ent->protection |= VM_PROT_EXECUTE;
|
ent->protection |= VM_PROT_EXECUTE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user