mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Christian Brauner <christian.brauner@ubuntu.com>
To: musl@lists.openwall.com
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Subject: [PATCH 0/1] openpty: use TIOCGPTPEER to open slave side fd
Date: Fri,  1 Sep 2017 17:35:57 +0200	[thread overview]
Message-ID: <20170901153558.29715-1-christian.brauner@ubuntu.com> (raw)

Hi,

Newer kernels expose the ioctl TIOCGPTPEER [1] call to userspace which allows to
safely allocate a file descriptor for a pty slave based solely on the master
file descriptor. This allows us to avoid path-based operations and makes this
function a lot safer in the face of devpts mounts in different mount namespaces.

[1]: https://patchwork.kernel.org/patch/9760743/

The way I wrote this patch it doesn't use the snprintf() and open() routine as a
fallback in case the ioctl() call fails. If this is a compatibility issue for
non-Linux systems I can rewrite. But the musl documentation gave me the
impression that this is not really a concern.

If possible, please Cc me on this since I'm not subscribed to the mailing list
(yet).

Thanks!
Christian

Christian Brauner (1):
  openpty: use TIOCGPTPEER to open slave side fd

 src/misc/openpty.c | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

-- 
2.14.1



             reply	other threads:[~2017-09-01 15:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01 15:35 Christian Brauner [this message]
2017-09-01 15:35 ` [PATCH 1/1] " Christian Brauner
2017-09-01 16:00 ` [PATCH 0/1] " Rich Felker
2017-09-01 16:07   ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170901153558.29715-1-christian.brauner@ubuntu.com \
    --to=christian.brauner@ubuntu.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).