Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174374389
D59884.id188014.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
D59884.id188014.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
@@ -1935,6 +1935,16 @@
bzero(fcaps, sizeof(*fcaps));
}
+bool
+filecaps_full(const struct filecaps *fcaps)
+{
+ cap_rights_t allrights;
+
+ CAP_ALL(&allrights);
+ return (cap_rights_contains(&fcaps->fc_rights, &allrights) &&
+ fcaps->fc_fcntls == CAP_FCNTL_ALL && fcaps->fc_nioctls == -1);
+}
+
static u_long *
filecaps_free_prep(struct filecaps *fcaps)
{
@@ -3302,10 +3312,7 @@
*
* Not yet supported by fast path.
*/
- CAP_ALL(&rights);
- if (!cap_rights_contains(&ndp->ni_filecaps.fc_rights, &rights) ||
- ndp->ni_filecaps.fc_fcntls != CAP_FCNTL_ALL ||
- ndp->ni_filecaps.fc_nioctls != -1) {
+ if (!filecaps_full(&ndp->ni_filecaps)) {
#ifdef notyet
ndp->ni_lcf |= NI_LCF_STRICTREL;
#else
@@ -3407,10 +3414,7 @@
* all lookups relative to it must also be
* strictly relative.
*/
- CAP_ALL(&rights);
- if (!cap_rights_contains(&ndp->ni_filecaps.fc_rights, &rights) ||
- ndp->ni_filecaps.fc_fcntls != CAP_FCNTL_ALL ||
- ndp->ni_filecaps.fc_nioctls != -1) {
+ if (!filecaps_full(&ndp->ni_filecaps)) {
ndp->ni_lcf |= NI_LCF_STRICTREL;
ndp->ni_resflags |= NIRES_STRICTREL;
}
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -245,6 +245,7 @@
void filecaps_move(struct filecaps *src, struct filecaps *dst);
void filecaps_fill(struct filecaps *fcaps);
void filecaps_free(struct filecaps *fcaps);
+bool filecaps_full(const struct filecaps *fcaps);
int closef(struct file *fp, struct thread *td);
void closef_nothread(struct file *fp);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 3, 6:50 PM (2 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39774070
Default Alt Text
D59884.id188014.diff (1 KB)
Attached To
Mode
D59884: file: Add a helper function to check whether filecaps are full
Attached
Detach File
Event Timeline
Log In to Comment