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

Mike Frysinger vapier@gentoo.org
Tue Oct 11 17:52:00 GMT 2011


On Tuesday 11 October 2011 13:15:37 Serge E. Hallyn wrote:
> 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).

`mount --bind /dev/pts /chroot/dev/pts` ?

> 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).

doesn't the caller already need privs to chroot in the first place ?

it's been this way for years which means i would have expected all relevant 
code to have accounted for this already (not saying that it wouldn't be nice 
to have things "just work" when possible) ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20111011/9921b95d/attachment.sig>


More information about the Libc-alpha mailing list