On Tue, Oct 27, 2026 at 04:46:09PM +0800, Chen Linxuan via B4 Relay wrote:
> +     case PIDFD_GET_EXE:
> +     case PIDFD_GET_CWD:
> +     case PIDFD_GET_ROOT:
> +             error = pidfd_get_task_path(pidfd_pid(file), cmd, arg, &path);
> +             if (error)
> +                     return error;
> +
> +             return FD_ADD(O_CLOEXEC,
> +                           dentry_open(&path, O_PATH, current_cred()));

So the path we take from the task is a jump target, just like
/proc/<pid>/cwd and /proc/<pid>/root are. So complete_walk() runs
->d_weak_revalidate() on them. Without that a stale dentry on nfs or
overlayfs turns into a valid O_PATH fd.

And failfs relies on ->d_weak_revalidate() to refuse pinning its root. A
task that fchdir()ed into the failfs root can now hand it out through
PIDFD_GET_CWD. Which would be breaking a guarantee we give. So we need
the same check here. I'm just not yet sure how we best do this.

Reply via email to