This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #14516] Don't make ttyname fail if procfs is unavailable


On 8/24/2012 5:20 AM, Siddhesh Poyarekar wrote:
> Hi,
> 
> SSH chroot using pam_chroot.so does not work when there is no
> mounted /proc inside the chroot. The ssh server throws the following
> error in /var/log/secure:
> 
> Aug 24 13:26:06 rawhide sshd[11735]: fatal: openpty returns device for
> which ttyname fails.
> 
> while the client shows the following error and disconnects:
> 
> Connection to localhost closed by remote host.
> Connection to localhost closed.
> 
> This failure occurs because sshd calls ttyname() and fails due to /proc
> not being present inside the chroot by returning -1 and setting errno
> to EBADF. Thanks to Masahiro Matsuya <mmatsuya@redhat.com> for
> isolating the root cause of this problem.
> 
> Steps to reproduce this are mentioned in the bugzilla. Attached patch
> removes the failure path and allows ttyname() to fall back to
> traversing /dev/pts/ for the file descriptor if /proc is unavailable.
> 
> I have tested this on Fedora rawhide x86_64 and found no regressions
> resulting from this fix.
> 
> Regards,
> Siddhesh
> 
> ChangeLog:
> 
> 	[BZ #14516]
> 	* sysdeps/unix/sysv/linux/ttyname.c (ttyname): Don't return
> 	failure if reading from procfs failed.
> 

This looks good to me.

I see no reason why we should fail if we fail to open /proc.

This is a change in behaviour though and you should write a NEWS
entry for this e.g.
~~~
Use of ttyname now falls back on /dev/pts if /proc is unreadable;
this facilitates using chroots without /proc.
~~~

Cheers,
Carlos.
-- 
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos_odonell@mentor.com
carlos@codesourcery.com
+1 (613) 963 1026


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]