multiple devpts mounts not supported in sysdeps/unix/sysv/linux/ptsname.c:_ptsname_internal()

Serge E. Hallyn serge.hallyn@canonical.com
Tue Oct 11 17:18:00 GMT 2011


Hi,

grantpt, ptsname, and ptsname_r make use of _ptsname_internal().  That
function works by appending the TIOCGPTN result to "/dev/pts".  The
path /dev/pts is hardcoded.  That means that if you call grantpt on an
fd from /chroot/dev/pts, and /dev/pts/0 (for instance) does not exist
on the host, you'll (wrongly) get back an error.  This has been seen with
libvirt (and is easly to verify with a simple testcase).

I'm not sure of the best way to fix this in a way palatable to glibc.
Follow the /proc/self/fd/N symlink?  Update the manpages to say the
devpts used must be mounted under /dev/pts by the caller?  (Caller would
need privilege, but can fork+unshare+bind-mount).

thanks,
-serge



More information about the Libc-alpha mailing list