Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F161090012
D24398.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D24398.diff
View Options
Index: head/sys/kern/uipc_shm.c
===================================================================
--- head/sys/kern/uipc_shm.c
+++ head/sys/kern/uipc_shm.c
@@ -1136,23 +1136,28 @@
/*
* If FWRITE's set, we can allow VM_PROT_WRITE unless it's a shared
- * mapping with a write seal applied.
+ * mapping with a write seal applied. Private mappings are always
+ * writeable.
*/
- if ((fp->f_flag & FWRITE) != 0 && ((flags & MAP_SHARED) == 0 ||
- (shmfd->shm_seals & F_SEAL_WRITE) == 0))
+ if ((flags & MAP_SHARED) == 0) {
+ cap_maxprot |= VM_PROT_WRITE;
maxprot |= VM_PROT_WRITE;
+ writecnt = false;
+ } else {
+ if ((fp->f_flag & FWRITE) != 0 &&
+ (shmfd->shm_seals & F_SEAL_WRITE) == 0)
+ maxprot |= VM_PROT_WRITE;
+ writecnt = (prot & VM_PROT_WRITE) != 0;
+ if (writecnt && (shmfd->shm_seals & F_SEAL_WRITE) != 0) {
+ error = EPERM;
+ goto out;
+ }
- writecnt = (flags & MAP_SHARED) != 0 && (prot & VM_PROT_WRITE) != 0;
-
- if (writecnt && (shmfd->shm_seals & F_SEAL_WRITE) != 0) {
- error = EPERM;
- goto out;
- }
-
- /* Don't permit shared writable mappings on read-only descriptors. */
- if (writecnt && (maxprot & VM_PROT_WRITE) == 0) {
- error = EACCES;
- goto out;
+ /* Don't permit shared writable mappings on read-only descriptors. */
+ if (writecnt && (maxprot & VM_PROT_WRITE) == 0) {
+ error = EACCES;
+ goto out;
+ }
}
maxprot &= cap_maxprot;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 1, 11:34 AM (11 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34557947
Default Alt Text
D24398.diff (1 KB)
Attached To
Mode
D24398: Relax restrictions on private mappings of POSIX shm objects.
Attached
Detach File
Event Timeline
Log In to Comment