Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F138001717
D19096.id53638.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
D19096.id53638.diff
View Options
Index: sys/kern/vfs_lookup.c
===================================================================
--- sys/kern/vfs_lookup.c
+++ sys/kern/vfs_lookup.c
@@ -410,6 +410,7 @@
dp = NULL;
cnp->cn_nameptr = cnp->cn_pnbuf;
if (cnp->cn_pnbuf[0] == '/') {
+ ndp->ni_resflags |= NIRES_ABS;
error = namei_handle_root(ndp, &dp);
} else {
if (ndp->ni_startdir != NULL) {
@@ -1302,6 +1303,7 @@
ndp->ni_dirp = namep;
ndp->ni_dirfd = dirfd;
ndp->ni_startdir = startdir;
+ ndp->ni_resflags = 0;
filecaps_init(&ndp->ni_filecaps);
ndp->ni_cnd.cn_thread = td;
if (rightsp != NULL)
Index: sys/kern/vfs_syscalls.c
===================================================================
--- sys/kern/vfs_syscalls.c
+++ sys/kern/vfs_syscalls.c
@@ -3544,10 +3544,10 @@
goto out;
}
#ifdef CAPABILITIES
- if (newfd != AT_FDCWD) {
+ if (newfd != AT_FDCWD && (tond.ni_resflags & NIRES_ABS) == 0) {
/*
* If the target already exists we require CAP_UNLINKAT
- * from 'newfd'.
+ * from 'newfd', when newfd was used for the lookup.
*/
error = cap_check(&tond.ni_filecaps.fc_rights,
&cap_unlinkat_rights);
Index: sys/sys/namei.h
===================================================================
--- sys/sys/namei.h
+++ sys/sys/namei.h
@@ -87,6 +87,10 @@
*/
struct vnode *ni_vp; /* vnode of result */
struct vnode *ni_dvp; /* vnode of intermediate directory */
+ /*
+ * Results: flags returned from namei
+ */
+ u_int ni_resflags;
/*
* Shared between namei and lookup/commit routines.
*/
@@ -159,6 +163,11 @@
#define NOCAPCHECK 0x20000000 /* do not perform capability checks */
#define PARAMASK 0x3ffffe00 /* mask of parameter descriptors */
+/*
+ * Namei results flags
+ */
+#define NIRES_ABS 0x00000001 /* Path was absolute */
+
/*
* Flags in ni_lcf, valid for the duration of the namei call.
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 29, 1:15 AM (20 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26311589
Default Alt Text
D19096.id53638.diff (1 KB)
Attached To
Mode
D19096: Fix renameat(2) for CAPABILITIES kernels.
Attached
Detach File
Event Timeline
Log In to Comment