mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-02 23:43:25 +00:00
shmat: If VM_PROT_READ_IS_EXEC is defined and prot includes VM_PROT_READ,
VM_PROT_EXECUTE must be added to prot before calling vm_map_find. Without this change, an mprotect on a shmat'ed region fails (when it shouldn't). This bug was reported Feb 28 by Brooks Davis <brooks@one-eyed-alien.net> on -hackers. Reviewed by: bde Approved by: jkh
This commit is contained in:
parent
643b70ec9d
commit
af25d10c91
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57884
@ -249,7 +249,11 @@ shmat(p, uap)
|
||||
if (i >= shminfo.shmseg)
|
||||
return EMFILE;
|
||||
size = round_page(shmseg->shm_segsz);
|
||||
#ifdef VM_PROT_READ_IS_EXEC
|
||||
prot = VM_PROT_READ | VM_PROT_EXECUTE;
|
||||
#else
|
||||
prot = VM_PROT_READ;
|
||||
#endif
|
||||
if ((uap->shmflg & SHM_RDONLY) == 0)
|
||||
prot |= VM_PROT_WRITE;
|
||||
flags = MAP_ANON | MAP_SHARED;
|
||||
|
Loading…
Reference in New Issue
Block a user