Skip to contentSkip to conversation

: Revert 2.6.36 chroot ttyname regression

PATCH In review Eric W. Biederman 2 participants 3 messages Dec 5, 2010 – Dec 6, 2010 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Revert 2.6.36 chroot ttyname regression

As of 2.6.36 ttyname does not work in a chroot. It has already been reported that screen breaks, and for me this breaks an automated distribution testsuite, that I need to preserve the ability to run the existing binaries on for several more years. glibc 2.11.3 which has a fix for this is not an option.

The root cause of this breakage is:
commit 8df9d1a4142311c084ffeeacb67cd34d190eff74

Author: Miklos Szeredi <[email protected]>
Date:   Tue Aug 10 11:41:41 2010 +0200

vfs: show unreachable paths in getcwd and proc

Prepend "(unreachable)" to path strings if the path is not reachable from the current root.

Two places updated are
- the return string from getcwd()
- and symlinks under /proc/$PID.

Other uses of d_path() are left unchanged (we know that some old software crashes if /proc/mounts is changed).

So remove the nice sounding, but ultimately ill advised change to how /proc/fd symlinks work.

fs/proc/base.c +1 -1
Index: linux-2.6.37-rc4.x86_64/fs/proc/base.c
===================================================================
@@ -1574,7 +1574,7 @@ static int do_proc_readlink(struct path 
 	if (!tmp)
 		return -ENOMEM;
 
-	pathname = d_path_with_unreachable(path, tmp, PAGE_SIZE);
+	pathname = d_path(path, tmp, PAGE_SIZE);
 	len = PTR_ERR(pathname);
 	if (IS_ERR(pathname))
 		goto out;
#1 lore raw
Quoted 2 lines · Eric W. Biederman

As of 2.6.36 ttyname does not work in a chroot.

I'll happily revert, but even for trivial stuff like this I'd like to get the sign-off, just so that we always have it.

Linus

#2 lore raw
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Eric W. Biederman

As of 2.6.36 ttyname does not work in a chroot.

I'll happily revert, but even for trivial stuff like this I'd like to get the sign-off, just so that we always have it.

No problem, I just forgot. The patch is resent.

Eric