Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178032320
D58081.1795808392.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
870 B
Referenced Files
None
Subscribers
None
D58081.1795808392.diff
View Options
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -3344,7 +3344,6 @@
error = ENOTDIR;
goto out_free;
}
- vrefact(vp);
/*
* XXX does not check for VDIR, handled by namei_setup
*/
@@ -3353,7 +3352,21 @@
if ((flags & UF_RESOLVE_BENEATH) != 0) {
cnp->cn_flags |= RBENEATH;
ndp->ni_resflags |= NIRES_BENEATH;
+ /*
+ * For empty path reopens, enforce that the new open
+ * does not gain additional access rights over the
+ * original file descriptor.
+ */
+ if ((cnp->cn_flags & EMPTYPATH) != 0 &&
+ (((cnp->cn_flags & OPENREAD) != 0 &&
+ (fp->f_flag & FREAD) == 0) ||
+ ((cnp->cn_flags & OPENWRITE) != 0 &&
+ (fp->f_flag & FWRITE) == 0))) {
+ error = EACCES;
+ goto out_free;
+ }
}
+ vrefact(vp);
fdrop(fp, td);
#ifdef CAPABILITIES
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 27, 7:39 PM (14 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42047771
Default Alt Text
D58081.1795808392.diff (870 B)
Attached To
Mode
D58081: kern: enforce access rights on O_EMPTY_PATH reopens with FD_RESOLVE_BENEATH
Attached
Detach File
Event Timeline