public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Corbet <corbet@lwn.net>
To: Alex Dubov <alex.dubov@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: Minimal effort/low overhead file descriptor duplication over Posix.1b s
Date: Tue, 2 Dec 2014 10:26:32 -0500	[thread overview]
Message-ID: <20141202102632.6ae37b88@lwn.net> (raw)
In-Reply-To: <1417494919-4577-1-git-send-email-oakad@yahoo.com>

On Tue,  2 Dec 2014 15:35:17 +1100
Alex Dubov <alex.dubov@gmail.com> wrote:

>     int sendfd(pid_t pid, int sig, int fd)
> 
> Given a target process pid, the sendfd() syscall will create a duplicate
> file descriptor in a target task's (referred by pid) file table pointing to
> the file references by descriptor fd. Then, it will attempt to notify the
> target task by issuing a Posix.1b real-time signal (sig), carrying the new
> file descriptor as integer payload. If real-time signal can not be enqueued
> at the destination signal queue, the newly created file descriptor will be
> promptly closed.

[ CC += linux-api ]

So I'm not a syscall API design expert, but this one raises a few
questions with me.

 - Messing with another process's file descriptor table without its
   knowledge looks like a possible source of all kinds problems.  Might
   there be race conditions with close()/dup() code, for example?  And
   remember that users can be root in a user namespace; maybe there's no
   potential for mischief there, but it needs to be considered.

 - Forcing the use of realtime signals seems strange; this isn't a
   realtime operation by any stretch.

 - How might the sending process communicate to the recipient what the fd
   is for?  Even if a process only expects one type of file descriptor,
   the ability to communicate information other than its number seems
   like it would often be useful.

Some of these concerns might be addressable by requiring the recipient to
call acceptfd() (or some such) with the ability to use poll().  As an
alternative, I believe kdbus has fd-passing abilities; if kdbus goes in,
would you still need this feature?

Thanks,

jon

  parent reply	other threads:[~2014-12-02 15:26 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02  4:35 Minimal effort/low overhead file descriptor duplication over Posix.1b s Alex Dubov
2014-12-02  4:35 ` [PATCH 1/2] fs: introduce sendfd() syscall Alex Dubov
2014-12-02 12:50   ` Eric Dumazet
2014-12-02 14:47     ` Alex Dubov
2014-12-02 15:33       ` Eric Dumazet
2014-12-02 16:23         ` Alex Dubov
2014-12-02 16:42           ` Eric Dumazet
2014-12-03  2:11             ` Alex Dubov
2014-12-03  6:48               ` Eric Dumazet
2014-12-02 17:00   ` Al Viro
2014-12-03  2:22     ` Alex Dubov
2014-12-03  3:40       ` Al Viro
2014-12-03  4:14         ` Alex Dubov
2014-12-03  6:50       ` Eric Dumazet
2014-12-03  8:08         ` Richard Cochran
2014-12-03  8:17           ` Richard Weinberger
2014-12-03 10:41             ` Richard Cochran
2014-12-03 14:08               ` Alex Dubov
2014-12-05 13:37               ` One Thousand Gnomes
2014-12-02  4:35 ` [PATCH 2/2] fs: Wire up sendfd() syscall (all architectures) Alex Dubov
2014-12-02  8:01   ` Geert Uytterhoeven
2014-12-02  8:31     ` Alex Dubov
2014-12-02 11:42     ` Michal Simek
2014-12-02 14:31       ` Alex Dubov
2014-12-02 14:38         ` Geert Uytterhoeven
2014-12-02 15:26 ` Jonathan Corbet [this message]
2014-12-02 16:15   ` Minimal effort/low overhead file descriptor duplication over Posix.1b s Alex Dubov
2014-12-17 13:11 ` Kevin Easton

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=20141202102632.6ae37b88@lwn.net \
    --to=corbet@lwn.net \
    --cc=alex.dubov@gmail.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox