This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12167] New: ttyname() and ttyname_r() may return wrong value
- From: "miklos at szeredi dot hu" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Thu, 28 Oct 2010 12:49:30 +0000
- Subject: [Bug libc/12167] New: ttyname() and ttyname_r() may return wrong value
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=12167
Summary: ttyname() and ttyname_r() may return wrong value
Product: glibc
Version: 2.13
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper.fsp@gmail.com
ReportedBy: miklos@szeredi.hu
On linux 2.6.36:
# mount --bind / /mnt/tmp
# mount -t proc proc /mnt/tmp/proc
# chroot /mnt/tmp
# tty
(unreachable)/dev/tty2
This is caused by commit 8df9d1a4 (vfs: show unreachable paths in getcwd and
proc) explicitly marking files that are unreachable from the current root.
Before this commit the symlink was either junk or contained the path from the
namespace root which may, or may not point to the inode behind the file
descriptor. Note: *following* the symlink (not reading it) always yielded the
correct file.
In addition these symlinks may contain the string "(deleted)" at the end if the
file was unlinked after it was opened.
The conclusion is that ttyname() should verify that the path returned from
reading the symlink does indeed refer to the same device as the file
descriptor.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.