public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12167] New: ttyname() and ttyname_r() may return wrong value
@ 2010-10-28 12:49 miklos at szeredi dot hu
  2010-10-28 12:51 ` [Bug libc/12167] " miklos at szeredi dot hu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: miklos at szeredi dot hu @ 2010-10-28 12:49 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-30  6:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 12:49 [Bug libc/12167] New: ttyname() and ttyname_r() may return wrong value miklos at szeredi dot hu
2010-10-28 12:51 ` [Bug libc/12167] " miklos at szeredi dot hu
2010-10-28 12:55 ` miklos at szeredi dot hu
2010-11-03  4:26 ` drepper.fsp at gmail dot com
2014-06-30  6:33 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).