Skip to content

Commit 48ba620

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull namespace fixes from Eric Biederman: "This is a set of 3 regression fixes. This fixes /proc/mounts when using "ip netns add <netns>" to display the actual mount point. This fixes a regression in clone that broke lxc-attach. This fixes a regression in the permission checks for mounting /proc that made proc unmountable if binfmt_misc was in use. Oops. My apologies for sending this pull request so late. Al Viro gave interesting review comments about the d_path fix that I wanted to address in detail before I sent this pull request. Unfortunately a bad round of colds kept from addressing that in detail until today. The executive summary of the review was: Al: Is patching d_path really sufficient? The prepend_path, d_path, d_absolute_path, and __d_path family of functions is a really mess. Me: Yes, patching d_path is really sufficient. Yes, the code is mess. No it is not appropriate to rewrite all of d_path for a regression that has existed for entirely too long already, when a two line change will do" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: vfs: Fix a regression in mounting proc fork: Allow CLONE_PARENT after setns(CLONE_NEWPID) vfs: In d_path don't call d_dname on a mount point
2 parents 8f211b6 + 41301ae commit 48ba620

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎fs/dcache.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3061,8 +3061,13 @@ char *d_path(const struct path *path, char *buf, int buflen)
30613061
* thus don't need to be hashed. They also don't need a name until a
30623062
* user wants to identify the object in /proc/pid/fd/. The little hack
30633063
* below allows us to generate a name for these objects on demand:
3064+
*
3065+
* Some pseudo inodes are mountable. When they are mounted
3066+
* path->dentry == path->mnt->mnt_root. In that case don't call d_dname
3067+
* and instead have d_path return the mounted path.
30643068
*/
3065-
if (path->dentry->d_op && path->dentry->d_op->d_dname)
3069+
if (path->dentry->d_op && path->dentry->d_op->d_dname &&
3070+
(!IS_ROOT(path->dentry) || path->dentry != path->mnt->mnt_root))
30663071
return path->dentry->d_op->d_dname(path->dentry, buf, buflen);
30673072

30683073
rcu_read_lock();

‎fs/namespace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2886,7 +2886,7 @@ bool fs_fully_visible(struct file_system_type *type)
28862886
struct inode *inode = child->mnt_mountpoint->d_inode;
28872887
if (!S_ISDIR(inode->i_mode))
28882888
goto next;
2889-
if (inode->i_nlink != 2)
2889+
if (inode->i_nlink > 2)
28902890
goto next;
28912891
}
28922892
visible = true;

‎kernel/fork.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
11721172
* do not allow it to share a thread group or signal handlers or
11731173
* parent with the forking task.
11741174
*/
1175-
if (clone_flags & (CLONE_SIGHAND | CLONE_PARENT)) {
1175+
if (clone_flags & CLONE_SIGHAND) {
11761176
if ((clone_flags & (CLONE_NEWUSER | CLONE_NEWPID)) ||
11771177
(task_active_pid_ns(current) !=
11781178
current->nsproxy->pid_ns_for_children))

0 commit comments

Comments
 (0)