From: Ram <linuxram@us.ibm.com>
To: johnpol@2ka.mipt.ru
Cc: Guillaume Thouvenin <guillaume.thouvenin@bull.net>,
Jesse Barnes <jbarnes@engr.sgi.com>,
Andrew Morton <akpm@osdl.org>,
lkml <linux-kernel@vger.kernel.org>, Jay Lan <jlan@engr.sgi.com>,
Erich Focht <efocht@hpce.nec.com>,
Gerrit Huizenga <gh@us.ibm.com>,
elsa-devel <elsa-devel@lists.sourceforge.net>
Subject: Re: [patch 1/2] fork_connector: add a fork connector
Date: Tue, 22 Mar 2005 12:42:48 -0800 [thread overview]
Message-ID: <1111524168.5860.109.camel@localhost> (raw)
In-Reply-To: <20050322232524.67bf5054@zanzibar.2ka.mipt.ru>
On Tue, 2005-03-22 at 12:25, Evgeniy Polyakov wrote:
> On Tue, 22 Mar 2005 11:18:07 -0800
> Ram <linuxram@us.ibm.com> wrote:
>
> > > I still do not see why it is needed.
> > > Super-user can run ip command and turn network interface off
> > > not waiting while apache or named exits or unbind.
> > >
> > > In theory I can create some kind of userspace registration mechanism,
> > > when userspace application reports it's pid to the connector,
> > > and then it sends data to the specified pids, but does not
> > > allow controlling from userspace.
> > > But I really do not think it is a good idea to permit
> > > non-priviledged userspace processes to know about deep
> > > kernel internals through connector's messages.
> >
> > Yes. non-priviledged userspace processes should not know
> > any deep kernel internals through connector events.
> >
> > I think what I am driving at is, an application that is critically
> > dependent on the fork-notification, suddenly stops receiving such
> > notification because some other application has switched off the
> > service without its notice.
> >
> > the reason I am concerned is I am planning to feed this fork-events
> > to my in-kernel module. Side note: I would really like support for
> > in-kernel listners through connector infrastructure.
>
> fork connector can be extended to send to the rest of the world
> information that it was turned off or on.
This will support the paradigm: "Let me know if this is switched off,
and I don't mind any arbitrary process switching it off". No
applications can seriously rely on this service, because there is this
*arbritray-application-being-able-to-control* component to it.
A ideal paradigm would be: "Don't switch it off, without my consent".
Essentially this will give applications enough confidence to rely on it
seriously.
However an inbetween paradigm that would acceptable is:
"Let me know if this is swtiched off provided only application that I
can trust-on has the power to manage it".
To me 2nd or 3rd paradigm seems acceptable, but not the 1st.
>
> The easiest way to listen inside the kernel for connector's
> notifications is creating appropriate socket in userspace
> and then obtain it through the following code which must be
> run in context of the process that created above socket:
>
> struct file *file;
> struct inode *inode;
> int err = 0;
>
> file = fget(userspace_socket_number_in_the_current_process_context);
> if (!file) {
> return -ENODEV;
> }
> inode = file->f_dentry->d_inode;
> if (inode->i_sock) {
> sock = SOCKET_I(inode);
> err = 0;
> } else {
> fput(file);
> err = -ENODEV;
> }
>
> sock is struct sock, which then can be used for read/write
> operations using
> kernel_recvmsg(sock, &msg, &iov, 1, size, 0);
> kernel_sendmsg(sock, &msg, &iov, 1, size);
>
> with the following initialisation:
>
> sock->sk->sk_allocation |= GFP_NOIO;
> iov.iov_base = buf;
> iov.iov_len = size;
> msg.msg_name = NULL;
> msg.msg_namelen = 0;
> msg.msg_control = NULL;
> msg.msg_controllen = 0;
> msg.msg_namelen = 0;
> msg.msg_flags = msg_flags | MSG_NOSIGNAL;
>
right. thanks for the code snippet. I should be coding something
around these lines.
>
> Of course it can be done directly from kernelspace without
> touching process's structures, but this way is easier.
Thanks,
RP
>
> > RP
>
> Evgeniy Polyakov
>
> Only failure makes us experts. -- Theo de Raadt
next prev parent reply other threads:[~2005-03-22 20:45 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-17 9:04 [patch 1/2] fork_connector: add a fork connector Guillaume Thouvenin
2005-03-17 16:56 ` Jesse Barnes
2005-03-17 21:38 ` Evgeniy Polyakov
2005-03-17 22:05 ` Jesse Barnes
2005-03-21 8:23 ` Guillaume Thouvenin
2005-03-21 12:48 ` Guillaume Thouvenin
2005-03-21 20:52 ` Ram
2005-03-22 4:36 ` Evgeniy Polyakov
2005-03-22 18:40 ` Ram
2005-03-22 7:07 ` Guillaume Thouvenin
2005-03-22 18:15 ` Jay Lan
2005-03-23 8:15 ` Guillaume Thouvenin
2005-03-22 18:26 ` Ram
2005-03-22 19:22 ` Evgeniy Polyakov
2005-03-22 19:18 ` Ram
2005-03-22 20:25 ` Evgeniy Polyakov
2005-03-22 20:42 ` Ram [this message]
2005-03-23 4:52 ` Evgeniy Polyakov
2005-03-22 22:51 ` Jay Lan
2005-03-22 23:51 ` Jay Lan
2005-03-23 5:01 ` Evgeniy Polyakov
[not found] ` <1111557106.23532.65.camel@uganda>
2005-03-23 19:00 ` Ram
-- strict thread matches above, loose matches on Subject: below --
2005-03-25 10:03 Guillaume Thouvenin
2005-03-25 22:45 ` dean gaudet
2005-03-28 21:42 ` Paul Jackson
2005-03-29 7:04 ` Evgeniy Polyakov
2005-03-29 7:02 ` Greg KH
2005-03-29 7:10 ` Evgeniy Polyakov
2005-03-29 8:49 ` Paul Jackson
2005-03-29 9:17 ` Guillaume Thouvenin
2005-03-29 15:23 ` Paul Jackson
2005-03-29 18:44 ` Jay Lan
2005-03-30 1:05 ` Paul Jackson
2005-03-30 5:39 ` Guillaume Thouvenin
2005-03-30 6:35 ` Paul Jackson
2005-03-30 10:25 ` Herbert Xu
2005-03-30 10:57 ` Evgeniy Polyakov
2005-03-30 11:01 ` Guillaume Thouvenin
2005-04-01 3:26 ` Drew Hess
2005-03-29 10:29 ` Evgeniy Polyakov
2005-03-29 17:03 ` Paul Jackson
2005-03-29 21:09 ` Jay Lan
2005-03-29 22:01 ` Paul Jackson
2005-03-30 14:14 ` Evgeniy Polyakov
2005-03-30 20:56 ` Paul Jackson
2005-03-30 6:06 ` dean gaudet
2005-03-30 6:25 ` Paul Jackson
2005-03-30 6:38 ` Guillaume Thouvenin
2005-03-30 18:11 ` Jay Lan
2005-03-29 8:05 ` Guillaume Thouvenin
2005-03-29 14:47 ` Paul Jackson
2005-03-29 12:51 ` Guillaume Thouvenin
2005-03-29 15:35 ` Paul Jackson
2005-03-30 5:52 ` Guillaume Thouvenin
2005-03-30 6:41 ` Paul Jackson
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=1111524168.5860.109.camel@localhost \
--to=linuxram@us.ibm.com \
--cc=akpm@osdl.org \
--cc=efocht@hpce.nec.com \
--cc=elsa-devel@lists.sourceforge.net \
--cc=gh@us.ibm.com \
--cc=guillaume.thouvenin@bull.net \
--cc=jbarnes@engr.sgi.com \
--cc=jlan@engr.sgi.com \
--cc=johnpol@2ka.mipt.ru \
--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