Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178038964
D58080.1795821940.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
749 B
Referenced Files
None
Subscribers
None
D58080.1795821940.diff
View Options
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1329,6 +1329,20 @@
flags |= O_RESOLVE_BENEATH;
else
flags &= ~O_RESOLVE_BENEATH;
+ /*
+ * If td_dupfd > 0 it contains the f_flag of the
+ * original file descriptor. Ensure the new open does
+ * not gain additional access rights.
+ */
+ if (td->td_dupfd > 0) {
+ u_int omask = td->td_dupfd & (FREAD | FWRITE);
+ u_int nmask = fp->f_flag & (FREAD | FWRITE);
+ if ((omask & nmask) != nmask) {
+ td->td_dupfd = -1;
+ error = EACCES;
+ goto bad;
+ }
+ }
td->td_dupfd = -1;
error = finstall_refed(td, fp, &indx, flags, fcaps);
/* On success finstall_refed() consumes fcaps. */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 27, 11:25 PM (18 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42047770
Default Alt Text
D58080.1795821940.diff (749 B)
Attached To
Mode
D58080: fdescfs: enforce access rights on nodup reopens
Attached
Detach File
Event Timeline