Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156661906
D21119.id60314.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
D21119.id60314.diff
View Options
Index: sys/compat/cloudabi/cloudabi_fd.c
===================================================================
--- sys/compat/cloudabi/cloudabi_fd.c
+++ sys/compat/cloudabi/cloudabi_fd.c
@@ -94,7 +94,8 @@
case CLOUDABI_FILETYPE_SHARED_MEMORY:
cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_FTRUNCATE,
CAP_MMAP_RWX);
- return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, &fcaps));
+ return (kern_shm_open(td, SHM_ANON, O_RDWR | O_CLOEXEC, 0,
+ &fcaps));
default:
return (EINVAL);
}
Index: sys/kern/uipc_shm.c
===================================================================
--- sys/kern/uipc_shm.c
+++ sys/kern/uipc_shm.c
@@ -729,7 +729,14 @@
fdp = td->td_proc->p_fd;
cmode = (mode & ~fdp->fd_cmask) & ACCESSPERMS;
- error = falloc_caps(td, &fp, &fd, O_CLOEXEC, fcaps);
+ /*
+ * shm_open(2) created shm should always have O_CLOEXEC set, as mandated
+ * by POSIX. We allow it to be unset here so that an in-kernel
+ * interface may be written as a thin layer around shm, optionally not
+ * setting CLOEXEC. For shm_open(2), O_CLOEXEC is set unconditionally
+ * in sys_shm_open() to keep this implementation compliant.
+ */
+ error = falloc_caps(td, &fp, &fd, flags & O_CLOEXEC, fcaps);
if (error)
return (error);
@@ -844,7 +851,8 @@
sys_shm_open(struct thread *td, struct shm_open_args *uap)
{
- return (kern_shm_open(td, uap->path, uap->flags, uap->mode, NULL));
+ return (kern_shm_open(td, uap->path, uap->flags | O_CLOEXEC, uap->mode,
+ NULL));
}
int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 16, 12:22 PM (5 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33129425
Default Alt Text
D21119.id60314.diff (1 KB)
Attached To
Mode
D21119: kern_shm_open: push O_CLOEXEC into caller controller
Attached
Detach File
Event Timeline
Log In to Comment