netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore@hp.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: sam@synack.fr, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	netfilter-devel@vger.kernel.org, hadi@cyberus.ca,
	kaber@trash.net, zbr@ioremap.net, root@localdomain.pl
Subject: Re: [RFC v3 02/10] Revert "lsm: Remove the socket_post_accept() hook"
Date: Thu, 5 May 2011 10:11:32 -0400	[thread overview]
Message-ID: <201105051011.32845.paul.moore@hp.com> (raw)
In-Reply-To: <201105041128.BAB13061.LMHVtOSOQOFFJF@I-love.SAKURA.ne.jp>

On Tuesday, May 03, 2011 10:28:24 PM Tetsuo Handa wrote:
> Paul Moore wrote:
> > On Tuesday, May 03, 2011 10:24:15 AM Samir Bellabes wrote:
> > > snet needs to reintroduce this hook, as it was designed to be: a hook
> > > for updating security informations on objects.
> > 
> > Looking at this and 5/10 again, it seems that you should be able to do
> > what you need with the sock_graft() hook.  Am I missing something?
> > 
> > My apologies if we've already discussed this approach previously ...
> 
> static void snet_socket_post_accept(struct socket *sock, struct socket
> *newsock) {
> 	static void snet_do_send_event(struct snet_info *info)
> 	{
> 		int snet_nl_send_event(struct snet_info *info)
> 		{
> 			skb_rsp = genlmsg_new(size, GFP_KERNEL);
> 			genlmsg_unicast()
> 		}
> 	}
> }
> 
> First problem with using snet_do_send_event() from security_sock_graft() is
> that we have to use GFP_ATOMIC rather than GFP_KERNEL because we are inside
> write_lock_bh()/write_unlock_bh().

I guess I don't see that as being a blocker ...

> static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32
> pid) {
> 	static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32
> pid) {
> 		int netlink_unicast(struct sock *ssk, struct sk_buff *skb,
> 			u32 pid, MSG_DONTWAIT)
> 		{
> 			int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
> 				      long *timeo, struct sock *ssk)
> 			{
> 				if (!*timeo) {
> 					return -EAGAIN;
> 			}
> 		}
> 	}
> }
> 
> Second problem is that genlmsg_unicast() might return -EAGAIN because we
> can't sleep inside write_lock_bh()/write_unlock_bh().

Ah yes, the real problem.  I forgot that snet relied on a user space tool.  I 
tend to agree with others who have suggested this is not the right approach, 
but I understand why you want the post_accept() hook; thanks for reminding me.

--
paul moore
linux @ hp

  parent reply	other threads:[~2011-05-05 14:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 14:24 [RFC v3 00/10] snet: Security for NETwork syscalls Samir Bellabes
2011-05-03 14:24 ` [RFC v3 01/10] lsm: add security_socket_closed() Samir Bellabes
2011-05-03 15:29   ` Tetsuo Handa
2011-05-03 15:41     ` Samir Bellabes
2011-05-03 14:24 ` [RFC v3 02/10] Revert "lsm: Remove the socket_post_accept() hook" Samir Bellabes
2011-05-03 22:02   ` Paul Moore
2011-05-04  2:28     ` Tetsuo Handa
2011-05-04  8:50       ` Samir Bellabes
2011-05-05 14:11       ` Paul Moore [this message]
2011-05-05 21:43         ` Tetsuo Handa
2011-05-06  9:25           ` Samir Bellabes
2011-05-06 17:27             ` Paul Moore
2011-05-03 14:24 ` [RFC v3 03/10] snet: introduce snet_core Samir Bellabes
2011-05-03 14:24 ` [RFC v3 04/10] snet: introduce snet_event Samir Bellabes
2011-05-03 14:24 ` [RFC v3 05/10] snet: introduce snet_hooks Samir Bellabes
2011-05-03 14:24 ` [RFC v3 06/10] snet: introduce snet_netlink Samir Bellabes
2011-05-03 14:24 ` [RFC v3 07/10] snet: introduce snet_verdict Samir Bellabes
2011-05-03 14:24 ` [RFC v3 08/10] snet: introduce snet_ticket Samir Bellabes
2011-05-03 14:24 ` [RFC v3 09/10] snet: introduce snet_utils Samir Bellabes
2011-05-03 14:24 ` [RFC v3 10/10] snet: introduce security/snet, Makefile and Kconfig changes Samir Bellabes
2011-05-03 16:53 ` [RFC v3 00/10] snet: Security for NETwork syscalls Casey Schaufler
2011-05-03 17:15   ` Samir Bellabes

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=201105051011.32845.paul.moore@hp.com \
    --to=paul.moore@hp.com \
    --cc=hadi@cyberus.ca \
    --cc=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=root@localdomain.pl \
    --cc=sam@synack.fr \
    --cc=zbr@ioremap.net \
    /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;
as well as URLs for NNTP newsgroup(s).